linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Goldwyn Rodrigues <rgoldwyn@suse.de>
To: linux-btrfs@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, hch@infradead.org,
	darrick.wong@oracle.com, Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: [PATCH 5/7] btrfs: Use iomap_dio_ops.submit_io()
Date: Fri, 15 Nov 2019 10:16:58 -0600	[thread overview]
Message-ID: <20191115161700.12305-6-rgoldwyn@suse.de> (raw)
In-Reply-To: <20191115161700.12305-1-rgoldwyn@suse.de>

From: Goldwyn Rodrigues <rgoldwyn@suse.com>

Use iomap_dio_ops.submit_io() to submit the bio for btrfs.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 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


  parent reply	other threads:[~2019-11-15 16:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15 16:16 btrfs direct-io using iomap Goldwyn Rodrigues
2019-11-15 16:16 ` [PATCH 1/7] fs: Export generic_file_buffered_read() Goldwyn Rodrigues
2019-11-15 16:16 ` [PATCH 2/7] btrfs: basic direct I/O read operation Goldwyn Rodrigues
2019-11-15 16:45   ` Christoph Hellwig
2019-11-15 16:16 ` [PATCH 3/7] iomap: use a function pointer for dio submits Goldwyn Rodrigues
2019-11-15 16:47   ` Christoph Hellwig
2019-11-15 20:11     ` Goldwyn Rodrigues
2019-11-15 16:16 ` [PATCH 4/7] btrfs: Use iomap_dio_rw() for direct I/O Goldwyn Rodrigues
2019-11-15 17:06   ` Christoph Hellwig
2019-11-18 15:54     ` Goldwyn Rodrigues
2019-11-18 16:54   ` Filipe Manana
2019-11-19 17:01     ` Goldwyn Rodrigues
2019-11-19 17:24       ` Darrick J. Wong
2019-11-15 16:16 ` Goldwyn Rodrigues [this message]
2019-11-15 16:47   ` [PATCH 5/7] btrfs: Use iomap_dio_ops.submit_io() Christoph Hellwig
2019-11-15 16:16 ` [PATCH 6/7] btrfs: flush dirty pages on compressed I/O for dio Goldwyn Rodrigues
2019-11-15 16:50   ` Christoph Hellwig
2019-11-15 16:17 ` [PATCH 7/7] btrfs: Wait for extent bits to release page Goldwyn Rodrigues
2019-11-15 16:56   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191115161700.12305-6-rgoldwyn@suse.de \
    --to=rgoldwyn@suse.de \
    --cc=darrick.wong@oracle.com \
    --cc=hch@infradead.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=rgoldwyn@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).