mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-24 12:07:54 +00:00
btrfs-progs: check: make low memory mode support partially dropped snapshots
Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3f100c5251
commit
ac80fca06c
11
cmds-check.c
11
cmds-check.c
@ -9063,9 +9063,10 @@ static int check_tree_block_backref(struct btrfs_fs_info *fs_info, u64 root_id,
|
|||||||
free_extent_buffer(eb);
|
free_extent_buffer(eb);
|
||||||
|
|
||||||
btrfs_init_path(&path);
|
btrfs_init_path(&path);
|
||||||
|
path.lowest_level = level;
|
||||||
/* Search with the first key, to ensure we can reach it */
|
/* Search with the first key, to ensure we can reach it */
|
||||||
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
||||||
if (ret) {
|
if (ret < 0) {
|
||||||
err |= REFERENCER_MISSING;
|
err |= REFERENCER_MISSING;
|
||||||
goto release_out;
|
goto release_out;
|
||||||
}
|
}
|
||||||
@ -9948,6 +9949,8 @@ static int traverse_tree_block(struct btrfs_root *root,
|
|||||||
struct extent_buffer *node)
|
struct extent_buffer *node)
|
||||||
{
|
{
|
||||||
struct extent_buffer *eb;
|
struct extent_buffer *eb;
|
||||||
|
struct btrfs_key key;
|
||||||
|
struct btrfs_key drop_key;
|
||||||
int level;
|
int level;
|
||||||
u64 nr;
|
u64 nr;
|
||||||
int i;
|
int i;
|
||||||
@ -9993,6 +9996,7 @@ static int traverse_tree_block(struct btrfs_root *root,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nr = btrfs_header_nritems(node);
|
nr = btrfs_header_nritems(node);
|
||||||
|
btrfs_disk_key_to_cpu(&drop_key, &root->root_item.drop_progress);
|
||||||
btree_space_waste += (BTRFS_NODEPTRS_PER_BLOCK(root) - nr) *
|
btree_space_waste += (BTRFS_NODEPTRS_PER_BLOCK(root) - nr) *
|
||||||
sizeof(struct btrfs_key_ptr);
|
sizeof(struct btrfs_key_ptr);
|
||||||
|
|
||||||
@ -10000,6 +10004,11 @@ static int traverse_tree_block(struct btrfs_root *root,
|
|||||||
for (i = 0; i < nr; i++) {
|
for (i = 0; i < nr; i++) {
|
||||||
u64 blocknr = btrfs_node_blockptr(node, i);
|
u64 blocknr = btrfs_node_blockptr(node, i);
|
||||||
|
|
||||||
|
btrfs_node_key_to_cpu(node, &key, i);
|
||||||
|
if (level == root->root_item.drop_level &&
|
||||||
|
is_dropped_key(&key, &drop_key))
|
||||||
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As a btrfs tree has most 8 levels (0..7), so it's quite safe
|
* As a btrfs tree has most 8 levels (0..7), so it's quite safe
|
||||||
* to call the function itself.
|
* to call the function itself.
|
||||||
|
Loading…
Reference in New Issue
Block a user