On Tue, Mar 10, 2020 at 05:38:35PM +0100, Christoph Hellwig wrote: > On Mon, Mar 09, 2020 at 02:32:38PM -0700, Omar Sandoval wrote: > > 1. The bio created by the generic direct I/O code (dio_bio). > > 2. A clone of dio_bio we create in btrfs_submit_direct() to represent > > the entire direct I/O range (orig_bio). > > 3. A partial clone of orig_bio limited to the size of a RAID stripe that > > we create in btrfs_submit_direct_hook(). > > 4. Clones of each of those split bios for each RAID stripe that we > > create in btrfs_map_bio(). > > Just curious: what is number 3 useful for? The next thing we do with bio 2 (which has a logical block address) is to map it to physical block addresses on each device (btrfs_map_bio()). That mapping is per-stripe, so we either have to avoid building bios that cross a stripe (which is what buffered I/O does) or we have to split up the bio (which is what direct I/O does). We probably want to move towards the first approach for direct I/O, as well, but reworking get_blocks would conflict with the iomap series, and it looks like that would be easier to do using iomap instead, anyways.
