From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: [PATCH 5/8] iomap: Pass iomap_write_ctx to iomap_write_actor()
Date: Wed, 11 Aug 2021 03:46:44 +0100 [thread overview]
Message-ID: <20210811024647.3067739-6-willy@infradead.org> (raw)
In-Reply-To: <20210811024647.3067739-1-willy@infradead.org>
We need to pass a little more information to iomap_write_actor(),
so define our own little struct for it.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/iomap/buffered-io.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index ad9d8fe97f2e..a74da66e64a7 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -514,6 +514,13 @@ enum {
IOMAP_WRITE_F_UNSHARE = (1 << 0),
};
+struct iomap_write_ctx {
+ struct iov_iter *iter;
+ struct iomap_ioend *ioend;
+ struct list_head iolist;
+ bool write_through;
+};
+
static void
iomap_write_failed(struct inode *inode, loff_t pos, unsigned len)
{
@@ -734,7 +741,8 @@ static loff_t
iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
struct iomap *iomap, struct iomap *srcmap)
{
- struct iov_iter *i = data;
+ struct iomap_write_ctx *iwc = data;
+ struct iov_iter *i = iwc->iter;
long status = 0;
ssize_t written = 0;
@@ -804,12 +812,17 @@ ssize_t
iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *iter,
const struct iomap_ops *ops)
{
+ struct iomap_write_ctx iwc = {
+ .iter = iter,
+ .iolist = LIST_HEAD_INIT(iwc.iolist),
+ .write_through = iocb->ki_flags & IOCB_SYNC,
+ };
struct inode *inode = iocb->ki_filp->f_mapping->host;
loff_t pos = iocb->ki_pos, ret = 0, written = 0;
while (iov_iter_count(iter)) {
ret = iomap_apply(inode, pos, iov_iter_count(iter),
- IOMAP_WRITE, ops, iter, iomap_write_actor);
+ IOMAP_WRITE, ops, &iwc, iomap_write_actor);
if (ret <= 0)
break;
pos += ret;
--
2.30.2
next prev parent reply other threads:[~2021-08-11 2:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 2:46 [PATCH 0/8] iomap writethrough for O_SYNC writes Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 1/8] iomap: Pass struct iomap to iomap_alloc_ioend() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 2/8] iomap: Remove iomap_writepage_ctx from iomap_can_add_to_ioend() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 3/8] iomap: Do not pass iomap_writepage_ctx to iomap_add_to_ioend() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 4/8] iomap: Accept a NULL iomap_writepage_ctx in iomap_submit_ioend() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` Matthew Wilcox (Oracle) [this message]
2021-08-11 2:46 ` [PATCH 6/8] iomap: Allow a NULL writeback_control argument to iomap_alloc_ioend() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 7/8] iomap: Pass a length to iomap_add_to_ioend() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 8/8] iomap: Add writethrough for O_SYNC Matthew Wilcox (Oracle)
2021-08-12 13:16 ` Christoph Hellwig
2021-08-12 13:28 ` Matthew Wilcox
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=20210811024647.3067739-6-willy@infradead.org \
--to=willy@infradead.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).