diff options
author | Qu Wenruo <wqu@suse.com> | 2024-04-30 07:53:06 +0930 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-07-11 15:33:21 +0200 |
commit | c77a8c61002e91d859e118008fd495efbe1d9373 (patch) | |
tree | bdea6b735810f7e578aa2c34c54bd0adce08a25d /fs/btrfs/file-item.c | |
parent | e28b851ed9b232c3b84cb8d0fedbdfa8ca881386 (diff) |
btrfs: remove extent_map::block_start member
The member extent_map::block_start can be calculated from
extent_map::disk_bytenr + extent_map::offset for regular extents.
And otherwise just extent_map::disk_bytenr.
And this is already validated by the validate_extent_map(). Now we can
remove the member.
However there is a special case in btrfs_create_dio_extent() where we
for NOCOW/PREALLOC ordered extents cannot directly use the resulting
btrfs_file_extent, as btrfs_split_ordered_extent() cannot handle them
yet.
So for that call site, we pass file_extent->disk_bytenr +
file_extent->num_bytes as disk_bytenr for the ordered extent, and 0 for
offset.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/file-item.c')
-rw-r--r-- | fs/btrfs/file-item.c | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 397df6588ce2..55703c833f3d 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -1295,7 +1295,6 @@ void btrfs_extent_item_to_extent_map(struct btrfs_inode *inode, em->len = btrfs_file_extent_end(path) - extent_start; bytenr = btrfs_file_extent_disk_bytenr(leaf, fi); if (bytenr == 0) { - em->block_start = EXTENT_MAP_HOLE; em->disk_bytenr = EXTENT_MAP_HOLE; em->disk_num_bytes = 0; em->offset = 0; @@ -1306,10 +1305,8 @@ void btrfs_extent_item_to_extent_map(struct btrfs_inode *inode, em->offset = btrfs_file_extent_offset(leaf, fi); if (compress_type != BTRFS_COMPRESS_NONE) { extent_map_set_compression(em, compress_type); - em->block_start = bytenr; } else { bytenr += btrfs_file_extent_offset(leaf, fi); - em->block_start = bytenr; if (type == BTRFS_FILE_EXTENT_PREALLOC) em->flags |= EXTENT_FLAG_PREALLOC; } @@ -1317,7 +1314,6 @@ void btrfs_extent_item_to_extent_map(struct btrfs_inode *inode, /* Tree-checker has ensured this. */ ASSERT(extent_start == 0); - em->block_start = EXTENT_MAP_INLINE; em->disk_bytenr = EXTENT_MAP_INLINE; em->start = 0; em->len = fs_info->sectorsize; |