mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:09:29 +02:00
btrfs: open code BTRFS_BYTES_TO_BLKS()
That macro is only utilized 4 times, all inside file.c, while we have tons of open-coded usages. And since it's a macro, there is no proper type checks at all. There isn't much need for such a rarely utilized macro. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
+4
-4
@@ -2661,8 +2661,8 @@ static int btrfs_punch_hole(struct file *file, loff_t offset, loff_t len)
|
||||
|
||||
lockstart = round_up(offset, fs_info->sectorsize);
|
||||
lockend = round_down(offset + len, fs_info->sectorsize) - 1;
|
||||
same_block = (BTRFS_BYTES_TO_BLKS(fs_info, offset))
|
||||
== (BTRFS_BYTES_TO_BLKS(fs_info, offset + len - 1));
|
||||
same_block = (offset >> fs_info->sectorsize_bits) ==
|
||||
((offset + len - 1) >> fs_info->sectorsize_bits);
|
||||
/*
|
||||
* Only do this if we are in the same block and we aren't doing the
|
||||
* entire block.
|
||||
@@ -2945,8 +2945,8 @@ static int btrfs_zero_range(struct inode *inode,
|
||||
}
|
||||
btrfs_free_extent_map(em);
|
||||
|
||||
if (BTRFS_BYTES_TO_BLKS(fs_info, offset) ==
|
||||
BTRFS_BYTES_TO_BLKS(fs_info, offset + len - 1)) {
|
||||
if ((offset >> fs_info->sectorsize_bits) ==
|
||||
((offset + len - 1) >> fs_info->sectorsize_bits)) {
|
||||
em = btrfs_get_extent(BTRFS_I(inode), NULL, alloc_start, sectorsize);
|
||||
if (IS_ERR(em)) {
|
||||
ret = PTR_ERR(em);
|
||||
|
||||
@@ -1060,8 +1060,6 @@ static inline u64 btrfs_calc_metadata_size(const struct btrfs_fs_info *fs_info,
|
||||
#define BTRFS_MAX_EXTENT_ITEM_SIZE(r) ((BTRFS_LEAF_DATA_SIZE(r->fs_info) >> 4) - \
|
||||
sizeof(struct btrfs_item))
|
||||
|
||||
#define BTRFS_BYTES_TO_BLKS(fs_info, bytes) ((bytes) >> (fs_info)->sectorsize_bits)
|
||||
|
||||
static inline bool btrfs_is_zoned(const struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
return IS_ENABLED(CONFIG_BLK_DEV_ZONED) && fs_info->zone_size > 0;
|
||||
|
||||
Reference in New Issue
Block a user