Skip to contentSkip to conversation

fsck.gfs2: Remember the previous rgrp pointer for speed

PATCH New Bob Peterson 2 participants 2 messages Jul 13, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 fsck.gfs2: Remember the previous rgrp pointer for speed

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.

gfs2/fsck/metawalk.c +6 -1
index fecf33e..4d6dcfa 100644
@@ -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;
 
#2 lore raw

PATCH 1/1 fsck.gfs2: Remember the previous rgrp pointer for speed

Quoted 17 lines · Bob Peterson

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:

Quoted 8 lines

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.

Nice!

Looks good to me - ACK

Andy

Quoted 33 lines

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.

gfs2/fsck/metawalk.c +6 -1
index fecf33e..4d6dcfa 100644
@@ -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;