Skip to contentSkip to conversation

nilfs2: reduce redandunt mark_inode_dirty calls

PATCH Superseded Jiro SEKIBA 2 participants 15 messages Nov 27, 2009 5 messages not in the archive NILFS2 filesystem

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover nilfs2: reduce redandunt mark_inode_dirty calls

Hi,

This is a series of patches to reduce redandunt mark_inode_dirty calls.

Many functions call mark_inode_dirty() whenever they change inode object. However, it is redundant to call mark_inode_dirty() to same inode object within a transaction.

Last patch also replaces all mark_inode_dirty() calls as nilfs_mark_inode_dirty(), to reduce deep function call tree.

 fs/nilfs2/dir.c   |    2 +-
 fs/nilfs2/inode.c |    6 +++---
 fs/nilfs2/namei.c |   34 +++++++++++++++++-----------------
 3 files changed, 21 insertions(+), 21 deletions(-)
#2 lore raw

PATCH 1/9 nilfs2: delete mark_inode_dirty in nilfs_new_inode

In reply to a message not in the archive

It is redundant to call mark_inode_dirty() in nilfs_new_inode() because all caller of nilfs_new_inode() will call mark_inode_dirty() after calling nilfs_new_inode() directly or indirectly in transaction.

---
 fs/nilfs2/inode.c |    1 -
 fs/nilfs2/namei.c |    2 +-
 2 files changed, 1 insertions(+), 2 deletions(-)
fs/nilfs2/inode.c +0 -1
index a16c179..ede0375 100644
@@ -323,7 +323,6 @@ struct inode *nilfs_new_inode(struct inode *dir, int mode)
 				    nilfs_init_acl(), proper cancellation of
 				    above jobs should be considered */
 
-	mark_inode_dirty(inode);
 	return inode;
 
  failed_acl:
