]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
f2fs: introduce F2FS_QUOTA_DEFAULT_FL for cleanup
authorChao Yu <chao@kernel.org>
Tue, 6 Jun 2023 06:18:22 +0000 (14:18 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 26 Jun 2023 13:07:08 +0000 (06:07 -0700)
This patch adds F2FS_QUOTA_DEFAULT_FL to include two default flags:
F2FS_NOATIME_FL and F2FS_IMMUTABLE_FL, and use it to clean up codes.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/super.c

index 4b249716ae7b0ddfb66745ee1ea2f042c70eb66a..5582a93d919056a648197cf4a148b41c99c20324 100644 (file)
@@ -2960,6 +2960,8 @@ static inline void f2fs_change_bit(unsigned int nr, char *addr)
 #define F2FS_PROJINHERIT_FL            0x20000000 /* Create with parents projid */
 #define F2FS_CASEFOLD_FL               0x40000000 /* Casefolded file */
 
+#define F2FS_QUOTA_DEFAULT_FL          (F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL)
+
 /* Flags that should be inherited by new inodes from their parent. */
 #define F2FS_FL_INHERITED (F2FS_SYNC_FL | F2FS_NODUMP_FL | F2FS_NOATIME_FL | \
                           F2FS_DIRSYNC_FL | F2FS_PROJINHERIT_FL | \
index 8fd23caa1ed991a25dbbffe7e1278eccebe4e688..8efbb2e1b8b159acdd699c1dd147a2e7f1e66bf2 100644 (file)
@@ -2768,7 +2768,7 @@ static int f2fs_quota_enable(struct super_block *sb, int type, int format_id,
 {
        struct inode *qf_inode;
        unsigned long qf_inum;
-       unsigned long qf_flag = F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL;
+       unsigned long qf_flag = F2FS_QUOTA_DEFAULT_FL;
        int err;
 
        BUG_ON(!f2fs_sb_has_quota_ino(F2FS_SB(sb)));
@@ -2945,7 +2945,7 @@ static int f2fs_quota_on(struct super_block *sb, int type, int format_id,
                return err;
 
        inode_lock(inode);
-       F2FS_I(inode)->i_flags |= F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL;
+       F2FS_I(inode)->i_flags |= F2FS_QUOTA_DEFAULT_FL;
        f2fs_set_inode_flags(inode);
        inode_unlock(inode);
        f2fs_mark_inode_dirty_sync(inode, false);
@@ -2970,7 +2970,7 @@ static int __f2fs_quota_off(struct super_block *sb, int type)
                goto out_put;
 
        inode_lock(inode);
-       F2FS_I(inode)->i_flags &= ~(F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL);
+       F2FS_I(inode)->i_flags &= ~F2FS_QUOTA_DEFAULT_FL;
        f2fs_set_inode_flags(inode);
        inode_unlock(inode);
        f2fs_mark_inode_dirty_sync(inode, false);