Skip to content

Commit 054cb28

Browse files
Yufen YuJaegeuk Kim
authored andcommitted
f2fs: replace F2FS_I(inode) and sbi by the local variable
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 <[email protected]> Reviewed-by: Chao Yu <[email protected]> [Jaegeuk Kim: replace sbi] Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 908ea65 commit 054cb28

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

fs/f2fs/f2fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4403,8 +4403,8 @@ static inline bool f2fs_may_compress(struct inode *inode)
44034403
static inline void f2fs_i_compr_blocks_update(struct inode *inode,
44044404
u64 blocks, bool add)
44054405
{
4406-
int diff = F2FS_I(inode)->i_cluster_size - blocks;
44074406
struct f2fs_inode_info *fi = F2FS_I(inode);
4407+
int diff = fi->i_cluster_size - blocks;
44084408

44094409
/* don't update i_compr_blocks if saved blocks were released */
44104410
if (!add && !atomic_read(&fi->i_compr_blocks))

fs/f2fs/file.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,33 +2032,33 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
20322032
if (ret)
20332033
goto out;
20342034

2035-
f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
2035+
f2fs_down_write(&fi->i_gc_rwsem[WRITE]);
20362036

20372037
/*
20382038
* Should wait end_io to count F2FS_WB_CP_DATA correctly by
20392039
* f2fs_is_atomic_file.
20402040
*/
20412041
if (get_dirty_pages(inode))
2042-
f2fs_warn(F2FS_I_SB(inode), "Unexpected flush for atomic writes: ino=%lu, npages=%u",
2042+
f2fs_warn(sbi, "Unexpected flush for atomic writes: ino=%lu, npages=%u",
20432043
inode->i_ino, get_dirty_pages(inode));
20442044
ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX);
20452045
if (ret) {
2046-
f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
2046+
f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
20472047
goto out;
20482048
}
20492049

20502050
/* Create a COW inode for atomic write */
20512051
pinode = f2fs_iget(inode->i_sb, fi->i_pino);
20522052
if (IS_ERR(pinode)) {
2053-
f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
2053+
f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
20542054
ret = PTR_ERR(pinode);
20552055
goto out;
20562056
}
20572057

20582058
ret = f2fs_get_tmpfile(mnt_userns, pinode, &fi->cow_inode);
20592059
iput(pinode);
20602060
if (ret) {
2061-
f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
2061+
f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
20622062
goto out;
20632063
}
20642064
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)
20702070
set_inode_flag(inode, FI_ATOMIC_FILE);
20712071
set_inode_flag(fi->cow_inode, FI_ATOMIC_FILE);
20722072
clear_inode_flag(fi->cow_inode, FI_INLINE_DATA);
2073-
f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
2073+
f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
20742074

2075-
f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
2076-
F2FS_I(inode)->atomic_write_task = current;
2075+
f2fs_update_time(sbi, REQ_TIME);
2076+
fi->atomic_write_task = current;
20772077
stat_update_max_atomic_write(inode);
20782078
out:
20792079
inode_unlock(inode);
@@ -2952,7 +2952,7 @@ static int f2fs_ioc_setproject(struct inode *inode, __u32 projid)
29522952

29532953
kprojid = make_kprojid(&init_user_ns, (projid_t)projid);
29542954

2955-
if (projid_eq(kprojid, F2FS_I(inode)->i_projid))
2955+
if (projid_eq(kprojid, fi->i_projid))
29562956
return 0;
29572957

29582958
err = -EPERM;
@@ -2972,7 +2972,7 @@ static int f2fs_ioc_setproject(struct inode *inode, __u32 projid)
29722972
if (err)
29732973
goto out_unlock;
29742974

2975-
F2FS_I(inode)->i_projid = kprojid;
2975+
fi->i_projid = kprojid;
29762976
inode->i_ctime = current_time(inode);
29772977
f2fs_mark_inode_dirty_sync(inode, true);
29782978
out_unlock:
@@ -3922,7 +3922,7 @@ static int f2fs_ioc_decompress_file(struct file *filp, unsigned long arg)
39223922
struct f2fs_inode_info *fi = F2FS_I(inode);
39233923
pgoff_t page_idx = 0, last_idx;
39243924
unsigned int blk_per_seg = sbi->blocks_per_seg;
3925-
int cluster_size = F2FS_I(inode)->i_cluster_size;
3925+
int cluster_size = fi->i_cluster_size;
39263926
int count, ret;
39273927

39283928
if (!f2fs_sb_has_compression(sbi) ||

fs/f2fs/inode.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)
260260
return false;
261261
}
262262

263-
if (F2FS_I(inode)->extent_tree) {
264-
struct extent_info *ei = &F2FS_I(inode)->extent_tree->largest;
263+
if (fi->extent_tree) {
264+
struct extent_info *ei = &fi->extent_tree->largest;
265265

266266
if (ei->len &&
267267
(!f2fs_is_valid_blkaddr(sbi, ei->blk,
@@ -465,10 +465,10 @@ static int do_read_inode(struct inode *inode)
465465
}
466466
}
467467

468-
F2FS_I(inode)->i_disk_time[0] = inode->i_atime;
469-
F2FS_I(inode)->i_disk_time[1] = inode->i_ctime;
470-
F2FS_I(inode)->i_disk_time[2] = inode->i_mtime;
471-
F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime;
468+
fi->i_disk_time[0] = inode->i_atime;
469+
fi->i_disk_time[1] = inode->i_ctime;
470+
fi->i_disk_time[2] = inode->i_mtime;
471+
fi->i_disk_time[3] = fi->i_crtime;
472472
f2fs_put_page(node_page, 1);
473473

474474
stat_inc_inline_xattr(inode);

0 commit comments

Comments
 (0)