diff options
author | mckusick <mckusick@FreeBSD.org> | 2013-03-22 21:50:43 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2013-03-22 21:50:43 +0000 |
commit | 93fa1464f28c355009625fdcfd4007c798c20d44 (patch) | |
tree | d0ed2db47b0d4e99dc2acac864e90741fd40ba47 /sbin/fsck_ffs/pass5.c | |
parent | 45f62f67d30e33d8fa4d0e6d3a3a0ff5a231f18f (diff) | |
download | FreeBSD-src-93fa1464f28c355009625fdcfd4007c798c20d44.zip FreeBSD-src-93fa1464f28c355009625fdcfd4007c798c20d44.tar.gz |
Speed up fsck by caching the cylinder group maps in pass1 so
that they do not need to be read again in pass5. As this nearly
doubles the memory requirement for fsck, the cache is thrown away
if other memory needs in fsck would otherwise fail. Thus, the
memory footprint of fsck remains unchanged in memory constrained
environments.
This work was inspired by a paper presented at Usenix's FAST '13:
www.usenix.org/conference/fast13/ffsck-fast-file-system-checker
Details of this implementation appears in the April 2013 of ;login:
www.usenix.org/publications/login/april-2013-volume-38-number-2.
A copy of the April 2013 ;login: paper can also be downloaded
from: www.mckusick.com/publications/faster_fsck.pdf.
Reviewed by: kib
Tested by: Peter Holm
MFC after: 4 weeks
Diffstat (limited to 'sbin/fsck_ffs/pass5.c')
-rw-r--r-- | sbin/fsck_ffs/pass5.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c index b95df73..146acec 100644 --- a/sbin/fsck_ffs/pass5.c +++ b/sbin/fsck_ffs/pass5.c @@ -59,14 +59,14 @@ pass5(void) int c, i, j, blk, frags, basesize, mapsize; int inomapsize, blkmapsize; struct fs *fs = &sblock; - struct cg *cg = &cgrp; ufs2_daddr_t d, dbase, dmax, start; int rewritecg = 0; struct csum *cs; struct csum_total cstotal; struct inodesc idesc[3]; char buf[MAXBSIZE]; - struct cg *newcg = (struct cg *)buf; + struct cg *cg, *newcg = (struct cg *)buf; + struct bufarea *cgbp; inoinfo(WINO)->ino_state = USTATE; memset(newcg, 0, (size_t)fs->fs_cgsize); @@ -162,7 +162,8 @@ pass5(void) c * 100 / sblock.fs_ncg); got_sigalarm = 0; } - getblk(&cgblk, cgtod(fs, c), fs->fs_cgsize); + cgbp = cgget(c); + cg = cgbp->b_un.b_cg; if (!cg_chkmagic(cg)) pfatal("CG %d: BAD MAGIC NUMBER\n", c); newcg->cg_time = cg->cg_time; @@ -324,14 +325,14 @@ pass5(void) } if (rewritecg) { memmove(cg, newcg, (size_t)fs->fs_cgsize); - cgdirty(); + dirty(cgbp); continue; } if (cursnapshot == 0 && memcmp(newcg, cg, basesize) != 0 && dofix(&idesc[2], "SUMMARY INFORMATION BAD")) { memmove(cg, newcg, (size_t)basesize); - cgdirty(); + dirty(cgbp); } if (bkgrdflag != 0 || usedsoftdep || debug) update_maps(cg, newcg, bkgrdflag); @@ -340,7 +341,7 @@ pass5(void) dofix(&idesc[1], "BLK(S) MISSING IN BIT MAPS")) { memmove(cg_inosused(cg), cg_inosused(newcg), (size_t)mapsize); - cgdirty(); + dirty(cgbp); } } if (cursnapshot == 0 && |