RE: [PATCH 10/14] repair: cleanup helpers for tracking block usage

Alex Elder
2009-10-21T19:33:13Z

Christoph Hellwig wrote:
> Rename get_agbno_state/set_agbno_state to get_bmap/set_bmap because
> those names are more self-descriptive. Remove the superblous mount
> argument to the as the current filesystem is a global in repair.
> Remove the fsbno taking variant as they just complicated the code.
> Bring all uses of them into the canonical form.

Another big pile o' whitespace changes here, wish they were
separated so it was clearer to see what *really* changed...

One bad bug indicated in comments below, but easy to fix.

But this looks good otherwise.

> Signed-off-by: Barry Naujok <bnaujok@sgi.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Alex Elder <aelder@sgi.com>

> Index: xfsprogs-dev/repair/scan.c
> ===================================================================
> --- xfsprogs-dev.orig/repair/scan.c 2009-08-21 19:05:32.000000000 +0000
> +++ xfsprogs-dev/repair/scan.c 2009-08-21 19:06:51.000000000 +0000

. . .

> @@ -476,19 +480,15 @@ scanfunc_allocbt(
> /*
> * check for btree blocks multiply claimed
> */
> - state = get_agbno_state(mp, agno, bno);
> -
> - switch (state) {
> - case XR_E_UNKNOWN:
> - set_agbno_state(mp, agno, bno, XR_E_FS_MAP);
> - break;
> - default:
> - set_agbno_state(mp, agno, bno, XR_E_MULT);
> + state = get_bmap(agno, bno);
> + switch (state != XR_E_UNKNOWN) {

BUG. You mean "if (state != XR_E_UNKNOWN)"???

> + set_bmap(agno, bno, XR_E_MULT);
> do_warn(
> _("%s freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
> name, state, agno, bno, suspect);
> return;
> }
> + set_bmap(agno, bno, XR_E_FS_MAP);
>
> numrecs = be16_to_cpu(block->bb_numrecs);