On 12/19/2018 11:41 PM, devzero@xxxxxx wrote:
does compress-force really force compression?
for me (found via compsize - see https://github.com/kilobyte/compsize/issues/24 ) it looks it is problably forcing compression check for every block of a file (while compress= makes btrfs skip compression check after first block) and if some block is incompressible, apparently it's being stored uncompressed.
so, the documentation is probably telling misleading information and should be fixed!?
A slight correction is needed to the documentation..
The difference between the -o compress and -o compress-force is that
the latter tries to compress every extent of the file (that is it never
gives-up), whereas the former gives up (on an inode) at the first
non-compressible extent. In both the cases compressed-extents are saved
only if there is a space benefit otherwise it shall write the regular
(uncompressed) extent.
HTH
roland
https://btrfs.wiki.kernel.org/index.php/Compression#What_happens_to_incompressible_files.3F
What happens to incompressible files?
There is a simple decision logic: if the first portion of data being compressed is not smaller than the original, the compression of the file is disabled -- unless the filesystem is mounted with -o compress-force. In that case it'll be compressed always regardless of the compressibility of the file. This is not optimal and subject to optimizations and further development.