Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=056477066e8... Commit: 056477066e819f716df86c342676797ebacb803e Parent: 4e60fdf18f5ece9e439ae66fef966eec1f38812a Author: Andrew Price anprice@redhat.com AuthorDate: Fri Feb 12 17:25:38 2016 +0000 Committer: Andrew Price anprice@redhat.com CommitterDate: Thu Jan 12 16:20:33 2017 +0000
gfs2_edit savemeta: Don't read rgrp blocks twice
When savemeta iterates over the rgrps and saves the rgrp header blocks it calls save_block which does a bread() for each block despite them already being read in earlier. Instead, call save_bh() on the existing rgrp buffers. This isn't likely to give a significant performance improvement as the duplicate reads would be cache hits but it should have a noticeable effect on very large file systems.
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/edit/savemeta.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c index 3e8dae0..9723dcd 100644 --- a/gfs2/edit/savemeta.c +++ b/gfs2/edit/savemeta.c @@ -855,8 +855,8 @@ void savemeta(char *out_fn, int saveoption, int gziplevel) } /* Walk through the resource groups saving everything within */ for (n = osi_first(&sbd.rgtree); n; n = osi_next(n)) { - uint64_t blk; struct rgrp_tree *rgd; + unsigned i;
rgd = (struct rgrp_tree *)n; if (gfs2_rgrp_read(&sbd, rgd)) @@ -866,10 +866,9 @@ void savemeta(char *out_fn, int saveoption, int gziplevel) (unsigned long long)rgd->ri.ri_addr, rgd->ri.ri_length); /* Save off the rg and bitmaps */ - for (blk = rgd->ri.ri_addr; - blk < rgd->ri.ri_data0; blk++) { - warm_fuzzy_stuff(blk, FALSE); - save_block(sbd.device_fd, &mfd, blk, blk, NULL); + for (i = 0; i < rgd->ri.ri_length; i++) { + warm_fuzzy_stuff(rgd->ri.ri_addr + i, FALSE); + save_bh(&mfd, rgd->bits[i].bi_bh, 0, NULL); } /* Save off the other metadata: inodes, etc. if mode is not 'savergs' */ if (saveoption != 2) {
cluster-commits@lists.fedorahosted.org