]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: allow defrag compress to override NOCOMPRESS attribute
authorDavid Sterba <dsterba@suse.com>
Mon, 17 Jul 2017 18:42:03 +0000 (20:42 +0200)
committerDavid Sterba <dsterba@suse.com>
Wed, 16 Aug 2017 14:12:05 +0000 (16:12 +0200)
commit837da405439335d88ed379c8f7dbc80968945781
tree822cd9df5f63df214b7fbbf32fe2333fbf2c1c6b
parentcc3d0f89110b806fdab3f76202c965d3a3d0b9a9
btrfs: allow defrag compress to override NOCOMPRESS attribute

Currently, the BTRFS_INODE_NOCOMPRESS will prevent any compression on a
given file, except when the mount is force-compress. As users have
reported on IRC, this will also prevent compression when requested by
defrag (btrfs fi defrag -c file).

The nocompress flag is set automatically by filesystem when the ratios
are bad and the user would have to manually drop the bit in order to
make defrag -c work. This is not good from the usability perspective.

This patch will raise priority for the defrag -c over nocompress, ie.
any file with NOCOMPRESS bit set will get defragmented. The bit will
remain untouched.

Alternate option was to also drop the nocompress bit and keep the
decision logic as is, but I think this is not the right solution.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c