fs/nilfs2/namei.c +1 -1
index ed02e88..01adda8 100644
@@ -188,7 +188,7 @@ static int nilfs_symlink(struct inode *dir, struct dentry *dentry,
 		goto out_fail;
 
 	/* mark_inode_dirty(inode); */
-	/* nilfs_new_inode() and page_symlink() do this */
+	/* page_symlink() do this */
 
 	err = nilfs_add_nondir(dentry, inode);
 out:
Signature · 1 line
1.5.6.5
#3 lore raw

PATCH 2/9 nilfs2: delete mark_inode_dirty in nilfs_set_link

In reply to a message not in the archive

Delete mark_inode_dirty() in nilfs_set_link() to reduce redundant mark_inode_dirty() calls in caller of nilfs_set_link().

---
 fs/nilfs2/dir.c   |    1 -
 fs/nilfs2/namei.c |    4 +++-
 2 files changed, 3 insertions(+), 2 deletions(-)
fs/nilfs2/dir.c +0 -1
index e097099..4f3fa00 100644
@@ -459,7 +459,6 @@ void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de,
 	nilfs_put_page(page);
 	dir->i_mtime = dir->i_ctime = CURRENT_TIME;
 /*	NILFS_I(dir)->i_flags &= ~NILFS_BTREE_FL; */
-	mark_inode_dirty(dir);
 }
 
 /*
fs/nilfs2/namei.c +3 -1
index 01adda8..4616f96 100644
@@ -397,6 +397,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 			goto out_dir;
 		inode_inc_link_count(old_inode);
 		nilfs_set_link(new_dir, new_de, new_page, old_inode);
+		mark_inode_dirty(new_dir);
 		new_inode->i_ctime = CURRENT_TIME;
 		if (dir_de)
 			drop_nlink(new_inode);
@@ -425,12 +426,13 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	old_inode->i_ctime = CURRENT_TIME;
 
 	nilfs_delete_entry(old_de, old_page);
-	inode_dec_link_count(old_inode);
+	drop_nlink(old_inode);
 
 	if (dir_de) {
 		nilfs_set_link(old_inode, dir_de, dir_page, new_dir);
 		inode_dec_link_count(old_dir);
 	}
+	mark_inode_dirty(old_inode);
 
 	err = nilfs_transaction_commit(old_dir->i_sb);
 	return err;
Signature · 1 line
1.5.6.5
#4 lore raw

PATCH 3/9 nilfs2: expand inode_inc_link_count and inode_dec_link_count

In reply to a message not in the archive

This is an intermidiate patch to reduce redandunt mark_inode_dirty() calls by calling inode_inc_link_count() and inode_dec_link_count() functions.

---
 fs/nilfs2/namei.c |   49 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 17 deletions(-)
fs/nilfs2/namei.c +32 -17
index 4616f96..f952439 100644
@@ -200,7 +200,8 @@ out:
 	return err;
 
 out_fail:
-	inode_dec_link_count(inode);
+	drop_nlink(inode);
+	mark_inode_dirty(inode);
 	iput(inode);
 	goto out;
 }
@@ -245,7 +246,8 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 	if (err)
 		return err;
 
-	inode_inc_link_count(dir);
+	inc_nlink(dir);
+	mark_inode_dirty(dir);
 
 	inode = nilfs_new_inode(dir, S_IFDIR | mode);
 	err = PTR_ERR(inode);
@@ -256,7 +258,8 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 	inode->i_fop = &nilfs_dir_operations;
 	inode->i_mapping->a_ops = &nilfs_aops;
 
-	inode_inc_link_count(inode);
+	inc_nlink(inode);
+	mark_inode_dirty(inode);
 
 	err = nilfs_make_empty(inode, dir);
 	if (err)
@@ -276,11 +279,14 @@ out:
 	return err;
 
 out_fail:
-	inode_dec_link_count(inode);
-	inode_dec_link_count(inode);
+	drop_nlink(inode);
+	mark_inode_dirty(inode);
+	drop_nlink(inode);
+	mark_inode_dirty(inode);
 	iput(inode);
 out_dir:
-	inode_dec_link_count(dir);
+	drop_nlink(dir);
+	mark_inode_dirty(dir);
 	goto out;
 }
 
@@ -317,7 +323,8 @@ static int nilfs_unlink(struct inode *dir, struct dentry *dentry)
 		goto out;
 
 	inode->i_ctime = dir->i_ctime;
-	inode_dec_link_count(inode);
+	drop_nlink(inode);
+	mark_inode_dirty(inode);
 	err = 0;
 out:
 	if (!err)
@@ -343,8 +350,10 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry)
 		err = nilfs_unlink(dir, dentry);
 		if (!err) {
 			inode->i_size = 0;
-			inode_dec_link_count(inode);
-			inode_dec_link_count(dir);
+			drop_nlink(inode);
+			mark_inode_dirty(inode);
+			drop_nlink(dir);
+			mark_inode_dirty(dir);
 		}
 	}
 	if (!err)
@@ -395,33 +404,38 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		new_de = nilfs_find_entry(new_dir, new_dentry, &new_page);
 		if (!new_de)
 			goto out_dir;
-		inode_inc_link_count(old_inode);
+		inc_nlink(old_inode);
+		mark_inode_dirty(old_inode);
 		nilfs_set_link(new_dir, new_de, new_page, old_inode);
 		mark_inode_dirty(new_dir);
 		new_inode->i_ctime = CURRENT_TIME;
 		if (dir_de)
 			drop_nlink(new_inode);
-		inode_dec_link_count(new_inode);
+		drop_nlink(new_inode);
+		mark_inode_dirty(new_inode);
 	} else {
 		if (dir_de) {
 			err = -EMLINK;
 			if (new_dir->i_nlink >= NILFS_LINK_MAX)
 				goto out_dir;
 		}
-		inode_inc_link_count(old_inode);
+		inc_nlink(old_inode);
+		mark_inode_dirty(old_inode);
 		err = nilfs_add_link(new_dentry, old_inode);
 		if (err) {
-			inode_dec_link_count(old_inode);
+			drop_nlink(old_inode);
+			mark_inode_dirty(old_inode);
 			goto out_dir;
 		}
-		if (dir_de)
-			inode_inc_link_count(new_dir);
+		if (dir_de) {
+			inc_nlink(new_dir);
+			mark_inode_dirty(new_dir);
+		}
 	}
 
 	/*
 	 * Like most other Unix systems, set the ctime for inodes on a
 	 * rename.
-	 * inode_dec_link_count() will mark the inode dirty.
 	 */
 	old_inode->i_ctime = CURRENT_TIME;
 
@@ -430,7 +444,8 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 
 	if (dir_de) {
 		nilfs_set_link(old_inode, dir_de, dir_page, new_dir);
-		inode_dec_link_count(old_dir);
+		drop_nlink(old_dir);
+		mark_inode_dirty(old_dir);
 	}
 	mark_inode_dirty(old_inode);
 
