Commit e4bc7b4b authored by Jan Kara's avatar Jan Kara Committed by Mark Fasheh

quota: Make _SUSPENDED just a flag

Upto now, DQUOT_USR_SUSPENDED behaved like a state - i.e., either quota
was enabled or suspended or none. Now allowed states are 0, ENABLED,
ENABLED | SUSPENDED. This will be useful later when we implement separate
enabling of quota usage tracking and limits enforcement because we need to
keep track of a state which has been suspended.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
parent 1497d3ad
...@@ -1570,18 +1570,20 @@ static inline void reset_enable_flags(struct quota_info *dqopt, int type, ...@@ -1570,18 +1570,20 @@ static inline void reset_enable_flags(struct quota_info *dqopt, int type,
{ {
switch (type) { switch (type) {
case USRQUOTA: case USRQUOTA:
dqopt->flags &= ~DQUOT_USR_ENABLED;
if (remount) if (remount)
dqopt->flags |= DQUOT_USR_SUSPENDED; dqopt->flags |= DQUOT_USR_SUSPENDED;
else else {
dqopt->flags &= ~DQUOT_USR_ENABLED;
dqopt->flags &= ~DQUOT_USR_SUSPENDED; dqopt->flags &= ~DQUOT_USR_SUSPENDED;
}
break; break;
case GRPQUOTA: case GRPQUOTA:
dqopt->flags &= ~DQUOT_GRP_ENABLED;
if (remount) if (remount)
dqopt->flags |= DQUOT_GRP_SUSPENDED; dqopt->flags |= DQUOT_GRP_SUSPENDED;
else else {
dqopt->flags &= ~DQUOT_GRP_ENABLED;
dqopt->flags &= ~DQUOT_GRP_SUSPENDED; dqopt->flags &= ~DQUOT_GRP_SUSPENDED;
}
break; break;
} }
} }
......
...@@ -67,8 +67,10 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) ...@@ -67,8 +67,10 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
static inline int sb_has_quota_enabled(struct super_block *sb, int type) static inline int sb_has_quota_enabled(struct super_block *sb, int type)
{ {
if (type == USRQUOTA) if (type == USRQUOTA)
return sb_dqopt(sb)->flags & DQUOT_USR_ENABLED; return (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED)
return sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED; && !(sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED);
return (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED)
&& !(sb_dqopt(sb)->flags & DQUOT_GROUP_SUSPENDED);
} }
static inline int sb_any_quota_enabled(struct super_block *sb) static inline int sb_any_quota_enabled(struct super_block *sb)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment