]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: enable direct IO for bs > ps cases
authorQu Wenruo <wqu@suse.com>
Sun, 7 Dec 2025 21:13:58 +0000 (07:43 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 05:38:32 +0000 (06:38 +0100)
commitddea91780fecd349eb4b2c4036bfbf1ab5f75321
tree7ccd5c18fbb6561c48923f798625bc7861ca0bef
parentfe11ac191ce0ad910f6fda0c628bcff19fcff47d
btrfs: enable direct IO for bs > ps cases

Previously direct IO was disabled if the fs block size was larger than
the page size, the reasons are:

- Iomap direct IO can split the range ignoring the fs block alignment
  Which could trigger the bio size check from btrfs_submit_bio().

- The buffer is only ensured to be contiguous in user space memory
  The underlying physical memory is not ensured to be contiguous, and
  that can cause problems for the checksum generation/verification and
  RAID56 handling.

However the above problems are solved by the following upstream commits:

001397f5ef49 ("iomap: add IOMAP_DIO_FSBLOCK_ALIGNED flag")
  Which added an extra flag that can be utilized by the fs to ensure
  the bio submitted by iomap is always aligned to fs block size.

ec20799064c8 ("btrfs: enable encoded read/write/send for bs > ps cases")
8870dbeedcf9 ("btrfs: raid56: enable bs > ps support")
  Which makes btrfs to handle bios that are not backed by large folios
  but still are aligned to fs block size.

As the commits have been merged we can enable direct IO support for
bs > ps cases.

Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/direct-io.c