consolidate btrfs checksumming, repair and bio splitting

Christoph Hellwig
2022-09-01T07:42:31Z

Hi all,

this series moves a large amount of duplicate code below btrfs_submit_bio
into what I call the 'storage' layer. Instead of duplicating code to
checksum, check checksums and repair and split bios in all the caller
of btrfs_submit_bio (buffered I/O, direct I/O, compressed I/O, encoded
I/O), the work is done one in a central place, often more optiomal and
without slight changes in behavior. Once that is done the upper layers
also don't need to split the bios for extent boundaries, as the storage
layer can do that itself, including splitting the bios for the zone
append limits for zoned I/O.

The split work is inspired by an earlier series from Qu, from which it
also reuses a few patches.

Note: this adds a fair amount of code to volumes.c, which already is
quite large. It might make sense to add a prep patch to move
btrfs_submit_bio into a new bio.c file, but I only want to do that
if we have agreement on the move as the conflicts will be painful
when rebasing.

A git tree is also available:

git://git.infradead.org/users/hch/misc.git btrfs-bio-split

Gitweb:

http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/btrfs-bio-split

Diffstat:
block/blk-merge.c | 3
fs/btrfs/btrfs_inode.h | 5
fs/btrfs/compression.c | 273 ++------------
fs/btrfs/compression.h | 3
fs/btrfs/ctree.h | 24 -
fs/btrfs/disk-io.c | 198 +---------
fs/btrfs/disk-io.h | 6
fs/btrfs/extent-io-tree.h | 19
fs/btrfs/extent_io.c | 739 ++------------------------------------
fs/btrfs/extent_io.h | 32 -
fs/btrfs/file-item.c | 67 +--
fs/btrfs/inode.c | 664 ++++------------------------------
fs/btrfs/ordered-data.h | 1
fs/btrfs/tests/extent-io-tests.c | 1
fs/btrfs/volumes.c | 753 +++++++++++++++++++++++++++++++--------
fs/btrfs/volumes.h | 83 +---
fs/btrfs/zoned.c | 69 +--
fs/btrfs/zoned.h | 16
fs/iomap/direct-io.c | 10
include/linux/bio.h | 4
include/linux/iomap.h | 1
include/trace/events/btrfs.h | 2
22 files changed, 924 insertions(+), 2049 deletions(-)