diff options
author | Jan Kara <jack@suse.cz> | 2008-08-20 11:50:32 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-01-05 11:36:56 -0500 |
commit | f55abc0fb9c3189de3da829adf3220322c0da43e (patch) | |
tree | 0db4b838b0b90f27401783e8e7e45842ec91f90a /include/linux/quota.h | |
parent | e4bc7b4b7ff783779b6928d55a9308910bf180a3 (diff) |
quota: Allow to separately enable quota accounting and enforcing limits
Split DQUOT_USR_ENABLED (and DQUOT_GRP_ENABLED) into DQUOT_USR_USAGE_ENABLED
and DQUOT_USR_LIMITS_ENABLED. This way we are able to separately enable /
disable whether we should:
1) ignore quotas completely
2) just keep uptodate information about usage
3) actually enforce quota limits
This is going to be useful when quota is treated as filesystem metadata - we
then want to keep quota information uptodate all the time and just enable /
disable limits enforcement.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'include/linux/quota.h')
-rw-r--r-- | include/linux/quota.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/include/linux/quota.h b/include/linux/quota.h index 9ea468363f9f..93717abcd35b 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -318,12 +318,34 @@ struct quota_format_type { | |||
318 | struct quota_format_type *qf_next; | 318 | struct quota_format_type *qf_next; |
319 | }; | 319 | }; |
320 | 320 | ||
321 | #define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ | 321 | /* Quota state flags - they actually come in two flavors - for users and groups */ |
322 | #define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ | 322 | enum { |
323 | #define DQUOT_USR_SUSPENDED 0x04 /* User diskquotas are off, but | 323 | _DQUOT_USAGE_ENABLED = 0, /* Track disk usage for users */ |
324 | _DQUOT_LIMITS_ENABLED, /* Enforce quota limits for users */ | ||
325 | _DQUOT_SUSPENDED, /* User diskquotas are off, but | ||
324 | * we have necessary info in | 326 | * we have necessary info in |
325 | * memory to turn them on */ | 327 | * memory to turn them on */ |
326 | #define DQUOT_GRP_SUSPENDED 0x08 /* The same for group quotas */ | 328 | _DQUOT_STATE_FLAGS |
329 | }; | ||
330 | #define DQUOT_USAGE_ENABLED (1 << _DQUOT_USAGE_ENABLED) | ||
331 | #define DQUOT_LIMITS_ENABLED (1 << _DQUOT_LIMITS_ENABLED) | ||
332 | #define DQUOT_SUSPENDED (1 << _DQUOT_SUSPENDED) | ||
333 | #define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \ | ||
334 | DQUOT_SUSPENDED) | ||
335 | |||
336 | static inline unsigned int dquot_state_flag(unsigned int flags, int type) | ||
337 | { | ||
338 | if (type == USRQUOTA) | ||
339 | return flags; | ||
340 | return flags << _DQUOT_STATE_FLAGS; | ||
341 | } | ||
342 | |||
343 | static inline unsigned int dquot_generic_flag(unsigned int flags, int type) | ||
344 | { | ||
345 | if (type == USRQUOTA) | ||
346 | return flags; | ||
347 | return flags >> _DQUOT_STATE_FLAGS; | ||
348 | } | ||
327 | 349 | ||
328 | struct quota_info { | 350 | struct quota_info { |
329 | unsigned int flags; /* Flags for diskquotas on this device */ | 351 | unsigned int flags; /* Flags for diskquotas on this device */ |