[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Linux-cluster] About GFS1 and I/O barriers.



Hello GFS team,

Some recent kernel developements have brought IO barriers into the
kernel to prevent corruptions that could happen when blocks are being
reordered before write, by the kernel or the block device itself, just
before an electrical power failure.
(on high-end block devices with UPS or NVRAM, those problems cannot
happen)
Some file systems implement them, notably ext3 and XFS. It seems to me
that GFS1 has no such thing.

Do you plan to implement it ? If so, could the attached patch do the
work ? It's incomplete : it would need a global tuning like fast_stafs,
and a mount option like it's done for ext3. The code is mainly a
copy-paste from JBD, and does a barrier only for journal meta-data.
(should i do it for other meta-data ?)

Thanks,

--
Mathieu

Index: cluster/gfs-kernel/src/gfs/dio.c
===================================================================
--- cluster/gfs-kernel/src/gfs/dio.c	(révision 26309)
+++ cluster/gfs-kernel/src/gfs/dio.c	(copie de travail)
@@ -917,8 +917,29 @@
 int
 gfs_logbh_wait(struct gfs_sbd *sdp, struct buffer_head *bh)
 {
-	wait_on_buffer(bh);
+        static int allow_barrier = 1;
+        int ret;
 
+	if (allow_barrier)
+	  {
+	    set_buffer_dirty(bh);
+	    set_buffer_ordered(bh);
+	    ret = sync_dirty_buffer(bh);
+	    if (ret == -EOPNOTSUPP)
+	      {
+		printk(KERN_WARNING
+		       "barrier-based sync failed. Disabling barriers\n");
+		allow_barrier = 0;
+		clear_buffer_ordered(bh);
+		set_buffer_uptodate(bh);
+		set_buffer_dirty(bh);
+	      }
+	  }
+	if (!allow_barrier)
+	  {
+	    wait_on_buffer(bh);
+	  }
+
 	if (!buffer_uptodate(bh) || buffer_dirty(bh)) {
 		gfs_io_error_bh(sdp, bh);
 		return -EIO;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]