[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <04047489-e528-4451-4af2-c19bd3635e7e@samsung.com>
Date: Fri, 17 Mar 2023 17:14:28 +0100
From: Pankaj Raghav <p.raghav@...sung.com>
To: Matthew Wilcox <willy@...radead.org>
CC: Christoph Hellwig <hch@...radead.org>, <hubcap@...ibond.com>,
<senozhatsky@...omium.org>, <martin@...ibond.com>,
<minchan@...nel.org>, <viro@...iv.linux.org.uk>,
<brauner@...nel.org>, <axboe@...nel.dk>,
<akpm@...ux-foundation.org>, <linux-kernel@...r.kernel.org>,
<linux-block@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>,
<linux-mm@...ck.org>, <gost.dev@...sung.com>, <mcgrof@...nel.org>,
<devel@...ts.orangefs.org>
Subject: Re: [RFC PATCH 1/3] filemap: convert page_endio to folio_endio
On 2023-03-17 16:31, Matthew Wilcox wrote:
>> +
>> + while ((folio = readahead_folio(rac))) {
>> + folio_mark_uptodate(folio);
>> + folio_unlock(folio);
>> }
>
> readahead_folio() is a bit too heavy-weight for that, IMO. I'd do this
> as;
>
> while ((folio = readahead_folio(rac))) {
> if (!ret)
> folio_mark_uptodate(folio);
> folio_unlock(folio);
> }
>
This looks good.
> (there's no need to call folio_set_error(), nor folio_clear_uptodate())
I am trying to understand why these calls are not needed for the error case.
I see similar pattern, for e.g. in iomap_finish_folio_read() where we call these
functions for the error case.
If we don't need to call these anymore, can the mpage code also be shortened like this:
-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;
+ struct folio_iter fi;
+ int err = blk_status_to_errno(bio->bi_status);
- bio_for_each_segment_all(bv, bio, iter_all) {
- struct page *page = bv->bv_page;
- page_endio(page, bio_op(bio),
- blk_status_to_errno(bio->bi_status));
+ bio_for_each_folio_all(fi, bio) {
+ struct folio *folio = fi.folio;
+
+ if (!err)
+ folio_mark_uptodate(folio);
+ folio_unlock(folio);
+ }
+
+ bio_put(bio);
+}
+
+static void mpage_write_end_io(struct bio *bio)
+{
....
+
Powered by blists - more mailing lists