[Ocfs2-commits] rev 20 - in trunk/src: . inc

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Feb 4 01:24:02 CST 2004


Author: manish
Date: 2004-02-04 01:24:00 -0600 (Wed, 04 Feb 2004)
New Revision: 20

Modified:
   trunk/src/inc/io.h
   trunk/src/io.c
Log:
* don't poison buffers that are marked dirty, uptodate, or jbd.
* add a macro in io.h to check if a buffer has been poisoned


Modified: trunk/src/inc/io.h
===================================================================
--- trunk/src/inc/io.h	2004-02-03 01:29:16 UTC (rev 19)
+++ trunk/src/inc/io.h	2004-02-04 07:24:00 UTC (rev 20)
@@ -167,9 +167,19 @@
 	}								      \
 } while(0)
 
+/* check the 1st five bytes. */
+static inline int ocfs_poison(struct buffer_head *bh)
+{
+	int i;
+	for(i = 0; i < 512; i++)
+		if ((bh)->b_data[i] != 'P')
+			return(0);
+	return(1);
+}
+
 #define OCFS_DO_HEX_DUMP(bh)						      \
 do {									      \
-	printk("bh->b_data:\n");					      \
+	printk("bh->b_blocknr = %lu, bh->b_data:\n", bh->b_blocknr);	      \
 	for(i = 0; i < 512; i++) {					      \
 		printk("%03x ", bh->b_data[i]);				      \
 		if ( ((i+1) % 16) == 0 )				      \

Modified: trunk/src/io.c
===================================================================
--- trunk/src/io.c	2004-02-03 01:29:16 UTC (rev 19)
+++ trunk/src/io.c	2004-02-04 07:24:00 UTC (rev 20)
@@ -165,7 +165,9 @@
 	/* fill in the remainder of the blocks not read from disk */
 	for (i=total, blk = ((unsigned long)(off >> 9) + total); i<256; i++, blk++) {
 		bhs[i] = getblk (OCFS_GET_BLOCKDEV(osb->sb), blk, 512);
-		memset(bhs[i]->b_data, 'P', 512);
+		if (!buffer_uptodate(bhs[i]) && !buffer_jbd(bhs[i]) 
+		    && !buffer_dirty(bhs[i]))
+			memset(bhs[i]->b_data, 'P', 512);
 	}
 bail:
 	LOG_EXIT_STATUS(status);



More information about the Ocfs2-commits mailing list