RE: [PATCH 11/14] repair: cleanup alloc/free/reset of the block usagetracking

Alex Elder
2009-10-21T20:21:10Z

Christoph Hellwig wrote:
> Currently the code to allocate, free and reset the block usage bitmaps
> is a complete mess. This patch reorganizes it into logical helpers.
>
> Details:
>
> - the current incore_init code is called just before phase2 is called,
> which then marks the log and the AG headers used.
> - we get rid of incore_init init, and replace it with direct calls to the
> unchanched incore_ino_init/incore_ext_init functions and our new init_bmaps
> which does all the allocations for the block usage tracking, aswell
> as a call to reset_bmaps to initialize it to the default values.
> - reset_bmaps is also called from early phase4 code to reset all state
> instead of opencoding it.
> - there is a new free_bmaps helper which we call to free our block usage
> bitmaps when we don't need them anymore after phase5. The current
> code frees some of it a bit early in phase5, but needs to take of it
> in phase6 in case we didn't call phase5 due to nomodify mode, and leaks
> it if we don't call phase 6, which might happen in case of a bad inode
> allocation btree.

Looks good. -Alex

> 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/phase4.c
> ===================================================================
> --- xfsprogs-dev.orig/repair/phase4.c 2009-08-21 01:59:26.000000000 +0000
> +++ xfsprogs-dev/repair/phase4.c 2009-08-21 02:41:44.000000000 +0000
> @@ -355,19 +355,7 @@ phase4(xfs_mount_t *mp)

. . .