btrfs: push all inline logic into cow_file_range
authorJosef Bacik <josef@toxicpanda.com>
Wed, 20 Mar 2024 20:40:51 +0000 (16:40 -0400)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 May 2024 19:31:09 +0000 (21:31 +0200)
commit6eecfa22403e2c322a91f7654ade7f126adc55c2
tree469a31eff146906ab83bbf833aa79834b321e795
parentaa5ccf29173acfaa8aa2fdd1421aa6aca1a50cf2
btrfs: push all inline logic into cow_file_range

Currently we have a lot of duplicated checks of

if (start == 0 && fs_info->sectorsize == PAGE_SIZE)
cow_file_range_inline();

Instead of duplicating this check everywhere, consolidate all of the
inline extent logic into a helper which documents all of the checks and
then use that helper inside of cow_file_range_inline().  With this we
can clean up all of the calls to either unconditionally call
cow_file_range_inline(), or at least reduce the checks we're doing
before we call cow_file_range_inline();

Reviewed-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c