Skip to content

btrfs-progs: Introduce --extra-dev option

Zhao Lei linux-btrfs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5btrfs-progs: Introduce --extra-dev optionutils.c utils.h+75 -00 replies
2/5btrfs-progs: Support extra-dev for btrfs rescuecmds-rescue.c+18 -60 replies
3/5btrfs-progs: Avoid using uninitialized optind in cmd_rescue_zero_logcmds-rescue.c+1 -10 replies
4/5btrfs-progs: add help command to btrfs rescue zero-logcmds-rescue.c+15 -20 replies
5/5btrfs-progs: update manual for --extra-dev and -h for btrfs rescueDocumentation/btrfs-rescue.asciidoc+12 -10 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/5] btrfs-progs: Introduce --extra-dev option

Some command in current tools can't support filesystem with multiple loop device, for example:

 # truncate -s 200M ./1.img
 # truncate -s 200M ./2.img
 # mkfs.btrfs -f ./1.img ./2.img
 #
 # btrfs rescue chunk-recover -v ./1.img
 All Devices:
        Device: id = 1, name = ./1.img
 ...
 # btrfs rescue super-recover -v ./1.img
 All Devices:
        Device: id = 1, name = ./1.img
 ...
 # btrfs rescue zero-log ./1.img
 warning devid 2 not found already
 Clearing log on ./1.img, previous log_root 0, level 0
 ...

As a workaround, we can bind all of above image files to loop device, but to make things simple, this patch introduce --extra-dev option, to specify non-block-device manually, as:

 # btrfs rescue chunk-recover -v --extra-device=./2.img ./1.img
 All Devices:
        Device: id = 2, name = ./2.img
        Device: id = 1, name = ./1.img
 ...
 # btrfs rescue super-recover --extra-dev=./2.img -v ./1.img
 All Devices:
        Device: id = 2, name = ./2.img
        Device: id = 1, name = ./1.img
 ...
 # btrfs rescue zero-log --extra-dev=./2.img ./1.img
 Clearing log on ./1.img, previous log_root 0, level 0

We can add multiple extra-dev by:
--extra-dev="1.img,2.img"
or
--extra-dev=1.img --extra-dev=2.img

Zhao Lei (5):
btrfs-progs: Introduce --extra-dev option
btrfs-progs: Support extra-dev for btrfs rescue
btrfs-progs: Avoid using uninitialized optind in cmd_rescue_zero_log
btrfs-progs: add help command to btrfs rescue zero-log
btrfs-progs: update manual for --extra-dev and -h for btrfs rescue

 Documentation/btrfs-rescue.asciidoc | 13 ++++++-
 cmds-rescue.c                       | 39 +++++++++++++++++----
 utils.c                             | 70 +++++++++++++++++++++++++++++++++++++
 utils.h                             |  5 +++
 4 files changed, 119 insertions(+), 8 deletions(-)
Signature · 1 line
1.8.5.1