Signature · 1 line
1.5.6.5
#5 lore raw

PATCH 4/9 nilfs2: delete redundant mark_inode_dirty

In reply to a message not in the archive

Delete redundant mark_inode_dirty() calls

---
 fs/nilfs2/namei.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
fs/nilfs2/namei.c +0 -3
index f952439..33972c6 100644
@@ -280,7 +280,6 @@ out:
 
 out_fail:
 	drop_nlink(inode);
-	mark_inode_dirty(inode);
 	drop_nlink(inode);
 	mark_inode_dirty(inode);
 	iput(inode);
@@ -405,7 +404,6 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		if (!new_de)
 			goto out_dir;
 		inc_nlink(old_inode);
-		mark_inode_dirty(old_inode);
 		nilfs_set_link(new_dir, new_de, new_page, old_inode);
 		mark_inode_dirty(new_dir);
 		new_inode->i_ctime = CURRENT_TIME;
@@ -420,7 +418,6 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 				goto out_dir;
 		}
 		inc_nlink(old_inode);
-		mark_inode_dirty(old_inode);
 		err = nilfs_add_link(new_dentry, old_inode);
 		if (err) {
 			drop_nlink(old_inode);
Signature · 1 line
1.5.6.5
#8 lore raw

PATCH 5/9 nilfs2: split nilfs_unlink as nilfs_do_unlink and nilfs_unlink

In reply to a message not in the archive

Split nilfs_unlink() to reduce nested transaction and duplicate mark_inode_dirty() calls when calling nilfs_unlink() from nilfs_rmdir().

nilfs_do_unlink() is an actual unlink functionality which is not in transaction and does not call mark_inode_dirty() for dentry argument.

nilfs_unlink() is a wrapper function for nilfs_do_unlink() with transaction and mark_inode_dirty() for dentry argument.

---
 fs/nilfs2/namei.c |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)
fs/nilfs2/namei.c +19 -10
index 33972c6..aea6c1a 100644
@@ -289,18 +289,13 @@ out_dir:
 	goto out;
 }
 
