diff options
author | Daniel Vacek <neelx@suse.com> | 2025-03-06 16:15:35 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2025-03-18 22:35:50 +0300 |
commit | fc5c0c5825874859069ac44c367c724acd7190fb (patch) | |
tree | 3b3e5fb0a15f714baa7ff7a786c56ee2d3861be1 /fs/btrfs/inode.c | |
parent | 08f340767dde5fd302af5b94ce6ce2d5e38a233d (diff) | |
download | linux-fc5c0c5825874859069ac44c367c724acd7190fb.tar.xz |
btrfs: defrag: extend ioctl to accept compression levels
The zstd and zlib compression types support setting compression levels.
Enhance the defrag interface to specify the levels as well. For zstd the
negative (realtime) levels are also accepted.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Daniel Vacek <neelx@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 84a6f764f28b..3a8e0858803c 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -877,6 +877,7 @@ static void compress_file_range(struct btrfs_work *work) unsigned int poff; int i; int compress_type = fs_info->compress_type; + int compress_level = fs_info->compress_level; inode_should_defrag(inode, start, end, end - start + 1, SZ_16K); @@ -959,13 +960,15 @@ again: goto cleanup_and_bail_uncompressed; } - if (inode->defrag_compress) + if (inode->defrag_compress) { compress_type = inode->defrag_compress; - else if (inode->prop_compress) + compress_level = inode->defrag_compress_level; + } else if (inode->prop_compress) { compress_type = inode->prop_compress; + } /* Compression level is applied here. */ - ret = btrfs_compress_folios(compress_type, fs_info->compress_level, + ret = btrfs_compress_folios(compress_type, compress_level, mapping, start, folios, &nr_folios, &total_in, &total_compressed); if (ret) |