From: Jan Kara Subject: Re: [PATCH] quota: sb_quota state flags cleanup Date: Tue, 2 Feb 2010 16:40:50 +0100 Message-ID: <20100202154050.GG7056@quack.suse.cz> References: <1265119669-2557-1-git-send-email-dmonakhov@openvz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, jack@suse.cz To: Dmitry Monakhov Return-path: Received: from cantor2.suse.de ([195.135.220.15]:53207 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756502Ab0BBPkm (ORCPT ); Tue, 2 Feb 2010 10:40:42 -0500 Content-Disposition: inline In-Reply-To: <1265119669-2557-1-git-send-email-dmonakhov@openvz.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue 02-02-10 17:07:49, Dmitry Monakhov wrote: > - remove hardcoded USRQUOTA/GRPQUOTA flags > - convert int to bool for appropriate functions > > Signed-off-by: Dmitry Monakhov > --- ... > -static inline int sb_any_quota_suspended(struct super_block *sb) > +static inline unsigned sb_any_quota_suspended(struct super_block *sb) > { > - return sb_has_quota_suspended(sb, USRQUOTA) || > - sb_has_quota_suspended(sb, GRPQUOTA); > + unsigned type, tmsk = 0; > + for (type = 0; type < MAXQUOTAS; type++) > + tmsk |= sb_has_quota_suspended(sb, type) << type; > + return tmsk; > } Any particular reason for returning the mask instead of a simple bool? Are you going to use the mask in future? > -static inline int sb_any_quota_loaded(struct super_block *sb) > +static inline unsigned sb_any_quota_loaded(struct super_block *sb) > { > - return sb_has_quota_loaded(sb, USRQUOTA) || > - sb_has_quota_loaded(sb, GRPQUOTA); > + unsigned type, tmsk = 0; > + for (type = 0; type < MAXQUOTAS; type++) > + tmsk |= sb_has_quota_loaded(sb, type) << type; > + return tmsk; > } And here as well... > -static inline int sb_any_quota_active(struct super_block *sb) > +static inline unsigned sb_any_quota_active(struct super_block *sb) > { > - return sb_has_quota_active(sb, USRQUOTA) || > - sb_has_quota_active(sb, GRPQUOTA); > + return sb_any_quota_loaded(sb); > } This is wrong - quota is active if it is loaded and is not suspended... Honza -- Jan Kara SUSE Labs, CR