-static int nilfs_unlink(struct inode *dir, struct dentry *dentry)
+static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry)
 {
 	struct inode *inode;
 	struct nilfs_dir_entry *de;
 	struct page *page;
-	struct nilfs_transaction_info ti;
 	int err;
 
-	err = nilfs_transaction_begin(dir->i_sb, &ti, 0);
-	if (err)
-		return err;
-
 	err = -ENOENT;
 	de = nilfs_find_entry(dir, dentry, &page);
 	if (!de)
@@ -323,12 +318,26 @@ static int nilfs_unlink(struct inode *dir, struct dentry *dentry)
 
 	inode->i_ctime = dir->i_ctime;
 	drop_nlink(inode);
-	mark_inode_dirty(inode);
 	err = 0;
 out:
-	if (!err)
+	return err;
+}
+
+static int nilfs_unlink(struct inode *dir, struct dentry *dentry)
+{
+	struct nilfs_transaction_info ti;
+	int err;
+
+	err = nilfs_transaction_begin(dir->i_sb, &ti, 0);
+	if (err)
+		return err;
+
+	err = nilfs_do_unlink(dir, dentry);
+
+	if (!err) {
+		mark_inode_dirty(dentry->d_inode);
 		err = nilfs_transaction_commit(dir->i_sb);
-	else
+	} else
 		nilfs_transaction_abort(dir->i_sb);
 
 	return err;
@@ -346,7 +355,7 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry)
 
 	err = -ENOTEMPTY;
 	if (nilfs_empty_dir(inode)) {
-		err = nilfs_unlink(dir, dentry);
+		err = nilfs_do_unlink(dir, dentry);
 		if (!err) {
 			inode->i_size = 0;
 			drop_nlink(inode);
Signature · 1 line
1.5.6.5
#9 lore raw

PATCH 6/9 nilfs2: change return type of nilfs_commit_chunk

In reply to a message not in the archive

Change return type of nilfs_commit_chunk() as void from int, for nilfs_set_file_dirty() usually does not return error.

This is an intermediate patch to reduce mark_inode_dirty() in nilfs_commit_chunk().

---
 fs/nilfs2/dir.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
fs/nilfs2/dir.c +8 -8
index 4f3fa00..173530d 100644
@@ -99,9 +99,9 @@ static int nilfs_prepare_chunk(struct page *page,
 				 NULL, nilfs_get_block);
 }
 
-static int nilfs_commit_chunk(struct page *page,
-			      struct address_space *mapping,
-			      unsigned from, unsigned to)
+static void nilfs_commit_chunk(struct page *page,
+			       struct address_space *mapping,
+			       unsigned from, unsigned to)
 {
 	struct inode *dir = mapping->host;
 	struct nilfs_sb_info *sbi = NILFS_SB(dir->i_sb);
@@ -119,8 +119,8 @@ static int nilfs_commit_chunk(struct page *page,
 	if (IS_DIRSYNC(dir))
 		nilfs_set_transaction_flag(NILFS_TI_SYNC);
 	err = nilfs_set_file_dirty(sbi, dir, nr_dirty);
+	WARN_ON(err); /* do not happen */
 	unlock_page(page);
-	return err;
 }
 
 static void nilfs_check_page(struct page *page)
@@ -455,7 +455,7 @@ void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de,
 	BUG_ON(err);
 	de->inode = cpu_to_le64(inode->i_ino);
 	nilfs_set_de_type(de, inode);
-	err = nilfs_commit_chunk(page, mapping, from, to);
+	nilfs_commit_chunk(page, mapping, from, to);
 	nilfs_put_page(page);
 	dir->i_mtime = dir->i_ctime = CURRENT_TIME;
 /*	NILFS_I(dir)->i_flags &= ~NILFS_BTREE_FL; */
@@ -547,7 +547,7 @@ got_it:
 	memcpy(de->name, name, namelen);
 	de->inode = cpu_to_le64(inode->i_ino);
 	nilfs_set_de_type(de, inode);
-	err = nilfs_commit_chunk(page, page->mapping, from, to);
+	nilfs_commit_chunk(page, page->mapping, from, to);
 	dir->i_mtime = dir->i_ctime = CURRENT_TIME;
 /*	NILFS_I(dir)->i_flags &= ~NILFS_BTREE_FL; */
 	mark_inode_dirty(dir);
@@ -594,7 +594,7 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page)
 	if (pde)
 		pde->rec_len = cpu_to_le16(to - from);
 	dir->inode = 0;
-	err = nilfs_commit_chunk(page, mapping, from, to);
+	nilfs_commit_chunk(page, mapping, from, to);
 	inode->i_ctime = inode->i_mtime = CURRENT_TIME;
 /*	NILFS_I(inode)->i_flags &= ~NILFS_BTREE_FL; */
 	mark_inode_dirty(inode);
@@ -639,7 +639,7 @@ int nilfs_make_empty(struct inode *inode, struct inode *parent)
 	memcpy(de->name, "..\0", 4);
 	nilfs_set_de_type(de, inode);
 	kunmap_atomic(kaddr, KM_USER0);
-	err = nilfs_commit_chunk(page, mapping, 0, chunk_size);
+	nilfs_commit_chunk(page, mapping, 0, chunk_size);
 fail:
 	page_cache_release(page);
 	return err;
Signature · 1 line
1.5.6.5
#10 lore raw

PATCH 7/9 nilfs2: delete mark_inode_dirty in nilfs_commit_chunk

In reply to a message not in the archive

Delete mark_inode_dirty() in nilfs_commit_chunk(), for callers of nilfs_commit_chunk() will call equivalent mark_inode_dirty() after calling nilfs_commit_chunk().

---
 fs/nilfs2/dir.c   |    4 +---
 fs/nilfs2/namei.c |    2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
fs/nilfs2/dir.c +1 -3
index 173530d..693539b 100644
@@ -112,10 +112,8 @@ static void nilfs_commit_chunk(struct page *page,
 
 	nr_dirty = nilfs_page_count_clean_buffers(page, from, to);
 	copied = block_write_end(NULL, mapping, pos, len, len, page, NULL);
-	if (pos + copied > dir->i_size) {
+	if (pos + copied > dir->i_size)
 		i_size_write(dir, pos + copied);
-		mark_inode_dirty(dir);
-	}
 	if (IS_DIRSYNC(dir))
 		nilfs_set_transaction_flag(NILFS_TI_SYNC);
 	err = nilfs_set_file_dirty(sbi, dir, nr_dirty);
fs/nilfs2/namei.c +1 -1
index aea6c1a..c662f8e 100644
@@ -259,7 +259,6 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 	inode->i_mapping->a_ops = &nilfs_aops;
 
 	inc_nlink(inode);
-	mark_inode_dirty(inode);
 
 	err = nilfs_make_empty(inode, dir);
 	if (err)
@@ -269,6 +268,7 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 	if (err)
 		goto out_fail;
 
+	mark_inode_dirty(inode);
 	d_instantiate(dentry, inode);
 out:
 	if (!err)
Signature · 1 line
1.5.6.5
#11 lore raw

PATCH 8/9 nilfs2: delete mark_inode_dirty in nilfs_delete_entry

In reply to a message not in the archive

Delete mark_inode_dirty() in nilfs_delete_entry() to reduce duplicate mark_inode_dirty() calls both in nilfs_rename() and nilfs_delete_entry().

---
 fs/nilfs2/dir.c   |    1 -
 fs/nilfs2/namei.c |    4 +++-
 2 files changed, 3 insertions(+), 2 deletions(-)
fs/nilfs2/dir.c +0 -1
index 693539b..1d9a4e4 100644
@@ -595,7 +595,6 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page)
 	nilfs_commit_chunk(page, mapping, from, to);
 	inode->i_ctime = inode->i_mtime = CURRENT_TIME;
 /*	NILFS_I(inode)->i_flags &= ~NILFS_BTREE_FL; */
-	mark_inode_dirty(inode);
 out:
 	nilfs_put_page(page);
 	return err;
fs/nilfs2/namei.c +3 -1
index c662f8e..166a261 100644
@@ -316,6 +316,8 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry)
 	if (err)
 		goto out;
 
