diff options
| author | Qu Wenruo <[email protected]> | 2024-04-03 00:00:06 +0000 |
|---|---|---|
| committer | David Sterba <[email protected]> | 2024-05-07 19:31:08 +0000 |
| commit | e98bf64f7aaca09d5e6780f60ca79fda3003aecb (patch) | |
| tree | 2dfb4e5505aa7ba8dc7ab00f40e3013858902fa0 /fs/btrfs/ordered-data.c | |
| parent | btrfs: simplify the inline extent map creation (diff) | |
| download | kernel-e98bf64f7aaca09d5e6780f60ca79fda3003aecb.tar.gz kernel-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 <[email protected]>
Signed-off-by: Qu Wenruo <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/ordered-data.c')
0 files changed, 0 insertions, 0 deletions
