]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
f2fs: convert F2FS_I_SB to sbi in f2fs_setattr()
authorwangzijie <wangzijie1@honor.com>
Tue, 24 Jun 2025 03:59:37 +0000 (11:59 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 24 Jun 2025 22:05:49 +0000 (22:05 +0000)
Introduce sbi in f2fs_setattr() and convert F2FS_I_SB to it. No logic
change, just cleanup and prepare to get CAP_BLKS_PER_SEC(sbi).

Signed-off-by: wangzijie <wangzijie1@honor.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index a909f79db178c18bbee9e13855aabeaab28a7117..63e9fb5a1c5950526f5594281bb2d72c63f8d077 100644 (file)
@@ -1042,9 +1042,10 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
 {
        struct inode *inode = d_inode(dentry);
        struct f2fs_inode_info *fi = F2FS_I(inode);
+       struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
        int err;
 
-       if (unlikely(f2fs_cp_error(F2FS_I_SB(inode))))
+       if (unlikely(f2fs_cp_error(sbi)))
                return -EIO;
 
        if (unlikely(IS_IMMUTABLE(inode)))
@@ -1084,12 +1085,11 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
        }
        if (i_uid_needs_update(idmap, attr, inode) ||
            i_gid_needs_update(idmap, attr, inode)) {
-               f2fs_lock_op(F2FS_I_SB(inode));
+               f2fs_lock_op(sbi);
                err = dquot_transfer(idmap, inode, attr);
                if (err) {
-                       set_sbi_flag(F2FS_I_SB(inode),
-                                       SBI_QUOTA_NEED_REPAIR);
-                       f2fs_unlock_op(F2FS_I_SB(inode));
+                       set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR);
+                       f2fs_unlock_op(sbi);
                        return err;
                }
                /*
@@ -1099,7 +1099,7 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
                i_uid_update(idmap, attr, inode);
                i_gid_update(idmap, attr, inode);
                f2fs_mark_inode_dirty_sync(inode, true);
-               f2fs_unlock_op(F2FS_I_SB(inode));
+               f2fs_unlock_op(sbi);
        }
 
        if (attr->ia_valid & ATTR_SIZE) {
@@ -1162,7 +1162,7 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
        f2fs_mark_inode_dirty_sync(inode, true);
 
        /* inode change will produce dirty node pages flushed by checkpoint */
-       f2fs_balance_fs(F2FS_I_SB(inode), true);
+       f2fs_balance_fs(sbi, true);
 
        return err;
 }