+	mark_inode_dirty(dir);
+
 	inode->i_ctime = dir->i_ctime;
 	drop_nlink(inode);
 	err = 0;
@@ -451,8 +453,8 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (dir_de) {
 		nilfs_set_link(old_inode, dir_de, dir_page, new_dir);
 		drop_nlink(old_dir);
-		mark_inode_dirty(old_dir);
 	}
+	mark_inode_dirty(old_dir);
 	mark_inode_dirty(old_inode);
 
 	err = nilfs_transaction_commit(old_dir->i_sb);
Signature · 1 line
1.5.6.5
#14 lore raw

PATCH 9/9 nilfs2: replace mark_inode_dirty as nilfs_mark_inode_dirty

In reply to a message not in the archive

Replace mark_inode_dirty() as nilfs_mark_inode_dirty() to reduce deep function call tree.

---
 fs/nilfs2/dir.c   |    2 +-
 fs/nilfs2/inode.c |    6 +++---
 fs/nilfs2/namei.c |   34 +++++++++++++++++-----------------
 3 files changed, 21 insertions(+), 21 deletions(-)
fs/nilfs2/dir.c +1 -1
index 1d9a4e4..76d803e 100644
@@ -548,7 +548,7 @@ got_it:
 	nilfs_commit_chunk(page, page->mapping, from, to);
 	dir->i_mtime = dir->i_ctime = CURRENT_TIME;
 /*	NILFS_I(dir)->i_flags &= ~NILFS_BTREE_FL; */
-	mark_inode_dirty(dir);
+	nilfs_mark_inode_dirty(dir);
 	/* OFFSET_CACHE */
 out_put:
 	nilfs_put_page(page);
fs/nilfs2/inode.c +3 -3
index ede0375..7868cc1 100644
@@ -97,7 +97,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
 			nilfs_transaction_abort(inode->i_sb);
 			goto out;
 		}
-		mark_inode_dirty(inode);
+		nilfs_mark_inode_dirty(inode);
 		nilfs_transaction_commit(inode->i_sb); /* never fails */
 		/* Error handling should be detailed */
 		set_buffer_new(bh_result);
@@ -598,7 +598,7 @@ void nilfs_truncate(struct inode *inode)
 	if (IS_SYNC(inode))
 		nilfs_set_transaction_flag(NILFS_TI_SYNC);
 
-	mark_inode_dirty(inode);
+	nilfs_mark_inode_dirty(inode);
 	nilfs_set_file_dirty(NILFS_SB(sb), inode, 0);
 	nilfs_transaction_commit(sb);
 	/* May construct a logical segment and may fail in sync mode.
@@ -623,7 +623,7 @@ void nilfs_delete_inode(struct inode *inode)
 		truncate_inode_pages(&inode->i_data, 0);
 
 	nilfs_truncate_bmap(ii, 0);
-	mark_inode_dirty(inode);
+	nilfs_mark_inode_dirty(inode);
 	nilfs_free_inode(inode);
 	/* nilfs_free_inode() marks inode buffer dirty */
 	if (IS_SYNC(inode))
