mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 04:23:35 +02:00
btrfs: cache max and min order inside btrfs_fs_info
Inside btrfs_fs_info we cache several bits shift like sectorsize_bits. Apply this to max and min folio orders so that every time mapping order needs to be applied we can skip the calculation. 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:
parent
7425a28940
commit
ea77a1c1c7
|
|
@ -532,9 +532,9 @@ static inline void btrfs_set_inode_mapping_order(struct btrfs_inode *inode)
|
|||
|
||||
/* We only allow BITS_PER_LONGS blocks for each bitmap. */
|
||||
#ifdef CONFIG_BTRFS_EXPERIMENTAL
|
||||
mapping_set_folio_order_range(inode->vfs_inode.i_mapping, 0,
|
||||
ilog2(((BITS_PER_LONG << inode->root->fs_info->sectorsize_bits)
|
||||
>> PAGE_SHIFT)));
|
||||
mapping_set_folio_order_range(inode->vfs_inode.i_mapping,
|
||||
inode->root->fs_info->block_min_order,
|
||||
inode->root->fs_info->block_max_order);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3383,6 +3383,8 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
|
|||
fs_info->nodesize_bits = ilog2(nodesize);
|
||||
fs_info->sectorsize = sectorsize;
|
||||
fs_info->sectorsize_bits = ilog2(sectorsize);
|
||||
fs_info->block_min_order = ilog2(round_up(sectorsize, PAGE_SIZE) >> PAGE_SHIFT);
|
||||
fs_info->block_max_order = ilog2((BITS_PER_LONG << fs_info->sectorsize_bits) >> PAGE_SHIFT);
|
||||
fs_info->csums_per_leaf = BTRFS_MAX_ITEM_SIZE(fs_info) / fs_info->csum_size;
|
||||
fs_info->stripesize = stripesize;
|
||||
fs_info->fs_devices->fs_info = fs_info;
|
||||
|
|
|
|||
|
|
@ -825,6 +825,8 @@ struct btrfs_fs_info {
|
|||
u32 sectorsize;
|
||||
/* ilog2 of sectorsize, use to avoid 64bit division */
|
||||
u32 sectorsize_bits;
|
||||
u32 block_min_order;
|
||||
u32 block_max_order;
|
||||
u32 csum_size;
|
||||
u32 csums_per_leaf;
|
||||
u32 stripesize;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user