On 5.12.19 г. 17:56 ч., Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> > > Switch from __blockdev_direct_IO() to iomap_dio_rw(). > Rename btrfs_get_blocks_direct() to btrfs_dio_iomap_begin() and use it > as iomap_begin() for iomap direct I/O functions. This function > allocates and locks all the blocks required for the I/O. > btrfs_submit_direct() is used as the submit_io() hook for direct I/O > ops. > > Since we need direct I/O reads to go through iomap_dio_rw(), we change > file_operations.read_iter() to a btrfs_file_read_iter() which calls > btrfs_direct_IO() for direct reads and falls back to > generic_file_buffered_read() for incomplete reads and buffered reads. > > We don't need address_space.direct_IO() anymore so set it to noop. > Similarly, we don't need flags used in __blockdev_direct_IO(). iomap is > capable of direct I/O reads from a hole, so we don't need to return > -ENOENT. IMO it will be good to document in the changelog the lock context of the current scheme. E.g. it's done with inode lock held shared meaning it allows other DIO reads but not writes/truncates. (This is different than what we had up until now). <nit>