fs/nilfs2/namei.c +17 -17
index 166a261..ca83a80 100644
@@ -120,7 +120,7 @@ static int nilfs_create(struct inode *dir, struct dentry *dentry, int mode,
 		inode->i_op = &nilfs_file_inode_operations;
 		inode->i_fop = &nilfs_file_operations;
 		inode->i_mapping->a_ops = &nilfs_aops;
-		mark_inode_dirty(inode);
+		nilfs_mark_inode_dirty(inode);
 		err = nilfs_add_nondir(dentry, inode);
 	}
 	if (!err)
@@ -148,7 +148,7 @@ nilfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
 	err = PTR_ERR(inode);
 	if (!IS_ERR(inode)) {
 		init_special_inode(inode, inode->i_mode, rdev);
-		mark_inode_dirty(inode);
+		nilfs_mark_inode_dirty(inode);
 		err = nilfs_add_nondir(dentry, inode);
 	}
 	if (!err)
@@ -201,7 +201,7 @@ out:
 
 out_fail:
 	drop_nlink(inode);
-	mark_inode_dirty(inode);
+	nilfs_mark_inode_dirty(inode);
 	iput(inode);
 	goto out;
 }
@@ -247,7 +247,7 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 		return err;
 
 	inc_nlink(dir);
-	mark_inode_dirty(dir);
+	nilfs_mark_inode_dirty(dir);
 
 	inode = nilfs_new_inode(dir, S_IFDIR | mode);
 	err = PTR_ERR(inode);
@@ -268,7 +268,7 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 	if (err)
 		goto out_fail;
 
-	mark_inode_dirty(inode);
+	nilfs_mark_inode_dirty(inode);
 	d_instantiate(dentry, inode);
 out:
 	if (!err)
@@ -281,11 +281,11 @@ out:
 out_fail:
 	drop_nlink(inode);
 	drop_nlink(inode);
-	mark_inode_dirty(inode);
+	nilfs_mark_inode_dirty(inode);
 	iput(inode);
 out_dir:
 	drop_nlink(dir);
-	mark_inode_dirty(dir);
+	nilfs_mark_inode_dirty(dir);
 	goto out;
 }
 
@@ -316,7 +316,7 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry)
 	if (err)
 		goto out;
 
-	mark_inode_dirty(dir);
+	nilfs_mark_inode_dirty(dir);
 
 	inode->i_ctime = dir->i_ctime;
 	drop_nlink(inode);
@@ -337,7 +337,7 @@ static int nilfs_unlink(struct inode *dir, struct dentry *dentry)
 	err = nilfs_do_unlink(dir, dentry);
 
 	if (!err) {
-		mark_inode_dirty(dentry->d_inode);
+		nilfs_mark_inode_dirty(dentry->d_inode);
 		err = nilfs_transaction_commit(dir->i_sb);
 	} else
 		nilfs_transaction_abort(dir->i_sb);
@@ -361,9 +361,9 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry)
 		if (!err) {
 			inode->i_size = 0;
 			drop_nlink(inode);
-			mark_inode_dirty(inode);
+			nilfs_mark_inode_dirty(inode);
 			drop_nlink(dir);
-			mark_inode_dirty(dir);
+			nilfs_mark_inode_dirty(dir);
 		}
 	}
 	if (!err)
@@ -416,12 +416,12 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 			goto out_dir;
 		inc_nlink(old_inode);
 		nilfs_set_link(new_dir, new_de, new_page, old_inode);
-		mark_inode_dirty(new_dir);
+		nilfs_mark_inode_dirty(new_dir);
 		new_inode->i_ctime = CURRENT_TIME;
 		if (dir_de)
 			drop_nlink(new_inode);
 		drop_nlink(new_inode);
-		mark_inode_dirty(new_inode);
+		nilfs_mark_inode_dirty(new_inode);
 	} else {
 		if (dir_de) {
 			err = -EMLINK;
@@ -432,12 +432,12 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		err = nilfs_add_link(new_dentry, old_inode);
 		if (err) {
 			drop_nlink(old_inode);
-			mark_inode_dirty(old_inode);
+			nilfs_mark_inode_dirty(old_inode);
 			goto out_dir;
 		}
 		if (dir_de) {
 			inc_nlink(new_dir);
-			mark_inode_dirty(new_dir);
+			nilfs_mark_inode_dirty(new_dir);
 		}
 	}
 
@@ -454,8 +454,8 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		nilfs_set_link(old_inode, dir_de, dir_page, new_dir);
 		drop_nlink(old_dir);
 	}
