Skip to content

Commit e2877c2

Browse files
committed
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 <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent a1f4e3d commit e2877c2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

fs/btrfs/compression.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ static void heuristic_collect_sample(struct inode *inode, u64 start, u64 end,
15071507
*
15081508
* Return non-zero if the compression should be done, 0 otherwise.
15091509
*/
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)
15111511
{
15121512
struct list_head *ws_list = get_workspace(0, 0);
15131513
struct heuristic_ws *ws;
@@ -1517,7 +1517,7 @@ int btrfs_compress_heuristic(struct inode *inode, u64 start, u64 end)
15171517

15181518
ws = list_entry(ws_list, struct heuristic_ws, list);
15191519

1520-
heuristic_collect_sample(inode, start, end, ws);
1520+
heuristic_collect_sample(&inode->vfs_inode, start, end, ws);
15211521

15221522
if (sample_repeated_patterns(ws)) {
15231523
ret = 1;

fs/btrfs/compression.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ extern const struct btrfs_compress_op btrfs_zstd_compress;
144144
const char* btrfs_compress_type2str(enum btrfs_compression_type type);
145145
bool btrfs_compress_is_valid_type(const char *str, size_t len);
146146

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);
148148

149149
int btrfs_compress_filemap_get_folio(struct address_space *mapping, u64 start,
150150
struct folio **in_folio_ret);

fs/btrfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ static inline int inode_need_compress(struct btrfs_inode *inode, u64 start,
876876
if (btrfs_test_opt(fs_info, COMPRESS) ||
877877
inode->flags & BTRFS_INODE_COMPRESS ||
878878
inode->prop_compress)
879-
return btrfs_compress_heuristic(&inode->vfs_inode, start, end);
879+
return btrfs_compress_heuristic(inode, start, end);
880880
return 0;
881881
}
882882

0 commit comments

Comments
 (0)