cluster: RHEL6 - gfs2_edit restoremeta: sync changes on a regular basis

Bob Peterson rpeterso at fedoraproject.org
Thu Feb 16 14:33:47 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=5a2bb5b4e5e57cb66f318173203b4acbc26c8f50
Commit:        5a2bb5b4e5e57cb66f318173203b4acbc26c8f50
Parent:        1994f1fd6d211e0740ea9fb9e8356512c2bf1091
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Thu Feb 16 08:23:04 2012 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Thu Feb 16 09:27:24 2012 -0600

gfs2_edit restoremeta: sync changes on a regular basis

This patch calls fsync on a regular basis to commit restored
GFS2 metadata to media. This is primarily to make it more user-
friendly. Without it, large metadata sets appear to restore very
quickly, then hang for a very long time while the buffers are all
being synced to disk. This prevents it from getting too far ahead.
So it will seem to restore more slowly, but not hang at the end.

rhbz#749864
---
 gfs2/edit/savemeta.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 389db99..84499d0 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -945,6 +945,8 @@ static int restore_data(int fd, gzFile *gzin_fd, int printblocksonly,
 				exit(-1);
 			}
 			writes++;
+			if (writes % 1000 == 0)
+				fsync(fd);
 		}
 		blks_saved++;
 	}


More information about the cluster-commits mailing list