-	mark_inode_dirty(old_dir);
-	mark_inode_dirty(old_inode);
+	nilfs_mark_inode_dirty(old_dir);
+	nilfs_mark_inode_dirty(old_inode);
 
 	err = nilfs_transaction_commit(old_dir->i_sb);
 	return err;
Signature · 1 line
1.5.6.5
#15 lore raw
In reply to a message not in the archive

Hi,

Quoted 8 lines · Jiro SEKIBA

Hi,

This is a series of patches to reduce redandunt mark_inode_dirty calls.

Many functions call mark_inode_dirty() whenever they change inode object. However, it is redundant to call mark_inode_dirty() to same inode object within a transaction.

Quoted 8 lines

Last patch also replaces all mark_inode_dirty() calls as nilfs_mark_inode_dirty(), to reduce deep function call tree.

 fs/nilfs2/dir.c   |    2 +-
 fs/nilfs2/inode.c |    6 +++---
 fs/nilfs2/namei.c |   34 +++++++++++++++++-----------------
 3 files changed, 21 insertions(+), 21 deletions(-)

Thank you for sending this series.
I agree with the basic policy of the changes.

All right, I will review the patches as soon as possible.

Thanks,
Ryusuke Konishi

#17 lore raw
In reply to a message not in the archive
Quoted 19 lines · Ryusuke Konishi

Hi,

Quoted 8 lines · Jiro SEKIBA

Hi,

This is a series of patches to reduce redandunt mark_inode_dirty calls.

Many functions call mark_inode_dirty() whenever they change inode object. However, it is redundant to call mark_inode_dirty() to same inode object within a transaction.

Quoted 8 lines

Last patch also replaces all mark_inode_dirty() calls as nilfs_mark_inode_dirty(), to reduce deep function call tree.

 fs/nilfs2/dir.c   |    2 +-
 fs/nilfs2/inode.c |    6 +++---
 fs/nilfs2/namei.c |   34 +++++++++++++++++-----------------
 3 files changed, 21 insertions(+), 21 deletions(-)
Quoted 7 lines

Thank you for sending this series.
I agree with the basic policy of the changes.

All right, I will review the patches as soon as possible.

Thanks,
Ryusuke Konishi

Well wrought patches!

I have two comments to brush up the series.
Later, I will comment on the corresponding ones.

BTW, the diff stat looks smaller than the actual changes. My git-diff was as follows ;)

 fs/nilfs2/dir.c   |   24 ++++++---------
 fs/nilfs2/inode.c |    7 ++--
 fs/nilfs2/namei.c |   85 ++++++++++++++++++++++++++++++++++------------------
 3 files changed, 68 insertions(+), 48 deletions(-)

Thanks,
Ryusuke Konishi

#13 lore raw

Re: [PATCH 8/9] nilfs2: delete mark_inode_dirty in nilfs_delete_entry

In reply to a message not in the archive
Quoted 26 lines · Jiro SEKIBA

Delete mark_inode_dirty() in nilfs_delete_entry() to reduce duplicate mark_inode_dirty() calls both in nilfs_rename() and nilfs_delete_entry().

---
 fs/nilfs2/dir.c   |    1 -
 fs/nilfs2/namei.c |    4 +++-
 2 files changed, 3 insertions(+), 2 deletions(-)
fs/nilfs2/dir.c +0 -1
index 693539b..1d9a4e4 100644
@@ -595,7 +595,6 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page)
 	nilfs_commit_chunk(page, mapping, from, to);
 	inode->i_ctime = inode->i_mtime = CURRENT_TIME;
 /*	NILFS_I(inode)->i_flags &= ~NILFS_BTREE_FL; */
-	mark_inode_dirty(inode);
 out:
 	nilfs_put_page(page);
 	return err;
fs/nilfs2/namei.c +0 -0
index c662f8e..166a261 100644

fs/nilfs2/namei.c static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry) · line 320

Quoted 5 lines
fs/nilfs2/namei.c +2 -0
@@ -316,6 +316,8 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry)
 	if (err)
 		goto out;
 
