Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

btrfs: pass a btrfs_inode to btrfs_compress_heuristic()

Pass a struct btrfs_inode to btrfs_compress_heuristic() as it's an
internal interface, allowing to remove some use of BTRFS_I.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>

+4 -4
+2 -2
fs/btrfs/compression.c
··· 1507 1507 * 1508 1508 * Return non-zero if the compression should be done, 0 otherwise. 1509 1509 */ 1510 - int btrfs_compress_heuristic(struct inode *inode, u64 start, u64 end) 1510 + int btrfs_compress_heuristic(struct btrfs_inode *inode, u64 start, u64 end) 1511 1511 { 1512 1512 struct list_head *ws_list = get_workspace(0, 0); 1513 1513 struct heuristic_ws *ws; ··· 1517 1517 1518 1518 ws = list_entry(ws_list, struct heuristic_ws, list); 1519 1519 1520 - heuristic_collect_sample(inode, start, end, ws); 1520 + heuristic_collect_sample(&inode->vfs_inode, start, end, ws); 1521 1521 1522 1522 if (sample_repeated_patterns(ws)) { 1523 1523 ret = 1;
+1 -1
fs/btrfs/compression.h
··· 144 144 const char* btrfs_compress_type2str(enum btrfs_compression_type type); 145 145 bool btrfs_compress_is_valid_type(const char *str, size_t len); 146 146 147 - int btrfs_compress_heuristic(struct inode *inode, u64 start, u64 end); 147 + int btrfs_compress_heuristic(struct btrfs_inode *inode, u64 start, u64 end); 148 148 149 149 int btrfs_compress_filemap_get_folio(struct address_space *mapping, u64 start, 150 150 struct folio **in_folio_ret);
+1 -1
fs/btrfs/inode.c
··· 876 876 if (btrfs_test_opt(fs_info, COMPRESS) || 877 877 inode->flags & BTRFS_INODE_COMPRESS || 878 878 inode->prop_compress) 879 - return btrfs_compress_heuristic(&inode->vfs_inode, start, end); 879 + return btrfs_compress_heuristic(inode, start, end); 880 880 return 0; 881 881 } 882 882