[Ocfs2-commits] zab commits r2115 - trunk/fs/ocfs2/cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Apr 5 17:40:01 CDT 2005


Author: zab
Signed-off-by: mfasheh
Date: 2005-04-05 17:39:59 -0500 (Tue, 05 Apr 2005)
New Revision: 2115

Modified:
   trunk/fs/ocfs2/cluster/heartbeat.c
Log:
o shift in the right direction when going from blocks to sectors
o invalidate the hb bdev's page cache so userspace can sometimes use 
  regular io from /dev to see the heartbeat

Signed-off-by: mfasheh


Modified: trunk/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.c	2005-04-05 20:38:01 UTC (rev 2114)
+++ trunk/fs/ocfs2/cluster/heartbeat.c	2005-04-05 22:39:59 UTC (rev 2115)
@@ -206,7 +206,7 @@
 	}
 
 	/* Must put everything in 512 byte sectors for the bio... */
-	bio->bi_sector = reg->hr_start_block >> (bits - 9);
+	bio->bi_sector = reg->hr_start_block << (bits - 9);
 	bio->bi_bdev = reg->hr_bdev;
 	bio->bi_private = bio_wait;
 	bio->bi_end_io = hb_bio_end_io;
@@ -260,7 +260,7 @@
 	start = (nm_this_node() % reg->hr_hb_slots_per_page) << bits;
 
 	write_block = reg->hr_start_block + nm_this_node();
-	bio->bi_sector = write_block >> (bits - 9);
+	bio->bi_sector = write_block << (bits - 9);
 	bio->bi_bdev = reg->hr_bdev;
 	bio->bi_private = bio_wait;
 	bio->bi_end_io = hb_bio_end_io;
@@ -369,6 +369,18 @@
 		goto bail;
 	}
 
+	/* before we do anything lets blow away the page cache
+	 * for the hb region so that userspace can at least
+	 * read bh-cached /dev/ w/o surprises while the
+	 * thread is running */
+	truncate_inode_pages_range(reg->hr_bdev->bd_inode->i_mapping,
+				   (reg->hr_fs_start_block <<
+				   	reg->hr_fs_block_bits) &
+				   		PAGE_CACHE_MASK, 
+				   PAGE_ALIGN((reg->hr_fs_start_block +
+					      reg->hr_fs_blocks) <<
+					   	reg->hr_fs_block_bits) - 1);
+
 	/* We 1st do a sync read of all slots */
 	bio_get(read_bio);
 	submit_bio(READ, read_bio);



More information about the Ocfs2-commits mailing list