Skip to content

Commit

Permalink
btrfs: don't split NOCOW extent_maps in btrfs_extract_ordered_extent
Browse files Browse the repository at this point in the history
NOCOW writes just overwrite an existing extent map, which thus should
not be split in btrfs_extract_ordered_extent.  The NOCOW case can't
currently happen as btrfs_extract_ordered_extent is only used on zoned
devices that do not support NOCOW writes, but this will change soon.

Reviewed-by: Josef Bacik <[email protected]>
Tested-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Boris Burkov <[email protected]>
[ hch: split from a larger patch, wrote a commit log ]
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
boryas authored and kdave committed Apr 17, 2023
1 parent 7edd339 commit f0f5329
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2621,6 +2621,14 @@ int btrfs_extract_ordered_extent(struct btrfs_bio *bbio,
ret = btrfs_split_ordered_extent(ordered, len);
if (ret)
return ret;

/*
* Don't split the extent_map for NOCOW extents, as we're writing into
* a pre-existing one.
*/
if (test_bit(BTRFS_ORDERED_NOCOW, &ordered->flags))
return 0;

return split_extent_map(inode, bbio->file_offset, ordered_len, len);
}

Expand Down

0 comments on commit f0f5329

Please sign in to comment.