diff options
author | Qu Wenruo <wqu@suse.com> | 2025-09-15 18:33:50 +0930 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2025-09-23 08:49:25 +0200 |
commit | e9bed72e883e7c6e6a2057ea29fcd4ba69225f91 (patch) | |
tree | 478543e16f929c49b6b577b931f5ac7ddca01416 /fs/btrfs/dev-replace.c | |
parent | 67378b754608a3524d125bfa5744508a49fe48be (diff) |
btrfs: add extra ASSERT()s to catch unaligned bios
Btrfs uses btrfs_bio to handle read/write of logical address, for the
incoming bs > ps support, btrfs has extra requirements:
- One folio must contain at least one fs block
- No fs block can cross folio boundaries
This requirement is not hard to maintain, thanks to the address space's
minimal folio order.
But not all btrfs bios are generated through address space, e.g.
compression and scrub.
To catch possible unaligned bios, introduce a helper,
assert_bbio_alginment(), for each btrfs_bio in btrfs_submit_bbio().
This will check the following things:
- bv_offset is aligned to block size
- bv_len is aligned to block size
With a btrfs bio passing above checks, unless it's empty it will ensure
the requirements for bs > ps support.
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/dev-replace.c')
0 files changed, 0 insertions, 0 deletions