diff options
author | Christoph Hellwig <hch@lst.de> | 2023-05-24 17:03:17 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-06-19 13:59:33 +0200 |
commit | f000bc6fe43ce66c55fa1691000115b14ba95b33 (patch) | |
tree | 4840c87e4fb29c9315a4dfc787ec529d9d02c7f0 /fs/btrfs/extent_map.c | |
parent | 71df088c1cc090d232eb691d8f42284a2c6409eb (diff) | |
download | linux-stable-f000bc6fe43ce66c55fa1691000115b14ba95b33.tar.gz linux-stable-f000bc6fe43ce66c55fa1691000115b14ba95b33.tar.bz2 linux-stable-f000bc6fe43ce66c55fa1691000115b14ba95b33.zip |
btrfs: pass the new logical address to split_extent_map
split_extent_map splits off the first chunk of an extent map into a new
one. One of the two users is the zoned I/O completion code that wants to
rewrite the logical block start address right after this split. Pass in
the logical address to be set in the split off first extent_map as an
argument to avoid an extra extent tree lookup for this case.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r-- | fs/btrfs/extent_map.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index e5124461ea02..0cdb3e86f29b 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -963,11 +963,13 @@ int btrfs_replace_extent_map_range(struct btrfs_inode *inode, } /* - * Split off the first pre bytes from the extent_map at [start, start + len] + * Split off the first pre bytes from the extent_map at [start, start + len], + * and set the block_start for it to new_logical. * * This function is used when an ordered_extent needs to be split. */ -int split_extent_map(struct btrfs_inode *inode, u64 start, u64 len, u64 pre) +int split_extent_map(struct btrfs_inode *inode, u64 start, u64 len, u64 pre, + u64 new_logical) { struct extent_map_tree *em_tree = &inode->extent_tree; struct extent_map *em; @@ -1010,7 +1012,7 @@ int split_extent_map(struct btrfs_inode *inode, u64 start, u64 len, u64 pre) split_pre->start = em->start; split_pre->len = pre; split_pre->orig_start = split_pre->start; - split_pre->block_start = em->block_start; + split_pre->block_start = new_logical; split_pre->block_len = split_pre->len; split_pre->orig_block_len = split_pre->block_len; split_pre->ram_bytes = split_pre->len; |