btrfsck: remove extents from the fsck reference tracker as they are freed
authorChris Mason <chris.mason@oracle.com>
Fri, 10 Feb 2012 18:28:50 +0000 (13:28 -0500)
committerChris Mason <chris.mason@oracle.com>
Fri, 10 Feb 2012 18:28:50 +0000 (13:28 -0500)
commit62b79931546bca1b95a4b23ecec8378c372b26f7
tree7870cdcb077193cc20982dbf43279575d4f839d0
parentae1822f73f92adca8ccfac24bc0e6e440f776fa4
btrfsck: remove extents from the fsck reference tracker as they are freed

During btrfsck --repair, we make an index of extents that have incorrect
reference counts.  Once we've collect the whole index, we go through
and modify the extent allocation tree to reflect the correct results.

Changing the extent allocation tree may free blocks, and so it may
end up removing a block that had a missing reference structure.  The
fsck code may then circle back around and add the reference back.

The result is an extent that isn't actually used, but is recorded in the
extent allocation tree.

This commit adds a hook called as extents are freed.  The hook searches
the index of incorrect references and updates it to reflect the freeing
of the extent.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
btrfsck.c
ctree.h
extent-tree.c