From: Christoph Hellwig <hch@lst.de>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 02/11] iomap: update ki_pos a little later in iomap_dio_complete
Date: Wed, 24 May 2023 08:38:01 +0200 [thread overview]
Message-ID: <20230524063810.1595778-3-hch@lst.de> (raw)
In-Reply-To: <20230524063810.1595778-1-hch@lst.de>
Move the ki_pos update down a bit to prepare for a better common
helper that invalidates pages based of an iocb.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
fs/iomap/direct-io.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index 019cc87d0fb339..6207a59d2162e1 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -94,7 +94,6 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio)
if (offset + ret > dio->i_size &&
!(dio->flags & IOMAP_DIO_WRITE))
ret = dio->i_size - offset;
- iocb->ki_pos += ret;
}
/*
@@ -120,19 +119,21 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio)
}
inode_dio_end(file_inode(iocb->ki_filp));
- /*
- * If this is a DSYNC write, make sure we push it to stable storage now
- * that we've written data.
- */
- if (ret > 0 && (dio->flags & IOMAP_DIO_NEED_SYNC))
- ret = generic_write_sync(iocb, ret);
- if (ret > 0)
- ret += dio->done_before;
+ if (ret > 0) {
+ iocb->ki_pos += ret;
+ /*
+ * If this is a DSYNC write, make sure we push it to stable
+ * storage now that we've written data.
+ */
+ if (dio->flags & IOMAP_DIO_NEED_SYNC)
+ ret = generic_write_sync(iocb, ret);
+ if (ret > 0)
+ ret += dio->done_before;
+ }
trace_iomap_dio_complete(iocb, dio->error, ret);
kfree(dio);
-
return ret;
}
EXPORT_SYMBOL_GPL(iomap_dio_complete);
--
2.39.2
next prev parent reply other threads:[~2023-05-24 6:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-24 6:37 [Cluster-devel] cleanup the filemap / direct I/O interaction v2 Christoph Hellwig
2023-05-24 6:38 ` [Cluster-devel] [PATCH 01/11] backing_dev: remove current->backing_dev_info Christoph Hellwig
2023-05-24 14:50 ` Darrick J. Wong
2023-05-30 6:56 ` Hannes Reinecke
2023-05-24 6:38 ` Christoph Hellwig [this message]
2023-05-30 6:57 ` [Cluster-devel] [PATCH 02/11] iomap: update ki_pos a little later in iomap_dio_complete Hannes Reinecke
2023-05-24 6:38 ` [Cluster-devel] [PATCH 03/11] filemap: update ki_pos in generic_perform_write Christoph Hellwig
2023-05-30 6:57 ` Hannes Reinecke
2023-05-24 6:38 ` [Cluster-devel] [PATCH 04/11] filemap: add a kiocb_write_and_wait helper Christoph Hellwig
2023-05-30 6:58 ` Hannes Reinecke
2023-05-24 6:38 ` [Cluster-devel] [PATCH 05/11] filemap: add a kiocb_invalidate_pages helper Christoph Hellwig
2023-05-30 6:59 ` Hannes Reinecke
2023-05-24 6:38 ` [Cluster-devel] [PATCH 06/11] filemap: add a kiocb_invalidate_post_direct_write helper Christoph Hellwig
2023-05-30 6:59 ` Hannes Reinecke
2023-05-24 6:38 ` [Cluster-devel] [PATCH 07/11] iomap: update ki_pos in iomap_file_buffered_write Christoph Hellwig
2023-05-25 16:02 ` Andreas Gruenbacher
2023-05-30 7:00 ` Hannes Reinecke
2023-05-24 6:38 ` [Cluster-devel] [PATCH 08/11] iomap: use kiocb_write_and_wait and kiocb_invalidate_pages Christoph Hellwig
2023-05-30 7:02 ` Hannes Reinecke
2023-05-24 6:38 ` [Cluster-devel] [PATCH 09/11] fs: factor out a direct_write_fallback helper Christoph Hellwig
2023-05-24 7:00 ` Miklos Szeredi
2023-05-25 10:05 ` Christoph Hellwig
2023-05-30 7:03 ` Hannes Reinecke
2023-05-24 6:38 ` [Cluster-devel] [PATCH 10/11] fuse: update ki_pos in fuse_perform_write Christoph Hellwig
2023-05-24 7:07 ` Miklos Szeredi
2023-05-25 10:09 ` Christoph Hellwig
2023-05-30 7:04 ` Hannes Reinecke
2023-05-24 6:38 ` [Cluster-devel] [PATCH 11/11] fuse: drop redundant arguments to fuse_perform_write Christoph Hellwig
2023-05-24 7:09 ` Miklos Szeredi
2023-05-30 7:04 ` Hannes Reinecke
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=20230524063810.1595778-3-hch@lst.de \
--to=hch@lst.de \
/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).