From: Pankaj Raghav <p.raghav@samsung.com>
To: axboe@kernel.dk, minchan@kernel.org, martin@omnibond.com,
hubcap@omnibond.com, brauner@kernel.org, viro@zeniv.linux.org.uk,
senozhatsky@chromium.org, akpm@linux-foundation.org,
willy@infradead.org, hch@lst.de
Cc: devel@lists.orangefs.org, mcgrof@kernel.org,
linux-block@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, gost.dev@samsung.com,
linux-fsdevel@vger.kernel.org,
Pankaj Raghav <p.raghav@samsung.com>
Subject: [PATCH v2 3/5] mpage: split bi_end_io callback for reads and writes
Date: Mon, 3 Apr 2023 15:22:19 +0200 [thread overview]
Message-ID: <20230403132221.94921-4-p.raghav@samsung.com> (raw)
In-Reply-To: <20230403132221.94921-1-p.raghav@samsung.com>
Split the bi_end_io handler for reads and writes similar to other aops.
This is a prep patch before we convert end_io handlers to use folios.
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
fs/mpage.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/fs/mpage.c b/fs/mpage.c
index 22b9de5ddd68..3a545bf0f184 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -43,14 +43,28 @@
* status of that page is hard. See end_buffer_async_read() for the details.
* There is no point in duplicating all that complexity.
*/
-static void mpage_end_io(struct bio *bio)
+static void mpage_read_end_io(struct bio *bio)
{
struct bio_vec *bv;
struct bvec_iter_all iter_all;
bio_for_each_segment_all(bv, bio, iter_all) {
struct page *page = bv->bv_page;
- page_endio(page, bio_op(bio),
+ page_endio(page, REQ_OP_READ,
+ blk_status_to_errno(bio->bi_status));
+ }
+
+ bio_put(bio);
+}
+
+static void mpage_write_end_io(struct bio *bio)
+{
+ struct bio_vec *bv;
+ struct bvec_iter_all iter_all;
+
+ bio_for_each_segment_all(bv, bio, iter_all) {
+ struct page *page = bv->bv_page;
+ page_endio(page, REQ_OP_WRITE,
blk_status_to_errno(bio->bi_status));
}
@@ -59,7 +73,11 @@ static void mpage_end_io(struct bio *bio)
static struct bio *mpage_bio_submit(struct bio *bio)
{
- bio->bi_end_io = mpage_end_io;
+ if (op_is_write(bio_op(bio)))
+ bio->bi_end_io = mpage_write_end_io;
+ else
+ bio->bi_end_io = mpage_read_end_io;
+
guard_bio_eod(bio);
submit_bio(bio);
return NULL;
--
2.34.1
next prev parent reply other threads:[~2023-04-03 13:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230403132223eucas1p28adb1d36d39add989d46e9f175c07986@eucas1p2.samsung.com>
2023-04-03 13:22 ` [PATCH v2 0/5] remove page_endio() Pankaj Raghav
[not found] ` <CGME20230403132223eucas1p2a27e8239b8bda4fc16b675a9473fd61f@eucas1p2.samsung.com>
2023-04-03 13:22 ` [PATCH v2 1/5] zram: always chain bio to the parent in read_from_bdev_async Pankaj Raghav
2023-04-03 21:19 ` Minchan Kim
2023-04-04 15:06 ` Christoph Hellwig
2023-04-04 19:31 ` Andrew Morton
2023-04-05 6:07 ` Christoph Hellwig
2023-04-11 7:34 ` Pankaj Raghav
[not found] ` <CGME20230403132224eucas1p28f82802bc40d4feb5a30bb59c6536ab3@eucas1p2.samsung.com>
2023-04-03 13:22 ` [PATCH v2 2/5] orangefs: use folios in orangefs_readahead Pankaj Raghav
2023-04-04 15:07 ` Christoph Hellwig
[not found] ` <CGME20230403132224eucas1p21fd296fbd4af70220331bb19023f4169@eucas1p2.samsung.com>
2023-04-03 13:22 ` Pankaj Raghav [this message]
2023-04-04 15:09 ` [PATCH v2 3/5] mpage: split bi_end_io callback for reads and writes Christoph Hellwig
[not found] ` <CGME20230403132225eucas1p15848db3c850e950b21b339d5861080e1@eucas1p1.samsung.com>
2023-04-03 13:22 ` [PATCH v2 4/5] mpage: use folios in bio end_io handler Pankaj Raghav
2023-04-04 15:10 ` Christoph Hellwig
[not found] ` <CGME20230403132226eucas1p182e09f5da7bc0bd284d6a8494cd40903@eucas1p1.samsung.com>
2023-04-03 13:22 ` [PATCH v2 5/5] filemap: remove page_endio() Pankaj Raghav
2023-04-04 15:10 ` Christoph Hellwig
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=20230403132221.94921-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