From: Pankaj Raghav <p.raghav@samsung.com>
To: hubcap@omnibond.com, brauner@kernel.org, martin@omnibond.com,
willy@infradead.org, hch@lst.de, minchan@kernel.org,
viro@zeniv.linux.org.uk, axboe@kernel.dk,
akpm@linux-foundation.org, senozhatsky@chromium.org
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
devel@lists.orangefs.org, linux-fsdevel@vger.kernel.org,
linux-block@vger.kernel.org, gost.dev@samsung.com,
mcgrof@kernel.org, Pankaj Raghav <p.raghav@samsung.com>
Subject: [PATCH v3 3/3] mpage: use folios in bio end_io handler
Date: Tue, 11 Apr 2023 14:29:20 +0200 [thread overview]
Message-ID: <20230411122920.30134-4-p.raghav@samsung.com> (raw)
In-Reply-To: <20230411122920.30134-1-p.raghav@samsung.com>
Use folios in the bio end_io handler. This conversion does the appropriate
handling on the folios in the respective end_io callback and removes the
call to page_endio(), which is soon to be removed.
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/mpage.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/fs/mpage.c b/fs/mpage.c
index d9540c1b7427..242e213ee064 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -45,24 +45,32 @@
*/
static void mpage_read_end_io(struct bio *bio)
{
- struct bio_vec *bv;
- struct bvec_iter_all iter_all;
+ struct folio_iter fi;
+ int err = blk_status_to_errno(bio->bi_status);
- bio_for_each_segment_all(bv, bio, iter_all)
- page_endio(bv->bv_page, REQ_OP_READ,
- blk_status_to_errno(bio->bi_status));
+ bio_for_each_folio_all(fi, bio) {
+ if (err)
+ folio_set_error(fi.folio);
+ else
+ folio_mark_uptodate(fi.folio);
+ folio_unlock(fi.folio);
+ }
bio_put(bio);
}
static void mpage_write_end_io(struct bio *bio)
{
- struct bio_vec *bv;
- struct bvec_iter_all iter_all;
+ struct folio_iter fi;
+ int err = blk_status_to_errno(bio->bi_status);
- bio_for_each_segment_all(bv, bio, iter_all)
- page_endio(bv->bv_page, REQ_OP_WRITE,
- blk_status_to_errno(bio->bi_status));
+ bio_for_each_folio_all(fi, bio) {
+ if (err) {
+ folio_set_error(fi.folio);
+ mapping_set_error(fi.folio->mapping, err);
+ }
+ folio_end_writeback(fi.folio);
+ }
bio_put(bio);
}
--
2.34.1
prev parent reply other threads:[~2023-04-11 12:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230411122922eucas1p1ed50c7c4c98104f936e3057f975c72ac@eucas1p1.samsung.com>
2023-04-11 12:29 ` [PATCH v3 0/3] remove page_endio() v3 Pankaj Raghav
[not found] ` <CGME20230411122923eucas1p27e097fa66db8e166d14658bc7c6f180b@eucas1p2.samsung.com>
2023-04-11 12:29 ` [PATCH v3 1/3] orangefs: use folios in orangefs_readahead Pankaj Raghav
[not found] ` <CGME20230411122923eucas1p1dfc182a2c785eeb362b9d670dfe3ba2f@eucas1p1.samsung.com>
2023-04-11 12:29 ` [PATCH v3 2/3] mpage: split submit_bio and bio end_io handler for reads and writes Pankaj Raghav
2023-04-11 12:30 ` Christoph Hellwig
[not found] ` <CGME20230411122924eucas1p16c6abcf91a3e04c6a0a225606ca0044d@eucas1p1.samsung.com>
2023-04-11 12:29 ` Pankaj Raghav [this message]
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=20230411122920.30134-4-p.raghav@samsung.com \
--to=p.raghav@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=devel@lists.orangefs.org \
--cc=gost.dev@samsung.com \
--cc=hch@lst.de \
--cc=hubcap@omnibond.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=martin@omnibond.com \
--cc=mcgrof@kernel.org \
--cc=minchan@kernel.org \
--cc=senozhatsky@chromium.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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