[Cluster-devel] cluster/gfs2/fsck Makefile util.c

rpeterso at sourceware.org rpeterso at sourceware.org
Tue Jan 23 20:56:54 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rpeterso at sourceware.org	2007-01-23 20:56:53

Modified files:
	gfs2/fsck      : Makefile util.c 

Log message:
	Resolves: bz 223500: gfs2_fsck runs slower than previous version

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/Makefile.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6&r2=1.6.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/util.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.1&r2=1.4.2.2

--- cluster/gfs2/fsck/Makefile	2006/08/11 15:18:13	1.6
+++ cluster/gfs2/fsck/Makefile	2007/01/23 20:56:53	1.6.2.1
@@ -25,7 +25,7 @@
 	pass4.c pass5.c util.c fs_recovery.c \
 	lost_n_found.c link.c eattr.c hash.c inode_hash.c metawalk.c
 
-CFLAGS+=-D_FILE_OFFSET_BITS=64 -DHELPER_PROGRAM -DGFS_RELEASE_NAME=\"${RELEASE}\" -Wall -g
+CFLAGS+=-D_FILE_OFFSET_BITS=64 -DHELPER_PROGRAM -DGFS_RELEASE_NAME=\"${RELEASE}\" -Wall -O2
 
 all: ${TARGET}
 
--- cluster/gfs2/fsck/util.c	2007/01/23 19:30:19	1.4.2.1
+++ cluster/gfs2/fsck/util.c	2007/01/23 20:56:53	1.4.2.2
@@ -58,20 +58,25 @@
 /* doesn't think we hung.  (This may take a long time).       */
 void warm_fuzzy_stuff(uint64_t block)
 {
+	static uint64_t one_percent = 0;
 	static struct timeval tv;
 	static uint32_t seconds = 0;
 	
-	last_reported_block = block;
-	gettimeofday(&tv, NULL);
-	if (!seconds)
-		seconds = tv.tv_sec;
-	if (tv.tv_sec - seconds) {
-		uint64_t percent;
+	if (!one_percent)
+		one_percent = last_fs_block / 100;
+	if (block - last_reported_block >= one_percent) {
+		last_reported_block = block;
+		gettimeofday(&tv, NULL);
+		if (!seconds)
+			seconds = tv.tv_sec;
+		if (tv.tv_sec - seconds) {
+			static uint64_t percent;
 
-		seconds = tv.tv_sec;
-		if (last_fs_block) {
-			percent = (block * 100) / last_fs_block;
-			log_notice("\r%" PRIu64 " percent complete.\r", percent);
+			seconds = tv.tv_sec;
+			if (last_fs_block) {
+				percent = (block * 100) / last_fs_block;
+				log_notice("\r%" PRIu64 " percent complete.\r", percent);
+			}
 		}
 	}
 }




More information about the Cluster-devel mailing list