linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-fsdevel@vger.kernel.org, jack@suse.cz
Subject: Re: [PATCH] quota: sb_quota state flags cleanup
Date: Tue, 2 Feb 2010 16:40:50 +0100	[thread overview]
Message-ID: <20100202154050.GG7056@quack.suse.cz> (raw)
In-Reply-To: <1265119669-2557-1-git-send-email-dmonakhov@openvz.org>

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 <dmonakhov@openvz.org>
> ---
...
> -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 <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2010-02-02 15:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 14:07 [PATCH] quota: sb_quota state flags cleanup Dmitry Monakhov
2010-02-02 15:40 ` Jan Kara [this message]
2010-02-02 16:07   ` Dmitry Monakhov
2010-02-02 16:15     ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100202154050.GG7056@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=dmonakhov@openvz.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).