From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Kanchan Joshi <joshi.k@samsung.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
Qu Wenruo <wqu@suse.com>, Goldwyn Rodrigues <rgoldwyn@suse.com>,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/7] iomap: support ioends for reads
Date: Mon, 3 Feb 2025 14:24:03 -0800 [thread overview]
Message-ID: <20250203222403.GF134507@frogsfrogsfrogs> (raw)
In-Reply-To: <20250203094322.1809766-5-hch@lst.de>
On Mon, Feb 03, 2025 at 10:43:08AM +0100, Christoph Hellwig wrote:
> Support using the ioend structure to defer I/O completion for
> reads in addition to writes. This requires a check for the operation
> to not merge reads and writes, and for buffere I/O a call into the
buffered
> buffered read I/O completion handler from iomap_finish_ioend. For
> direct I/O the existing call into the direct I/O completion handler
> handles reads just fine already.
Otherwise everything looks ok to me.
--D
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/iomap/buffered-io.c | 23 ++++++++++++++++++-----
> fs/iomap/internal.h | 3 ++-
> fs/iomap/ioend.c | 6 +++++-
> 3 files changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index eaffa23eb8e4..06990e012884 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -306,14 +306,27 @@ static void iomap_finish_folio_read(struct folio *folio, size_t off,
> folio_end_read(folio, uptodate);
> }
>
> -static void iomap_read_end_io(struct bio *bio)
> +static u32 __iomap_read_end_io(struct bio *bio, int error)
> {
> - int error = blk_status_to_errno(bio->bi_status);
> struct folio_iter fi;
> + u32 folio_count = 0;
>
> - bio_for_each_folio_all(fi, bio)
> + bio_for_each_folio_all(fi, bio) {
> iomap_finish_folio_read(fi.folio, fi.offset, fi.length, error);
> + folio_count++;
> + }
> bio_put(bio);
> + return folio_count;
> +}
> +
> +static void iomap_read_end_io(struct bio *bio)
> +{
> + __iomap_read_end_io(bio, blk_status_to_errno(bio->bi_status));
> +}
> +
> +u32 iomap_finish_ioend_buffered_read(struct iomap_ioend *ioend)
> +{
> + return __iomap_read_end_io(&ioend->io_bio, ioend->io_error);
> }
>
> struct iomap_readpage_ctx {
> @@ -1568,7 +1581,7 @@ static void iomap_finish_folio_write(struct inode *inode, struct folio *folio,
> * state, release holds on bios, and finally free up memory. Do not use the
> * ioend after this.
> */
> -u32 iomap_finish_ioend_buffered(struct iomap_ioend *ioend)
> +u32 iomap_finish_ioend_buffered_write(struct iomap_ioend *ioend)
> {
> struct inode *inode = ioend->io_inode;
> struct bio *bio = &ioend->io_bio;
> @@ -1600,7 +1613,7 @@ static void iomap_writepage_end_bio(struct bio *bio)
> struct iomap_ioend *ioend = iomap_ioend_from_bio(bio);
>
> ioend->io_error = blk_status_to_errno(bio->bi_status);
> - iomap_finish_ioend_buffered(ioend);
> + iomap_finish_ioend_buffered_write(ioend);
> }
>
> /*
> diff --git a/fs/iomap/internal.h b/fs/iomap/internal.h
> index f6992a3bf66a..c824e74a3526 100644
> --- a/fs/iomap/internal.h
> +++ b/fs/iomap/internal.h
> @@ -4,7 +4,8 @@
>
> #define IOEND_BATCH_SIZE 4096
>
> -u32 iomap_finish_ioend_buffered(struct iomap_ioend *ioend);
> +u32 iomap_finish_ioend_buffered_read(struct iomap_ioend *ioend);
> +u32 iomap_finish_ioend_buffered_write(struct iomap_ioend *ioend);
> u32 iomap_finish_ioend_direct(struct iomap_ioend *ioend);
>
> #endif /* _IOMAP_INTERNAL_H */
> diff --git a/fs/iomap/ioend.c b/fs/iomap/ioend.c
> index 18894ebba6db..2dd29403dc10 100644
> --- a/fs/iomap/ioend.c
> +++ b/fs/iomap/ioend.c
> @@ -44,7 +44,9 @@ static u32 iomap_finish_ioend(struct iomap_ioend *ioend, int error)
> return 0;
> if (ioend->io_flags & IOMAP_IOEND_DIRECT)
> return iomap_finish_ioend_direct(ioend);
> - return iomap_finish_ioend_buffered(ioend);
> + if (bio_op(&ioend->io_bio) == REQ_OP_READ)
> + return iomap_finish_ioend_buffered_read(ioend);
> + return iomap_finish_ioend_buffered_write(ioend);
> }
>
> /*
> @@ -83,6 +85,8 @@ EXPORT_SYMBOL_GPL(iomap_finish_ioends);
> static bool iomap_ioend_can_merge(struct iomap_ioend *ioend,
> struct iomap_ioend *next)
> {
> + if (bio_op(&ioend->io_bio) != bio_op(&next->io_bio))
> + return false;
> if (ioend->io_bio.bi_status != next->io_bio.bi_status)
> return false;
> if (next->io_flags & IOMAP_IOEND_BOUNDARY)
> --
> 2.45.2
>
>
next prev parent reply other threads:[~2025-02-03 22:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-03 9:43 PI and data checksumming for XFS Christoph Hellwig
2025-02-03 9:43 ` [PATCH 1/7] block: support integrity generation and verification from file systems Christoph Hellwig
2025-02-03 19:47 ` Martin K. Petersen
2025-04-21 2:30 ` Anuj gupta
2025-02-03 9:43 ` [PATCH 2/7] iomap: introduce iomap_read_folio_ops Christoph Hellwig
2025-02-03 9:43 ` [PATCH 3/7] iomap: add bioset in iomap_read_folio_ops for filesystems to use own bioset Christoph Hellwig
2025-02-03 22:23 ` Darrick J. Wong
2025-02-04 4:58 ` Christoph Hellwig
2025-03-13 13:53 ` Matthew Wilcox
2025-03-14 16:53 ` Darrick J. Wong
2025-03-17 5:52 ` Christoph Hellwig
2025-02-03 9:43 ` [PATCH 4/7] iomap: support ioends for reads Christoph Hellwig
2025-02-03 22:24 ` Darrick J. Wong [this message]
2025-02-03 9:43 ` [PATCH 5/7] iomap: limit buffered I/O size to 128M Christoph Hellwig
2025-02-03 22:22 ` Darrick J. Wong
2025-02-03 9:43 ` [PATCH 6/7] xfs: support T10 protection information Christoph Hellwig
2025-02-03 22:21 ` Darrick J. Wong
2025-02-03 9:43 ` [PATCH 7/7] xfs: implement block-metadata based data checksums Christoph Hellwig
2025-02-03 22:20 ` Darrick J. Wong
2025-02-04 5:00 ` Christoph Hellwig
2025-02-04 18:36 ` Darrick J. Wong
2025-02-06 6:05 ` Christoph Hellwig
2025-02-03 19:51 ` PI and data checksumming for XFS Martin K. Petersen
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=20250203222403.GF134507@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=Johannes.Thumshirn@wdc.com \
--cc=hch@lst.de \
--cc=joshi.k@samsung.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=rgoldwyn@suse.com \
--cc=wqu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.