[Ocfs2-commits] mfasheh commits r2787 - branches/ocfs2-1.2/fs/ocfs2

svn-commits@oss.oracle.com svn-commits at oss.oracle.com
Fri Mar 17 19:02:06 CST 2006


Author: mfasheh
Signed-off-by: jlbec
Date: 2006-03-17 19:02:05 -0600 (Fri, 17 Mar 2006)
New Revision: 2787

Modified:
   branches/ocfs2-1.2/fs/ocfs2/file.c
Log:
* Fix ocfs2_truncate_file() so that it forces a truncate_inode_pages() on
  all interested nodes in all cases of a truncate(), not just allocation
  change.

Signed-off-by: jlbec



Modified: branches/ocfs2-1.2/fs/ocfs2/file.c
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/file.c	2006-03-09 22:53:02 UTC (rev 2786)
+++ branches/ocfs2-1.2/fs/ocfs2/file.c	2006-03-18 01:02:05 UTC (rev 2787)
@@ -510,6 +510,17 @@
 	if (new_i_size == le64_to_cpu(fe->i_size))
 		goto bail;
 
+	/* This forces other nodes to sync and drop their pages. Do
+	 * this even if we have a truncate without allocation change -
+	 * ocfs2 cluster sizes can be much greater than page size, so
+	 * we have to truncate them anyway.  */
+	status = ocfs2_data_lock(inode, 1);
+	if (status < 0) {
+		mlog_errno(status);
+		goto bail;
+	}
+	ocfs2_data_unlock(inode, 1);
+
 	if (le32_to_cpu(fe->i_clusters) ==
 	    ocfs2_clusters_for_bytes(osb->sb, new_i_size)) {
 		mlog(0, "fe->i_clusters = %u, so we do a simple truncate\n",
@@ -532,14 +543,6 @@
 		goto bail;
 	}
 
-	/* This forces other nodes to sync and drop their pages */
-	status = ocfs2_data_lock(inode, 1);
-	if (status < 0) {
-		mlog_errno(status);
-		goto bail;
-	}
-	ocfs2_data_unlock(inode, 1);
-
 	/* alright, we're going to need to do a full blown alloc size
 	 * change. Orphan the inode so that recovery can complete the
 	 * truncate if necessary. This does the task of marking




More information about the Ocfs2-commits mailing list