Re: [PATCH] quota: sb_quota state flags cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Kara <jack@xxxxxxx> writes:

> 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@xxxxxxxxxx>
>> ---
> ...
>> -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?
>
Actually i've not use this yet, but it is reasonable to
pass this mask in some places for example:
vfs_dq_init() {
 mask = sb_any_quota_active(inode->sb)
 dq_op->initialize(inode, mask)
}
in order to avoid checks for the same value inside ->initialize()

>> -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);
>>  }
Opps, will redo.
>   This is wrong - quota is active if it is loaded and is not suspended...
>
> 									Honza
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux