Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297200

[PATCH 2/4] f2fs: avoid unnecessary f2fs_gc for dir operations

From Jaegeuk Kim <jaegeuk@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 2/4] f2fs: avoid unnecessary f2fs_gc for dir operations
Date 2015-12-23 02:10 +0100
Message-ID <qIG6e-323-13@gated-at.bofh.it> (permalink)
References <qIFWy-2J8-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The f2fs_balance_fs doesn't need to cover f2fs_new_inode or f2fs_find_entry
works.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/namei.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 2c32110..8d2616f 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -128,8 +128,6 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 	nid_t ino = 0;
 	int err;
 
-	f2fs_balance_fs(sbi);
-
 	inode = f2fs_new_inode(dir, mode);
 	if (IS_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;
 	ino = inode->i_ino;
 
+	f2fs_balance_fs(sbi);
+
 	f2fs_lock_op(sbi);
 	err = f2fs_add_link(dentry, inode);
 	if (err)
@@ -288,12 +288,13 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
 	int err = -ENOENT;
 
 	trace_f2fs_unlink_enter(dir, dentry);
-	f2fs_balance_fs(sbi);
 
 	de = f2fs_find_entry(dir, &dentry->d_name, &page);
 	if (!de)
 		goto fail;
 
+	f2fs_balance_fs(sbi);
+
 	f2fs_lock_op(sbi);
 	err = acquire_orphan_inode(sbi);
 	if (err) {
@@ -341,8 +342,6 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
 	if (len > dir->i_sb->s_blocksize)
 		return -ENAMETOOLONG;
 
-	f2fs_balance_fs(sbi);
-
 	inode = f2fs_new_inode(dir, S_IFLNK | S_IRWXUGO);
 	if (IS_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_mapping->a_ops = &f2fs_dblock_aops;
 
+	f2fs_balance_fs(sbi);
+
 	f2fs_lock_op(sbi);
 	err = f2fs_add_link(dentry, inode);
 	if (err)
@@ -433,8 +434,6 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	struct inode *inode;
 	int err;
 
-	f2fs_balance_fs(sbi);
-
 	inode = f2fs_new_inode(dir, S_IFDIR | mode);
 	if (IS_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;
 	mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_HIGH_ZERO);
 
+	f2fs_balance_fs(sbi);
+
 	set_inode_flag(F2FS_I(inode), FI_INC_LINK);
 	f2fs_lock_op(sbi);
 	err = f2fs_add_link(dentry, inode);
-- 
2.5.4 (Apple Git-61)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] f2fs: check inline_data flag at converting time Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-23 02:00 +0100
  [PATCH 4/4] f2fs: call f2fs_balance_fs only when node was changed Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-23 02:10 +0100
    RE: [f2fs-dev] [PATCH 4/4] f2fs: call f2fs_balance_fs only when node  was changed Chao Yu <chao2.yu@samsung.com> - 2015-12-23 10:50 +0100
      Re: [f2fs-dev] [PATCH 4/4] f2fs: call f2fs_balance_fs only when node  was changed Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-23 20:20 +0100
      RE: [f2fs-dev] [PATCH 4/4] f2fs: call f2fs_balance_fs only when node  was changed Chao Yu <chao2.yu@samsung.com> - 2015-12-25 02:50 +0100
    Re: [PATCH 4/4] f2fs: call f2fs_balance_fs only when node was changed Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-23 20:20 +0100
      RE: [f2fs-dev] [PATCH 4/4] f2fs: call f2fs_balance_fs only when node  was changed Chao Yu <chao2.yu@samsung.com> - 2015-12-24 06:50 +0100
  [PATCH 3/4] f2fs: record node block allocation in dnode_of_data Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-23 02:10 +0100
    RE: [f2fs-dev] [PATCH 3/4] f2fs: record node block allocation in  dnode_of_data Chao Yu <chao2.yu@samsung.com> - 2015-12-23 09:10 +0100
      Re: [f2fs-dev] [PATCH 3/4] f2fs: record node block allocation in  dnode_of_data Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-23 20:00 +0100
    Re: [PATCH 3/4 v2] f2fs: record node block allocation in  dnode_of_data Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-23 20:10 +0100
      RE: [f2fs-dev] [PATCH 3/4 v2] f2fs: record node block allocation in  dnode_of_data Chao Yu <chao2.yu@samsung.com> - 2015-12-24 02:40 +0100
  [PATCH 2/4] f2fs: avoid unnecessary f2fs_gc for dir operations Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-23 02:10 +0100
    RE: [f2fs-dev] [PATCH 2/4] f2fs: avoid unnecessary f2fs_gc for dir  operations Chao Yu <chao2.yu@samsung.com> - 2015-12-23 04:30 +0100
      Re: [f2fs-dev] [PATCH 2/4 v2] f2fs: avoid unnecessary f2fs_gc for  dir operations Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-23 20:00 +0100
        RE: [f2fs-dev] [PATCH 2/4 v2] f2fs: avoid unnecessary f2fs_gc for dir  operations Chao Yu <chao2.yu@samsung.com> - 2015-12-24 02:40 +0100
          Re: [f2fs-dev] [PATCH 2/4 v2] f2fs: avoid unnecessary f2fs_gc for  dir operations Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-24 03:20 +0100
            RE: [f2fs-dev] [PATCH 2/4 v2] f2fs: avoid unnecessary f2fs_gc for dir  operations Chao Yu <chao2.yu@samsung.com> - 2015-12-24 04:40 +0100
  RE: [f2fs-dev] [PATCH 1/4] f2fs: check inline_data flag at converting  time Chao Yu <chao2.yu@samsung.com> - 2015-12-23 04:30 +0100

csiph-web