f2fs: avoid unnecessary f2fs_gc for dir operations
The f2fs_balance_fs doesn't need to cover f2fs_new_inode or f2fs_find_entry works. Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
b9d777b85f
commit
00623e6bcf
|
@ -128,8 +128,6 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||||
nid_t ino = 0;
|
nid_t ino = 0;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
f2fs_balance_fs(sbi);
|
|
||||||
|
|
||||||
inode = f2fs_new_inode(dir, mode);
|
inode = f2fs_new_inode(dir, mode);
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
return PTR_ERR(inode);
|
return PTR_ERR(inode);
|
||||||
|
@ -142,6 +140,8 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||||
inode->i_mapping->a_ops = &f2fs_dblock_aops;
|
inode->i_mapping->a_ops = &f2fs_dblock_aops;
|
||||||
ino = inode->i_ino;
|
ino = inode->i_ino;
|
||||||
|
|
||||||
|
f2fs_balance_fs(sbi);
|
||||||
|
|
||||||
f2fs_lock_op(sbi);
|
f2fs_lock_op(sbi);
|
||||||
err = f2fs_add_link(dentry, inode);
|
err = f2fs_add_link(dentry, inode);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -288,12 +288,13 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
int err = -ENOENT;
|
int err = -ENOENT;
|
||||||
|
|
||||||
trace_f2fs_unlink_enter(dir, dentry);
|
trace_f2fs_unlink_enter(dir, dentry);
|
||||||
f2fs_balance_fs(sbi);
|
|
||||||
|
|
||||||
de = f2fs_find_entry(dir, &dentry->d_name, &page);
|
de = f2fs_find_entry(dir, &dentry->d_name, &page);
|
||||||
if (!de)
|
if (!de)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
f2fs_balance_fs(sbi);
|
||||||
|
|
||||||
f2fs_lock_op(sbi);
|
f2fs_lock_op(sbi);
|
||||||
err = acquire_orphan_inode(sbi);
|
err = acquire_orphan_inode(sbi);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -341,8 +342,6 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
|
||||||
if (len > dir->i_sb->s_blocksize)
|
if (len > dir->i_sb->s_blocksize)
|
||||||
return -ENAMETOOLONG;
|
return -ENAMETOOLONG;
|
||||||
|
|
||||||
f2fs_balance_fs(sbi);
|
|
||||||
|
|
||||||
inode = f2fs_new_inode(dir, S_IFLNK | S_IRWXUGO);
|
inode = f2fs_new_inode(dir, S_IFLNK | S_IRWXUGO);
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
return PTR_ERR(inode);
|
return PTR_ERR(inode);
|
||||||
|
@ -353,6 +352,8 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
|
||||||
inode->i_op = &f2fs_symlink_inode_operations;
|
inode->i_op = &f2fs_symlink_inode_operations;
|
||||||
inode->i_mapping->a_ops = &f2fs_dblock_aops;
|
inode->i_mapping->a_ops = &f2fs_dblock_aops;
|
||||||
|
|
||||||
|
f2fs_balance_fs(sbi);
|
||||||
|
|
||||||
f2fs_lock_op(sbi);
|
f2fs_lock_op(sbi);
|
||||||
err = f2fs_add_link(dentry, inode);
|
err = f2fs_add_link(dentry, inode);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -433,8 +434,6 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
f2fs_balance_fs(sbi);
|
|
||||||
|
|
||||||
inode = f2fs_new_inode(dir, S_IFDIR | mode);
|
inode = f2fs_new_inode(dir, S_IFDIR | mode);
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
return PTR_ERR(inode);
|
return PTR_ERR(inode);
|
||||||
|
@ -444,6 +443,8 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
||||||
inode->i_mapping->a_ops = &f2fs_dblock_aops;
|
inode->i_mapping->a_ops = &f2fs_dblock_aops;
|
||||||
mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_HIGH_ZERO);
|
mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_HIGH_ZERO);
|
||||||
|
|
||||||
|
f2fs_balance_fs(sbi);
|
||||||
|
|
||||||
set_inode_flag(F2FS_I(inode), FI_INC_LINK);
|
set_inode_flag(F2FS_I(inode), FI_INC_LINK);
|
||||||
f2fs_lock_op(sbi);
|
f2fs_lock_op(sbi);
|
||||||
err = f2fs_add_link(dentry, inode);
|
err = f2fs_add_link(dentry, inode);
|
||||||
|
@ -481,8 +482,6 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
f2fs_balance_fs(sbi);
|
|
||||||
|
|
||||||
inode = f2fs_new_inode(dir, mode);
|
inode = f2fs_new_inode(dir, mode);
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
return PTR_ERR(inode);
|
return PTR_ERR(inode);
|
||||||
|
@ -490,6 +489,8 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
|
||||||
init_special_inode(inode, inode->i_mode, rdev);
|
init_special_inode(inode, inode->i_mode, rdev);
|
||||||
inode->i_op = &f2fs_special_inode_operations;
|
inode->i_op = &f2fs_special_inode_operations;
|
||||||
|
|
||||||
|
f2fs_balance_fs(sbi);
|
||||||
|
|
||||||
f2fs_lock_op(sbi);
|
f2fs_lock_op(sbi);
|
||||||
err = f2fs_add_link(dentry, inode);
|
err = f2fs_add_link(dentry, inode);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -516,9 +517,6 @@ static int __f2fs_tmpfile(struct inode *dir, struct dentry *dentry,
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!whiteout)
|
|
||||||
f2fs_balance_fs(sbi);
|
|
||||||
|
|
||||||
inode = f2fs_new_inode(dir, mode);
|
inode = f2fs_new_inode(dir, mode);
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
return PTR_ERR(inode);
|
return PTR_ERR(inode);
|
||||||
|
@ -532,6 +530,8 @@ static int __f2fs_tmpfile(struct inode *dir, struct dentry *dentry,
|
||||||
inode->i_mapping->a_ops = &f2fs_dblock_aops;
|
inode->i_mapping->a_ops = &f2fs_dblock_aops;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f2fs_balance_fs(sbi);
|
||||||
|
|
||||||
f2fs_lock_op(sbi);
|
f2fs_lock_op(sbi);
|
||||||
err = acquire_orphan_inode(sbi);
|
err = acquire_orphan_inode(sbi);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -604,8 +604,6 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
f2fs_balance_fs(sbi);
|
|
||||||
|
|
||||||
old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page);
|
old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page);
|
||||||
if (!old_entry)
|
if (!old_entry)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -635,6 +633,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
if (!new_entry)
|
if (!new_entry)
|
||||||
goto out_whiteout;
|
goto out_whiteout;
|
||||||
|
|
||||||
|
f2fs_balance_fs(sbi);
|
||||||
|
|
||||||
f2fs_lock_op(sbi);
|
f2fs_lock_op(sbi);
|
||||||
|
|
||||||
err = acquire_orphan_inode(sbi);
|
err = acquire_orphan_inode(sbi);
|
||||||
|
@ -666,6 +666,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
update_inode_page(old_inode);
|
update_inode_page(old_inode);
|
||||||
update_inode_page(new_inode);
|
update_inode_page(new_inode);
|
||||||
} else {
|
} else {
|
||||||
|
f2fs_balance_fs(sbi);
|
||||||
|
|
||||||
f2fs_lock_op(sbi);
|
f2fs_lock_op(sbi);
|
||||||
|
|
||||||
err = f2fs_add_link(new_dentry, old_inode);
|
err = f2fs_add_link(new_dentry, old_inode);
|
||||||
|
@ -763,8 +765,6 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
new_inode)))
|
new_inode)))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
f2fs_balance_fs(sbi);
|
|
||||||
|
|
||||||
old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page);
|
old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page);
|
||||||
if (!old_entry)
|
if (!old_entry)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -807,6 +807,8 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
goto out_new_dir;
|
goto out_new_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f2fs_balance_fs(sbi);
|
||||||
|
|
||||||
f2fs_lock_op(sbi);
|
f2fs_lock_op(sbi);
|
||||||
|
|
||||||
err = update_dent_inode(old_inode, new_inode, &new_dentry->d_name);
|
err = update_dent_inode(old_inode, new_inode, &new_dentry->d_name);
|
||||||
|
|
Loading…
Reference in New Issue