btrfs-progs: image: Rebuild dev extents for restore
PATCH 1/1 btrfs-progs: image: Rebuild dev extents for restore
When restoring image from a dump of multiple device, we just restore device as is, even the restore destination is just a single device.
In that case, due to dev extents mismatch, latest kernel will refuse to mount it as it detects such mismatch as good as btrfs check.
Fix it by rebuilding the whole device tree when finishing restore, so kernel or btrfs check will give no complain about restore image any more.
This fixes misc/021 test case.
Reported-by Nikolay Borisov <[email protected]>
Signed-off-by Qu Wenruo <[email protected]>
--- ctree.h | 6 +++ image/main.c | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+)
ctree.h +6 -0
@@ -1707,6 +1707,12 @@ BTRFS_SETGET_FUNCS(dev_extent_chunk_offset, struct btrfs_dev_extent, chunk_offset, 64); BTRFS_SETGET_FUNCS(dev_extent_length, struct btrfs_dev_extent, length, 64); +BTRFS_SETGET_STACK_FUNCS(stack_dev_extent_chunk_tree, struct btrfs_dev_extent, + chunk_tree,64 ); +BTRFS_SETGET_STACK_FUNCS (stack_dev_extent_chunk_objectid, + struct btrfs_dev_extent, chunk_objectid, 64); +BTRFS_SETGET_STACK_FUNCS(stack_dev_extent_chunk_offset, struct btrfs_dev_extent, + chunk_offset,64 ); BTRFS_SETGET_STACK_FUNCS(stack_dev_extent_length, struct btrfs_dev_extent, length,64 );
image/main.c +129 -0
141 lines not on this page · raw message
Signature · 1 line
2.18.0