+	mark_inode_dirty(dir);
+

I think this mark_inode_dirty(dir) should be moved to nilfs_unlink() because nilfs_rmdir() already has one mark_inode_dirty(dir) call.

Quoted 20 lines
fs/nilfs2/namei.c +1 -1
 	inode->i_ctime = dir->i_ctime;
 	drop_nlink(inode);
 	err = 0;
@@ -451,8 +453,8 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (dir_de) {
 		nilfs_set_link(old_inode, dir_de, dir_page, new_dir);
 		drop_nlink(old_dir);
-		mark_inode_dirty(old_dir);
 	}
+	mark_inode_dirty(old_dir);
 	mark_inode_dirty(old_inode);
 
 	err = nilfs_transaction_commit(old_dir->i_sb);
Signature · 6 lines
1.5.6.5

_______________________________________________
users mailing list
[email protected]
https://www.nilfs.org/mailman/listinfo/users
#7 lore raw

Re: [PATCH 4/9] nilfs2: delete redundant mark_inode_dirty

In reply to a message not in the archive
Quoted 37 lines · Jiro SEKIBA

Delete redundant mark_inode_dirty() calls

---
 fs/nilfs2/namei.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
fs/nilfs2/namei.c +0 -3
index f952439..33972c6 100644
@@ -280,7 +280,6 @@ out:
 
 out_fail:
 	drop_nlink(inode);
-	mark_inode_dirty(inode);
 	drop_nlink(inode);
 	mark_inode_dirty(inode);
 	iput(inode);
@@ -405,7 +404,6 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		if (!new_de)
 			goto out_dir;
 		inc_nlink(old_inode);
-		mark_inode_dirty(old_inode);
 		nilfs_set_link(new_dir, new_de, new_page, old_inode);
 		mark_inode_dirty(new_dir);
 		new_inode->i_ctime = CURRENT_TIME;
@@ -420,7 +418,6 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 				goto out_dir;
 		}
 		inc_nlink(old_inode);
-		mark_inode_dirty(old_inode);
 		err = nilfs_add_link(new_dentry, old_inode);
 		if (err) {
 			drop_nlink(old_inode);
Signature · 1 line
1.5.6.5

You can also remove the first mark_inode_dirty(dir) call in nilfs_mkdir() because nilfs_add_link() will mark the inode of parent directory dirty.

Ryusuke Konishi

#19 lore raw
In reply to a message not in the archive

Hi,

At Fri, 27 Nov 2009 18:30:15 +0900 (JST),

Quoted 26 lines · Ryusuke Konishi
Quoted 24 lines · Ryusuke Konishi

Hi,

Quoted 8 lines · Jiro SEKIBA

Hi,

This is a series of patches to reduce redandunt mark_inode_dirty calls.

Many functions call mark_inode_dirty() whenever they change inode object. However, it is redundant to call mark_inode_dirty() to same inode object within a transaction.

Quoted 8 lines

Last patch also replaces all mark_inode_dirty() calls as nilfs_mark_inode_dirty(), to reduce deep function call tree.

 fs/nilfs2/dir.c   |    2 +-
 fs/nilfs2/inode.c |    6 +++---
 fs/nilfs2/namei.c |   34 +++++++++++++++++-----------------
 3 files changed, 21 insertions(+), 21 deletions(-)

Thank you for sending this series.
I agree with the basic policy of the changes.

All right, I will review the patches as soon as possible.

Quoted 7 lines
Quoted 2 lines

Thanks,
Ryusuke Konishi

Well wrought patches!

I have two comments to brush up the series.
Later, I will comment on the corresponding ones.

Thank you for the review!

I'll revise it and send a series again.

Quoted 2 lines

BTW, the diff stat looks smaller than the actual changes. My git-diff was as follows ;)

Grr, look like it's the only the last diff stat..
I missed "9" to generate diff stat..

Quoted 14 lines
 fs/nilfs2/dir.c   |   24 ++++++---------
 fs/nilfs2/inode.c |    7 ++--
 fs/nilfs2/namei.c |   85 ++++++++++++++++++++++++++++++++++------------------
 3 files changed, 68 insertions(+), 48 deletions(-)

Thanks,
Ryusuke Konishi
_______________________________________________
users mailing list
[email protected]
https://www.nilfs.org/mailman/listinfo/users

Signature · 1 line
Jiro SEKIBA <[email protected]>