linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	"Darrick J. Wong" <djwong@kernel.org>
Cc: linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH 2/5] iomap: add per-iomap_iter private data
Date: Wed,  4 May 2022 09:23:39 -0700	[thread overview]
Message-ID: <20220504162342.573651-3-hch@lst.de> (raw)
In-Reply-To: <20220504162342.573651-1-hch@lst.de>

Allow the file system to keep state for all iterations.  For now only
wire it up for direct I/O as there is an immediate need for it there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/iomap/direct-io.c  | 8 ++++++++
 include/linux/iomap.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index 15929690d89e3..355abe2eacc6a 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -520,6 +520,14 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
 	dio->submit.waiter = current;
 	dio->submit.poll_bio = NULL;
 
+	/*
+	 * Transfer the private data that was passed by the caller to the
+	 * iomap_iter, and clear it in the iocb, as iocb->private will be
+	 * used for polled bio completion later.
+	 */
+	iomi.private = iocb->private;
+	WRITE_ONCE(iocb->private, NULL);
+
 	if (iov_iter_rw(iter) == READ) {
 		if (iomi.pos >= dio->i_size)
 			goto out_free_dio;
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index a5483020dad41..109c055865f73 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -188,6 +188,7 @@ struct iomap_iter {
 	unsigned flags;
 	struct iomap iomap;
 	struct iomap srcmap;
+	void *private;
 };
 
 int iomap_iter(struct iomap_iter *iter, const struct iomap_ops *ops);
-- 
2.30.2


  parent reply	other threads:[~2022-05-04 16:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 16:23 reduce memory allocation in the btrfs direct I/O path Christoph Hellwig
2022-05-04 16:23 ` [PATCH 1/5] iomap: allow the file system to provide a bio_set for direct I/O Christoph Hellwig
2022-05-05 15:38   ` Darrick J. Wong
2022-05-04 16:23 ` Christoph Hellwig [this message]
2022-05-05  8:06   ` [PATCH 2/5] iomap: add per-iomap_iter private data Nikolay Borisov
2022-05-05 15:06     ` Christoph Hellwig
2022-05-05 15:41   ` Darrick J. Wong
2022-05-05 15:45     ` Christoph Hellwig
2022-05-05 16:32       ` Darrick J. Wong
2022-05-05 18:15         ` Christoph Hellwig
2022-05-05 18:18           ` Darrick J. Wong
2022-05-04 16:23 ` [PATCH 3/5] btrfs: add a btrfs_dio_rw wrapper Christoph Hellwig
2022-05-04 16:23 ` [PATCH 4/5] btrfs: allocate dio_data on stack Christoph Hellwig
2022-05-04 16:23 ` [PATCH 5/5] btrfs: allocate the btrfs_dio_private as part of the iomap dio bio Christoph Hellwig
2022-05-05  8:12   ` Nikolay Borisov
2022-05-05 15:07     ` Christoph Hellwig
2022-05-05 15:20       ` David Sterba
2022-05-05 15:52   ` David Sterba
2022-05-05  8:33 ` reduce memory allocation in the btrfs direct I/O path Nikolay Borisov
2022-05-05 15:55 ` David Sterba
2022-05-06 17:18   ` Darrick J. Wong
2022-05-07  5:26     ` Christoph Hellwig
2022-05-09 18:46       ` David Sterba
2022-05-10  3:33         ` Darrick J. Wong

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=20220504162342.573651-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=clm@fb.com \
    --cc=djwong@kernel.org \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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).