Whamcloud - gitweb
e2fsck: force all block allocations to use block_found_map
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 18 Jul 2014 22:53:41 +0000 (15:53 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 25 Jul 2014 02:16:59 +0000 (22:16 -0400)
commitb4a40883385d610c55c11de52002bd8f9c2d790e
treee6d34b153b10eb06831b60cd7cbca73fab7ea853
parenta82d88ea99d3c5c21bf538b886da0482bf143fd5
e2fsck: force all block allocations to use block_found_map

During the later passes of efsck, we sometimes need to allocate and
map blocks into a file.  This can happen either by fsck directly
calling new_block() or indirectly by the library calling new_block
because it needs to allocate a block for lower level metadata (bmap2()
with BMAP_SET; block_iterate3() with BLOCK_CHANGED).

We need to force new_block to allocate blocks from the found block
map, because the FS block map could be inaccurate for various reasons:
the map is wrong, there are missing blocks, the checksum failed, etc.

Therefore, any time fsck does something that could to allocate blocks,
we need to intercept allocation requests so that they're sourced from
the found block map.  Remove the previous code that swapped bitmap
pointers as this is now unneeded.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/e2fsck.h
e2fsck/pass1.c
e2fsck/pass1b.c
e2fsck/pass2.c
e2fsck/pass3.c
e2fsck/rehash.c