From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> Use iomap_dio_ops.submit_io() to submit the bio for btrfs. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> --- fs/btrfs/inode.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e2e4dfb7a568..8e55b0d343bd 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8471,7 +8471,7 @@ static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip) return 0; } -static void btrfs_submit_direct(struct bio *dio_bio, struct inode *inode, +static blk_qc_t btrfs_submit_direct(struct bio *dio_bio, struct inode *inode, loff_t file_offset) { struct btrfs_dio_private *dip = NULL; @@ -8524,7 +8524,7 @@ static void btrfs_submit_direct(struct bio *dio_bio, struct inode *inode, ret = btrfs_submit_direct_hook(dip); if (!ret) - return; + return BLK_QC_T_NONE; btrfs_io_bio_free_csum(io_bio); @@ -8567,6 +8567,7 @@ static void btrfs_submit_direct(struct bio *dio_bio, struct inode *inode, if (bio) bio_put(bio); kfree(dip); + return BLK_QC_T_NONE; } static ssize_t check_direct_IO(struct btrfs_fs_info *fs_info, @@ -8606,6 +8607,10 @@ static const struct iomap_ops dio_iomap_ops = { .iomap_begin = direct_iomap_begin, }; +static struct iomap_dio_ops btrfs_dops = { + .submit_io = btrfs_submit_direct, +}; + ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) { struct file *file = iocb->ki_filp; @@ -8665,7 +8670,8 @@ ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) flags = DIO_LOCKING | DIO_SKIP_HOLES; } - ret = iomap_dio_rw(iocb, iter, &dio_iomap_ops, NULL, is_sync_kiocb(iocb)); + ret = iomap_dio_rw(iocb, iter, &dio_iomap_ops, &btrfs_dops, + is_sync_kiocb(iocb)); if (iov_iter_rw(iter) == WRITE) { up_read(&BTRFS_I(inode)->dio_sem); -- 2.16.4