btrfs-progs/cmds
Li Zhang 7781d1a2da btrfs-progs: props: don't translate value of compression=none
Currently, if user specifies value 'no' or 'none' on the command line,
it gets translated to an empty value that is passed to kernel. There was
a change in kernel 5.14 done by commit 5548c8c6f55b ("btrfs: props:
change how empty value is interpreted") that changes the behaviour
in that case.

The empty value is supposed to mean 'the default value' for any
property. For compression there is a need to distinguish resetting the
value and also setting the NOCOMPRESS property. The translation to empty
value makes that impossible.

The explanation and behaviour copied from the kernel patch:

    Old behaviour:

      $ lsattr file
      ---------------------- file
      # the NOCOMPRESS bit is set
      $ btrfs prop set file compression ''
      $ lsattr file
      ---------------------m file

    This is equivalent to 'btrfs prop set file compression no' in current
    btrfs-progs as the 'no' or 'none' values are translated to an empty
    string.

    This is where the new behaviour is different: empty string drops the
    compression flag (-c) and nocompress (-m):

      $ lsattr file
      ---------------------- file
      # No change
      $ btrfs prop set file compression ''
      $ lsattr file
      ---------------------- file
      $ btrfs prop set file compression lzo
      $ lsattr file
      --------c------------- file
      $ btrfs prop get file compression
      compression=lzo
      $ btrfs prop set file compression ''
      # Reset to the initial state
      $ lsattr file
      ---------------------- file
      # Set NOCOMPRESS bit
      $ btrfs prop set file compression no
      $ lsattr file
      ---------------------m file

    This obviously brings problems with backward compatibility, so this
    patch should not be backported without making sure the updated
    btrfs-progs are also used and that scripts have been updated to use the
    new semantics.

    Summary:

    - old kernel:
      no, none, "" - set NOCOMPRESS bit
    - new kernel:
      no, none - set NOCOMPRESS bit
      "" - drop all compression flags, ie. COMPRESS and NOCOMPRESS

Signed-off-by: Li Zhang <zhanglikernel@gmail.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
2022-04-25 18:30:28 +02:00
..
balance.c btrfs-progs: factor out profile parsing to common utils 2021-09-07 13:58:44 +02:00
commands.h btrfs-progs: split subvolume list to its own file 2021-10-08 20:47:03 +02:00
device.c btrfs-progs: fix a bunch of typos 2022-02-01 18:40:53 +01:00
filesystem-du.c btrfs-progs: fi du: skip inaccessible files 2021-11-30 18:40:18 +01:00
filesystem-usage.c btrfs-progs: fi usage: fix calculation of chunk size for RAID1/DUP profiles 2021-11-18 10:17:33 +01:00
filesystem-usage.h btrfs-progs: move all cmds-fi*.c to cmds/ 2019-07-03 20:49:03 +02:00
filesystem.c btrfs-progs: fix a bunch of typos 2022-02-01 18:40:53 +01:00
inspect-dump-super.c btrfs-progs: remove temporary buffer for super block 2021-11-05 12:50:03 +01:00
inspect-dump-tree.c btrfs-progs: add print support for the block group tree 2022-03-09 18:06:54 +01:00
inspect-tree-stats.c btrfs-progs: change btrfs_file_extent_inline_item_len to take a slot 2022-03-09 15:13:13 +01:00
inspect.c btrfs-progs: use btrfs_subvolid_resolve instead of btrfs_list_path_for_root 2021-10-08 20:47:03 +02:00
property.c btrfs-progs: props: don't translate value of compression=none 2022-04-25 18:30:28 +02:00
props.h btrfs-progs: prop set: add force parameter 2021-10-07 18:40:24 +02:00
qgroup.c btrfs-progs: move all private definitions to cmds/qgroup.c 2021-09-07 19:21:14 +02:00
qgroup.h btrfs-progs: move all private definitions to cmds/qgroup.c 2021-09-07 19:21:14 +02:00
quota.c btrfs-progs: split open/close helpers from utils.c 2021-05-06 16:41:47 +02:00
receive-dump.c btrfs-progs: fix 64-bit mips and powerpc types 2022-02-16 22:44:58 +01:00
receive-dump.h btrfs-progs: unify GPL header comments 2021-09-07 13:58:44 +02:00
receive.c btrfs-progs: receive: properly check ERR return value in process_snapshot 2022-01-03 15:55:35 +01:00
replace.c btrfs-progs: replace start: add option -K/--nodiscard 2021-10-06 16:49:35 +02:00
rescue-chunk-recover.c btrfs-progs: remove the _nr from the item helpers 2022-03-09 15:13:13 +01:00
rescue-super-recover.c btrfs-progs: remove temporary buffer for super block 2021-11-05 12:50:03 +01:00
rescue.c btrfs-progs: rescue: introduce clear-uuid-tree 2021-11-22 21:45:37 +01:00
rescue.h btrfs-progs: unify GPL header comments 2021-09-07 13:58:44 +02:00
restore.c btrfs-progs: remove the _nr from the item helpers 2022-03-09 15:13:13 +01:00
scrub.c btrfs-progs: split unit related helpers from utils.c 2021-05-06 16:41:47 +02:00
send.c btrfs-progs: send: properly handle an ERR_PTR in find_good_parent 2022-01-11 17:36:15 +01:00
subvolume-list.c btrfs-progs: subvol list: open code list_subvol_fill_paths in its caller 2021-10-08 20:47:04 +02:00
subvolume.c btrfs-progs: subvolume snapshot: added clarity how snapshot path is interprted 2022-02-16 22:48:01 +01:00