path: root/ctree.h
diff options
authorChris Mason <>2012-02-10 13:28:50 -0500
committerChris Mason <>2012-02-10 13:28:50 -0500
commit62b79931546bca1b95a4b23ecec8378c372b26f7 (patch)
tree7870cdcb077193cc20982dbf43279575d4f839d0 /ctree.h
parentae1822f73f92adca8ccfac24bc0e6e440f776fa4 (diff)
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 <>
Diffstat (limited to 'ctree.h')
1 files changed, 6 insertions, 0 deletions
diff --git a/ctree.h b/ctree.h
index c53f65a8..c96c8597 100644
--- a/ctree.h
+++ b/ctree.h
@@ -797,6 +797,12 @@ struct btrfs_fs_info {
struct list_head space_info;
int system_allocs;
int readonly;
+ int (*free_extent_hook)(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ u64 bytenr, u64 num_bytes, u64 parent,
+ u64 root_objectid, u64 owner, u64 offset,
+ int refs_to_drop);
+ struct cache_tree * fsck_extent_cache;