f2fs: replace F2FS_I(inode) and sbi by the local variable
authorYufen Yu <yuyufen@huawei.com>
Thu, 26 May 2022 02:21:06 +0000 (10:21 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 27 May 2022 20:58:23 +0000 (13:58 -0700)
We have define 'fi' at the begin of the functions, just use it,
rather than use F2FS_I(inode) again.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
[Jaegeuk Kim: replace sbi]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/inode.c

index c73014901006c16d82de3d5d62af8f6bccf5a90f..e10838879538387586b443b66330d24dbde2a209 100644 (file)
@@ -4403,8 +4403,8 @@ static inline bool f2fs_may_compress(struct inode *inode)
 static inline void f2fs_i_compr_blocks_update(struct inode *inode,
                                                u64 blocks, bool add)
 {
-       int diff = F2FS_I(inode)->i_cluster_size - blocks;
        struct f2fs_inode_info *fi = F2FS_I(inode);
+       int diff = fi->i_cluster_size - blocks;
 
        /* don't update i_compr_blocks if saved blocks were released */
        if (!add && !atomic_read(&fi->i_compr_blocks))
index a05d842a7e7222751ec7326b727fcb41ae3c319a..0297a4431540207474fed75be062ad6c328c590d 100644 (file)
@@ -2032,25 +2032,25 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
        if (ret)
                goto out;
 
-       f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
+       f2fs_down_write(&fi->i_gc_rwsem[WRITE]);
 
        /*
         * Should wait end_io to count F2FS_WB_CP_DATA correctly by
         * f2fs_is_atomic_file.
         */
        if (get_dirty_pages(inode))
-               f2fs_warn(F2FS_I_SB(inode), "Unexpected flush for atomic writes: ino=%lu, npages=%u",
+               f2fs_warn(sbi, "Unexpected flush for atomic writes: ino=%lu, npages=%u",
                          inode->i_ino, get_dirty_pages(inode));
        ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX);
        if (ret) {
-               f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
+               f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
                goto out;
        }
 
        /* Create a COW inode for atomic write */
        pinode = f2fs_iget(inode->i_sb, fi->i_pino);
        if (IS_ERR(pinode)) {
-               f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
+               f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
                ret = PTR_ERR(pinode);
                goto out;
        }
@@ -2058,7 +2058,7 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
        ret = f2fs_get_tmpfile(mnt_userns, pinode, &fi->cow_inode);
        iput(pinode);
        if (ret) {
-               f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
+               f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
                goto out;
        }
        f2fs_i_size_write(fi->cow_inode, i_size_read(inode));
@@ -2070,10 +2070,10 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
        set_inode_flag(inode, FI_ATOMIC_FILE);
        set_inode_flag(fi->cow_inode, FI_ATOMIC_FILE);
        clear_inode_flag(fi->cow_inode, FI_INLINE_DATA);
-       f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
+       f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
 
-       f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
-       F2FS_I(inode)->atomic_write_task = current;
+       f2fs_update_time(sbi, REQ_TIME);
+       fi->atomic_write_task = current;
        stat_update_max_atomic_write(inode);
 out:
        inode_unlock(inode);
@@ -2952,7 +2952,7 @@ static int f2fs_ioc_setproject(struct inode *inode, __u32 projid)
 
        kprojid = make_kprojid(&init_user_ns, (projid_t)projid);
 
-       if (projid_eq(kprojid, F2FS_I(inode)->i_projid))
+       if (projid_eq(kprojid, fi->i_projid))
                return 0;
 
        err = -EPERM;
@@ -2972,7 +2972,7 @@ static int f2fs_ioc_setproject(struct inode *inode, __u32 projid)
        if (err)
                goto out_unlock;
 
-       F2FS_I(inode)->i_projid = kprojid;
+       fi->i_projid = kprojid;
        inode->i_ctime = current_time(inode);
        f2fs_mark_inode_dirty_sync(inode, true);
 out_unlock:
@@ -3922,7 +3922,7 @@ static int f2fs_ioc_decompress_file(struct file *filp, unsigned long arg)
        struct f2fs_inode_info *fi = F2FS_I(inode);
        pgoff_t page_idx = 0, last_idx;
        unsigned int blk_per_seg = sbi->blocks_per_seg;
-       int cluster_size = F2FS_I(inode)->i_cluster_size;
+       int cluster_size = fi->i_cluster_size;
        int count, ret;
 
        if (!f2fs_sb_has_compression(sbi) ||
index 938961a9084e35db88b0a93c0491a1514d6c8630..fc55f5bd1fcc2ef03b3a2a72dde9f3e7ecbea393 100644 (file)
@@ -260,8 +260,8 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)
                return false;
        }
 
-       if (F2FS_I(inode)->extent_tree) {
-               struct extent_info *ei = &F2FS_I(inode)->extent_tree->largest;
+       if (fi->extent_tree) {
+               struct extent_info *ei = &fi->extent_tree->largest;
 
                if (ei->len &&
                        (!f2fs_is_valid_blkaddr(sbi, ei->blk,
@@ -465,10 +465,10 @@ static int do_read_inode(struct inode *inode)
                }
        }
 
-       F2FS_I(inode)->i_disk_time[0] = inode->i_atime;
-       F2FS_I(inode)->i_disk_time[1] = inode->i_ctime;
-       F2FS_I(inode)->i_disk_time[2] = inode->i_mtime;
-       F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime;
+       fi->i_disk_time[0] = inode->i_atime;
+       fi->i_disk_time[1] = inode->i_ctime;
+       fi->i_disk_time[2] = inode->i_mtime;
+       fi->i_disk_time[3] = fi->i_crtime;
        f2fs_put_page(node_page, 1);
 
        stat_inc_inline_xattr(inode);