[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ea4a45b8-837d-ec60-8320-126346e49a42@samsung.com>
Date: Tue, 21 Mar 2023 14:51:12 +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
Hi Willy,
On 2023-03-17 17:14, Pankaj Raghav wrote:
> 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.
>
I am planning to send the next version. It would be great if I can get a rationale for your
statement regarding not needing to call folio_set_error() or folio_clear_uptodate().
> 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