From: Bob Peterson Date: Wed, 13 Jul 2016 08:36:11 -0400 (EDT) Subject: [Cluster-devel] [fsck.gfs2 PATCH] fsck.gfs2: Remember the previous rgrp pointer for speed In-Reply-To: <814881221.10451972.1468412544129.JavaMail.zimbra@redhat.com> Message-ID: <1984242469.10457793.1468413371934.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I posted this fsck.gfs2 performance patch previously on 22 June as part of a multi-patch set. As suggested, I split the patches up so they're no longer in a set. I've also been studying the effects of each performance patch to make sure they're worth doing. To test performance, I've been using a 15TB file system that's 80% full of random-sized files. I'm using the same hardware, kernel and file system for each test. I test to see how long each pass takes. I do drop_caches before each test to guard against speed-ups due to blocks in the buffer cache. The first fsck.gfs2 performance benchmark I did was against the master branch of gfs2-utils with its patches as of today, and got the following values: pass1 completed in 16h49m44.636s pass1b completed in 0.000s pass2 completed in 21m53.031s pass3 completed in 0.048s pass4 completed in 14.463s With this patch, pass1 went from 16h49m44.636s to 15h52m8.912s, a savings of 57 minutes, and a 5.6 percent speedup. Regards, Bob Peterson Red Hat File Systems --- This is a minor speedup: function check_n_fix_bitmap will now remember the previous rgrp that it used. This should make it faster. Signed-off-by: Bob Peterson diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c index fecf33e..4d6dcfa 100644 --- a/gfs2/fsck/metawalk.c +++ b/gfs2/fsck/metawalk.c @@ -40,9 +40,14 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, {"free", "data", "unlinked", "inode", "reserved"}, /* gfs1 descriptions: */ {"free", "data", "free meta", "metadata", "reserved"}}; + static struct rgrp_tree *prevrgd = NULL; - if (rgd == NULL || !rgrp_contains_block(rgd, blk)) + if (prevrgd && rgrp_contains_block(prevrgd, blk)) { + rgd = prevrgd; + } else if (rgd == NULL || !rgrp_contains_block(rgd, blk)) { rgd = gfs2_blk2rgrpd(sdp, blk); + prevrgd = rgd; + } gfs1rg = (struct gfs_rgrp *)&rgd->rg;