[PATCH] JFS: Performance improvement (1 of 3)

Dave Kleikamp <[email protected]> Tue, 22 Apr 2003 09:42:45 -0500
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1100  -> 1.1100.3.1
#	 fs/jfs/jfs_incore.h	1.10    -> 1.11   
#	 fs/jfs/jfs_txnmgr.c	1.24    -> 1.25   
#	       fs/jfs/file.c	1.9     -> 1.10   
#	 fs/jfs/jfs_extent.c	1.7     -> 1.8    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/04/04	[email protected]	1.1100.3.1
# JFS: Performance improvement
# 
# There is no need to synchronously write data when committing an inode unless
# new allocation was done since the last data sync.
# --------------------------------------------
#
diff -Nru a/fs/jfs/file.c b/fs/jfs/file.c
--- a/fs/jfs/file.c	Tue Apr 22 09:18:51 2003
+++ b/fs/jfs/file.c	Tue Apr 22 09:18:51 2003
@@ -33,6 +33,10 @@
 	struct inode *inode = dentry->d_inode;
 	int rc = 0;
 
+	/* No need to resync the data at commit time, unless this flag gets
+	 * set again */
+	clear_cflag(COMMIT_Syncdata, inode);
+
 	rc = fsync_inode_data_buffers(inode);
 
 	if (!(inode->i_state & I_DIRTY))
diff -Nru a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c
--- a/fs/jfs/jfs_extent.c	Tue Apr 22 09:18:51 2003
+++ b/fs/jfs/jfs_extent.c	Tue Apr 22 09:18:51 2003
@@ -175,6 +175,7 @@
 	xp->flag = xflag;
 
 	mark_inode_dirty(ip);
+	set_cflag(COMMIT_Syncdata, ip);
 
 	up(&JFS_IP(ip)->commit_sem);
 	/*
diff -Nru a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h
--- a/fs/jfs/jfs_incore.h	Tue Apr 22 09:18:51 2003
+++ b/fs/jfs/jfs_incore.h	Tue Apr 22 09:18:51 2003
@@ -114,6 +114,7 @@
 	COMMIT_Dirtable,	/* commit changes to di_dirtable */
 	COMMIT_Stale,		/* data extent is no longer valid */
 	COMMIT_Synclist,	/* metadata pages on group commit synclist */
+	COMMIT_Syncdata,	/* Data must be synced before inode committed */
 };
 
 #define set_cflag(flag, ip)	set_bit(flag, &(JFS_IP(ip)->cflag))
diff -Nru a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
--- a/fs/jfs/jfs_txnmgr.c	Tue Apr 22 09:18:51 2003
+++ b/fs/jfs/jfs_txnmgr.c	Tue Apr 22 09:18:51 2003
@@ -1177,16 +1177,8 @@
 		ip = cd.iplist[k];
 		jfs_ip = JFS_IP(ip);
 
-		/*
-		 * BUGBUG - Should we call filemap_fdatasync here instead
-		 * of fsync_inode_data?
-		 * If we do, we have a deadlock condition since we may end
-		 * up recursively calling jfs_get_block with the IWRITELOCK
-		 * held.  We may be able to do away with IWRITELOCK while
-		 * committing transactions and use i_sem instead.
-		 */
-		if ((!S_ISDIR(ip->i_mode))
-		    && (tblk->flag & COMMIT_DELETE) == 0)
+		if (test_and_clear_cflag(COMMIT_Syncdata, ip) &&
+		    ((tblk->flag && COMMIT_DELETE) == 0))
 			fsync_inode_data_buffers(ip);
 
 		/*