Skip to contentSkip to conversation

fsck.gfs2: Speed up function bitmap_type

PATCH New Bob Peterson 1 participant 1 message Jul 14, 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: Speed up function bitmap_type

Hi,

Here's another patch that speeds up the performance of fsck.gfs2. This one was also posted as part of a larger set on 22 June.

On my 15TB file system which is 80% full, the previous two patches I posted made pass1 go from 15h52m to 14h23m. This patch makes pass1 go from 14h23m to 13h35m27s, a savings of 47 minutes: another 6 percent speedup from the previous set.

Patch description:

This patch speeds up fsck.gfs2 by allowing function bitmap_type to remember the last rgrp it used for the next lookup.

---

gfs2/fsck/util.h +7 -1
index d93b65d..0649fec 100644
@@ -70,8 +70,14 @@ static inline void link1_destroy(struct gfs2_bmap *bmap)
 static inline int bitmap_type(struct gfs2_sbd *sdp, uint64_t bblock)
 {
 	struct rgrp_tree *rgd;
+	static struct rgrp_tree *prevrgd = NULL;
 
-	rgd = gfs2_blk2rgrpd(sdp, bblock);
+	if (prevrgd && rgrp_contains_block(prevrgd, bblock))
+		rgd = prevrgd;
+	else {
+		rgd = gfs2_blk2rgrpd(sdp, bblock);
+		prevrgd = rgd;
+	}
 	return lgfs2_get_bitmap(sdp, bblock, rgd);
 }