diff options
author | Roman Anufriev <dotdot@yandex-team.ru> | 2020-10-22 05:20:59 +0200 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2020-12-03 15:18:48 +0100 |
commit | f177ee0882af031b3d7a1e66e1639a58c7932dee (patch) | |
tree | cd061475283f5b60ff134a9406403fa836905891 /fs/ext4/ext4.h | |
parent | ext4: remove redundant assignment of variable ex (diff) | |
download | linux-f177ee0882af031b3d7a1e66e1639a58c7932dee.tar.xz linux-f177ee0882af031b3d7a1e66e1639a58c7932dee.zip |
ext4: add helpers for checking whether quota can be enabled/is journalled
Right now, there are several places, where we check whether fs is
capable of enabling quota or if quota is journalled with quite long
and non-self-descriptive condition statements.
This patch wraps these statements into helpers for better readability
and easier usage.
Link: https://lore.kernel.org/r/1603336860-16153-1-git-send-email-dotdot@yandex-team.ru
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Roman Anufriev <dotdot@yandex-team.ru>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 65ecaf96d0a4..fb4b36585ff6 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -3361,6 +3361,21 @@ static inline void ext4_unlock_group(struct super_block *sb, spin_unlock(ext4_group_lock_ptr(sb, group)); } +#ifdef CONFIG_QUOTA +static inline bool ext4_quota_capable(struct super_block *sb) +{ + return (test_opt(sb, QUOTA) || ext4_has_feature_quota(sb)); +} + +static inline bool ext4_is_quota_journalled(struct super_block *sb) +{ + struct ext4_sb_info *sbi = EXT4_SB(sb); + + return (ext4_has_feature_quota(sb) || + sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]); +} +#endif + /* * Block validity checking */ |