gfs2-utils: master - gfs2_edit restoremeta: sync changes on a regular basis RHEL6

Bob Peterson rpeterso at fedoraproject.org
Thu Feb 16 19:49:15 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=8b741686066210d67cc3c852b8fbe24a8838887d
Commit:        8b741686066210d67cc3c852b8fbe24a8838887d
Parent:        738ef86302661731324bb2a50922e810faac1ad7
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Thu Feb 16 14:44:56 2012 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Thu Feb 16 14:44:56 2012 -0600

gfs2_edit restoremeta: sync changes on a regular basis RHEL6

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.
---
 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 3fb2650..77cd7fa 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