Skip to content

btrfs-progs: add check and repair ability for shrunk device item

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs-progs: check: verify the underlying block device size is validcheck/main.c check/mode-lowmem.c+50 -00 replies
2/3btrfs-progs: fsck-tests: add test case for shrunk devicetests/fsck-tests/059-shrinked-device/test.sh+32 -00 replies
3/3btrfs-progs: rescue: allow fix-device-size to shrink device itemkernel-shared/volumes.c+126 -90 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] btrfs-progs: add check and repair ability for shrunk device item

There is a bug report that, a btrfs with shrunk underlying device will be rejected by kernel, but btrfs-check will report nothing wrong.

Furthermore for such case, even if there is no dev extent in the shrunk range, we have no way to fix it.
Kernel will refuse to mount, thus no way to shrink the device using "btrfs dev resize".

This patch will:

- Add check ability to report such mismatch

- Add rescue ability to reset the total_bytes in dev items This can only be done if there is no dev extent in the shrunk range.

- Add a test case for above behavior

Qu Wenruo (3):
btrfs-progs: check: verify the underlying block device size is valid
btrfs-progs: fsck-tests: add test case for shrunk device
btrfs-progs: rescue: allow fix-device-size to shrink device item

 check/main.c                                 |  28 ++++
 check/mode-lowmem.c                          |  22 +++
 kernel-shared/volumes.c                      | 135 +++++++++++++++++--
 tests/fsck-tests/059-shrinked-device/test.sh |  32 +++++
 4 files changed, 208 insertions(+), 9 deletions(-)
 create mode 100755 tests/fsck-tests/059-shrinked-device/test.sh
Signature · 1 line
2.37.2