mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 13:16:22 +00:00
btrfs: do not reset extent map members for inline extents read
Currently for inline extents read inside btrfs_get_extent(), we will reset several extent map members: - em->start Reset to extent_start, which is completely unnecessary. The extent_start and em->start should have already be zero, ensured by tree-checker already. - em->len Reset the round_up(copy_size, fs_info->sectorsize), which is again unnecessary. - em->orig_block_len Reset to em->len (sectorsize), while it is originally unset from btrfs_extent_item_to_extent_map(). This makes no difference, as all extent map handling paths will ignore the orig_block_len if they found it's an inlined extent. Such inline extent orig_block_len ignoring examples can be found in btrfs_drop_extent_cache(). - em->orig_start Reset to em->start (0), while it is originally set to EXTENT_MAP_HOLE. This makes no difference either, as all extent map handling paths will ignore the em->orig_start if they found it's an inline extent. Thus all these em members resetting are unnecessary. Replace them with ASSERT()s checking the only two members (block_start and length) that make sense. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
affc542433
commit
a196a8944f
@ -7082,10 +7082,15 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
|
||||
|
||||
copy_size = min_t(u64, PAGE_SIZE,
|
||||
btrfs_file_extent_ram_bytes(leaf, item));
|
||||
em->start = extent_start;
|
||||
em->len = ALIGN(copy_size, fs_info->sectorsize);
|
||||
em->orig_block_len = em->len;
|
||||
em->orig_start = em->start;
|
||||
|
||||
/*
|
||||
* btrfs_extent_item_to_extent_map() should have properly
|
||||
* initialized em members already.
|
||||
*
|
||||
* Other members are not utilized for inline extents.
|
||||
*/
|
||||
ASSERT(em->block_start == EXTENT_MAP_INLINE);
|
||||
ASSERT(em->len = fs_info->sectorsize);
|
||||
|
||||
if (!PageUptodate(page)) {
|
||||
if (btrfs_file_extent_compression(leaf, item) !=
|
||||
|
Loading…
Reference in New Issue
Block a user