btrfs-progs: corrupt-block: Change -I flag parameter format
commit3fa8b8ca4589967fd0187509f4df8862ad2246ad
authorNikolay Borisov <nborisov@suse.com>
Mon, 14 May 2018 11:13:29 +0000 (14 14:13 +0300)
committerDavid Sterba <dsterba@suse.com>
Thu, 7 Jun 2018 14:37:39 +0000 (7 16:37 +0200)
tree0b2145a797a38bdfc4643a3ad8e4ddc363700430
parent572637b6f95cd9dd7be658ea2d18718d04c4ac17
btrfs-progs: corrupt-block: Change -I flag parameter format

Presently, if we want to corrupt a particular item we need to call
corrupt block like so:

btrfs-corrupt-block -I -K <objectid,type,offset> -r "numeric rootid"

This is problematic because the -K option not only sets the key to the
item that the -I option should corrupt but it also signals that we
want to corrupt the key itself. This way we cannot really use the
program with the following semantics:

"Corrupt only the item which corresponds to this key but leave the
key intact"

This patch aims to fix this by changing the format of the -I flag. So
if one wants to corrupt only an item (and leave the key intact) they
should use:

  btrfs-corrupt-block -r <numeric rootid> -I <objectid,type,offset>

In addition to this problem, -K doesn't really understand the the "-r"
argument, so when using it in conjunction with -I to corrupt an item,
not part of the root tree, it will always produce an error:

  Couldn't find the key to corrupt

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
btrfs-corrupt-block.c