[Ocfs2-commits] mfasheh commits r1904 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Feb 22 20:03:01 CST 2005


Author: mfasheh
Signed-off-by: zab
Date: 2005-02-22 20:03:00 -0600 (Tue, 22 Feb 2005)
New Revision: 1904

Modified:
   trunk/fs/ocfs2/dlmglue.c
   trunk/fs/ocfs2/file.c
   trunk/fs/ocfs2/ocfs_compat.h
   trunk/fs/ocfs2/util.c
   trunk/fs/ocfs2/util.h
   trunk/fs/ocfs2/vote.c
Log:
* get rid of ocfs_truncate_inode_pages -- it's a pointless wrapper
  
* fixes to data locking / integrity stuff (especially against 2.6)
  -call truncate_inode_pages against i_mapping which is what we should've
   been doing all these years... 
  -rely on filemap_fdatawrite to put data to disk in 2.6

Signed-off-by: zab



Modified: trunk/fs/ocfs2/dlmglue.c
===================================================================
--- trunk/fs/ocfs2/dlmglue.c	2005-02-23 01:38:42 UTC (rev 1903)
+++ trunk/fs/ocfs2/dlmglue.c	2005-02-23 02:03:00 UTC (rev 1904)
@@ -1942,16 +1942,30 @@
 				      int blocking)
 {
 	struct inode *inode;
+	struct address_space *mapping;
 
 	LOG_ENTRY();
+
        	inode = ocfs2_lock_res_inode(lockres);
+	mapping = inode->i_mapping;
 
-        sync_mapping_buffers(inode->i_mapping);
-        if (blocking == LKM_EXMODE) {
-                ocfs_truncate_inode_pages(inode, 0);
+	if (filemap_fdatawrite(mapping)) {
+		LOG_ERROR_ARGS("Could not sync inode %llu for downconvert!",
+			       OCFS_I(inode)->ip_blkno);
+	}
+	sync_mapping_buffers(mapping);
+	if (blocking == LKM_EXMODE) {
+		truncate_inode_pages(mapping, 0);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,6)
-		unmap_mapping_range(inode->i_mapping, 0, 0, 0);
+		unmap_mapping_range(mapping, 0, 0, 0);
 #endif
+	} else {
+		/* We only need to wait on the I/O if we're not also
+		 * truncating pages because truncate_inode_pages waits
+		 * for us above. We don't truncate pages if we're
+		 * blocking anything < EXMODE because we want to keep
+		 * them around in that case. */
+		filemap_fdatawait(mapping);
 	}
 
 	LOG_EXIT();

Modified: trunk/fs/ocfs2/file.c
===================================================================
--- trunk/fs/ocfs2/file.c	2005-02-23 01:38:42 UTC (rev 1903)
+++ trunk/fs/ocfs2/file.c	2005-02-23 02:03:00 UTC (rev 1904)
@@ -613,7 +613,7 @@
 	LOG_ENTRY_ARGS("(inode = %llu, new_i_size = %llu\n", 
 		       OCFS_I(inode)->ip_blkno, new_i_size);
 
-	ocfs_truncate_inode_pages(inode, new_i_size);
+	truncate_inode_pages(inode->i_mapping, new_i_size);
 
 	status = ocfs_read_block(osb, OCFS_I(inode)->ip_blkno, &fe_bh,
 				 OCFS_BH_CACHED, inode);

Modified: trunk/fs/ocfs2/ocfs_compat.h
===================================================================
--- trunk/fs/ocfs2/ocfs_compat.h	2005-02-23 01:38:42 UTC (rev 1903)
+++ trunk/fs/ocfs2/ocfs_compat.h	2005-02-23 02:03:00 UTC (rev 1904)
@@ -72,6 +72,9 @@
 #define INIT_WORK(w, f, d)	INIT_TQUEUE(w, f, d)
 #define schedule_work(w)	schedule_task(w)
 
+/* I don't believe this does the same thing in 2.4 as it does in 2.6
+ * and in fact, I don't think the 2.6 version does *anything* in our
+ * case. */
 static inline int sync_mapping_buffers(struct address_space *mapping)
 {       
 	struct inode *inode = mapping->host;

Modified: trunk/fs/ocfs2/util.c
===================================================================
--- trunk/fs/ocfs2/util.c	2005-02-23 01:38:42 UTC (rev 1903)
+++ trunk/fs/ocfs2/util.c	2005-02-23 02:03:00 UTC (rev 1904)
@@ -117,14 +117,6 @@
 #endif
 #endif
 
-void ocfs_truncate_inode_pages(struct inode *inode, loff_t off)
-{
-	LOG_TRACE_ARGS("truncating pages for inode %llu (%p) from offset %llu\n", 
-		       OCFS_I(inode)->ip_blkno, inode, off);
-	truncate_inode_pages(&inode->i_data, off);
-}				/* ocfs_truncate_inode_pages */
-
-
 /*
 To print the ocfs call stack use: ocfs_show_stack( NULL);
 

Modified: trunk/fs/ocfs2/util.h
===================================================================
--- trunk/fs/ocfs2/util.h	2005-02-23 01:38:42 UTC (rev 1903)
+++ trunk/fs/ocfs2/util.h	2005-02-23 02:03:00 UTC (rev 1904)
@@ -29,7 +29,6 @@
 void ocfs_daemonize(char *name, int len, int shutdown_sigs);
 void ocfs_show_stack(unsigned long *esp);
 void ocfs_show_trace(unsigned long *stack);
-void ocfs_truncate_inode_pages(struct inode *inode, loff_t off);
 void ocfs_block_sigs(sigset_t *oldsigs, unsigned long mask);
 void ocfs_unblock_sigs(sigset_t newsig);
 

Modified: trunk/fs/ocfs2/vote.c
===================================================================
--- trunk/fs/ocfs2/vote.c	2005-02-23 01:38:42 UTC (rev 1903)
+++ trunk/fs/ocfs2/vote.c	2005-02-23 02:03:00 UTC (rev 1904)
@@ -162,6 +162,15 @@
 		goto done;
 	}
 
+	if (filemap_fdatawrite(inode->i_mapping)) {
+		LOG_ERROR_ARGS("Could not sync inode %llu for delete!\n",
+			       OCFS_I(inode)->ip_blkno);
+		goto done;
+	}
+	sync_mapping_buffers(inode->i_mapping);
+	truncate_inode_pages(inode->i_mapping, 0);
+	ocfs2_extent_map_trunc(inode, 0);
+
 	/* If we get here, then we're voting 'yes', so commit the
 	 * delete on our side. */
 	response = 0;
@@ -175,11 +184,6 @@
 
 	d_prune_aliases (inode);
 
-	/* TODO: How much of this is really necessary? */
-	sync_mapping_buffers(inode->i_mapping);
-	ocfs_truncate_inode_pages(inode, 0);
-	ocfs2_extent_map_trunc(inode, 0);
-
 done:
 	return response;
 }



More information about the Ocfs2-commits mailing list