Re: [PATCH 4/8] btrfs: Switch to iomap_dio_rw() for dio

Johannes Thumshirn
2019-12-05T17:18:24Z

On Thu, Dec 05, 2019 at 09:56:26AM -0600, Goldwyn Rodrigues wrote:
[...]
> +static ssize_t btrfs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
> +{
> + ssize_t ret = 0;
> +
> + if (iocb->ki_flags & IOCB_DIRECT) {
> + struct inode *inode = file_inode(iocb->ki_filp);
> +
> + inode_lock_shared(inode);
> + ret = btrfs_direct_IO(iocb, to);
> + inode_unlock_shared(inode);
> + if (ret < 0)
> + return ret;
> + }
> +
> + return generic_file_buffered_read(iocb, to, ret);

This could as well call generic_file_read_iter() and would thus make patch 1
of this series obsolete. I think this is cleaner.

Thanks,
Johannes