diff options
author | Qu Wenruo <wqu@suse.com> | 2024-04-03 10:30:06 +1030 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-05-07 21:31:08 +0200 |
commit | e98bf64f7aaca09d5e6780f60ca79fda3003aecb (patch) | |
tree | 2dfb4e5505aa7ba8dc7ab00f40e3013858902fa0 /fs/btrfs/ordered-data.c | |
parent | 4bdc558bf906ce4e3e33cb33a9368383a22e2151 (diff) | |
download | linux-e98bf64f7aaca09d5e6780f60ca79fda3003aecb.tar.gz linux-e98bf64f7aaca09d5e6780f60ca79fda3003aecb.tar.bz2 linux-e98bf64f7aaca09d5e6780f60ca79fda3003aecb.zip |
btrfs: add extra sanity checks for create_io_em()
The function create_io_em() is called before we submit an IO, to update
the in-memory extent map for the involved range.
This patch changes the following aspects:
- Does not allow BTRFS_ORDERED_NOCOW type
For real NOCOW (excluding NOCOW writes into preallocated ranges)
writes, we never call create_io_em(), as we does not need to update
the extent map at all.
So remove the sanity check allowing BTRFS_ORDERED_NOCOW type.
- Add extra sanity checks
* PREALLOC
- @block_len == len
For uncompressed writes.
* REGULAR
- @block_len == @orig_block_len == @ram_bytes == @len
We're creating a new uncompressed extent, and referring all of it.
- @orig_start == @start
We haven no offset inside the extent.
* COMPRESSED
- valid @compress_type
- @len <= @ram_bytes
This is to co-operate with encoded writes, which can cause a new
file extent referring only part of a uncompressed extent.
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/ordered-data.c')
0 files changed, 0 insertions, 0 deletions