cluster: RHEL60 - gfs2-utils: mkfs can't fsync device with 32MB RGs

Bob Peterson rpeterso at fedoraproject.org
Fri Aug 13 14:31:49 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=ba3ddbcd0a1123350774e75ac1845c4fae61f697
Commit:        ba3ddbcd0a1123350774e75ac1845c4fae61f697
Parent:        734c1956e16c5afc6ac5f265e9b3ed396f9e4201
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Wed Aug 11 13:31:14 2010 -0500
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Fri Aug 13 09:32:52 2010 -0500

gfs2-utils: mkfs can't fsync device with 32MB RGs

This patch periodically syncs rgrp data written to a GFS2
file system during mkfs.gfs2 to circumvent the problem
described in bug #605322.

rhbz#622844
---
 gfs2/libgfs2/rgrp.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 8d2d405..d442633 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -5,6 +5,8 @@
 
 #include "libgfs2.h"
 
+#define RG_SYNC_TOLERANCE 1000
+
 /**
  * gfs2_compute_bitstructs - Compute the bitmap sizes
  * @rgd: The resource group descriptor
@@ -158,11 +160,21 @@ void gfs2_rgrp_relse(struct rgrp_list *rgd)
 void gfs2_rgrp_free(osi_list_t *rglist)
 {
 	struct rgrp_list *rgd;
+	int rgs_since_sync = 0;
+	struct gfs2_sbd *sdp = NULL;
 
 	while(!osi_list_empty(rglist->next)){
 		rgd = osi_list_entry(rglist->next, struct rgrp_list, list);
-		if (rgd->bh && rgd->bh[0]) /* if a buffer exists        */
+		if (rgd->bh && rgd->bh[0]) { /* if a buffer exists        */
+			rgs_since_sync++;
+			if (rgs_since_sync >= RG_SYNC_TOLERANCE) {
+				if (!sdp)
+					sdp = rgd->bh[0]->sdp;
+				fsync(sdp->device_fd);
+				rgs_since_sync = 0;
+			}
 			gfs2_rgrp_relse(rgd); /* free them all. */
+		}
 		if(rgd->bits)
 			free(rgd->bits);
 		if(rgd->bh) {


More information about the cluster-commits mailing list