linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pankaj Raghav <p.raghav@samsung.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>, <hubcap@omnibond.com>,
	<senozhatsky@chromium.org>, <martin@omnibond.com>,
	<minchan@kernel.org>, <viro@zeniv.linux.org.uk>,
	<brauner@kernel.org>, <axboe@kernel.dk>,
	<akpm@linux-foundation.org>, <linux-kernel@vger.kernel.org>,
	<linux-block@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
	<linux-mm@kvack.org>, <gost.dev@samsung.com>, <mcgrof@kernel.org>,
	<devel@lists.orangefs.org>
Subject: Re: [RFC PATCH 1/3] filemap: convert page_endio to folio_endio
Date: Tue, 21 Mar 2023 14:51:12 +0100	[thread overview]
Message-ID: <ea4a45b8-837d-ec60-8320-126346e49a42@samsung.com> (raw)
In-Reply-To: <04047489-e528-4451-4af2-c19bd3635e7e@samsung.com>

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)
> +{
> ....
> +


  reply	other threads:[~2023-03-21 13:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230315123234eucas1p179bf8c0583a71d91bef7e909d7ec6504@eucas1p1.samsung.com>
2023-03-15 12:32 ` [RFC PATCH 0/3] " Pankaj Raghav
     [not found]   ` <CGME20230315123234eucas1p2503d83ad0180cecde02e924d7b143535@eucas1p2.samsung.com>
2023-03-15 12:32     ` [RFC PATCH 1/3] filemap: " Pankaj Raghav
2023-03-15 14:46       ` Luis Chamberlain
2023-03-15 14:51       ` Hannes Reinecke
2023-03-15 14:56       ` Christoph Hellwig
2023-03-16 10:04         ` Pankaj Raghav
2023-03-16 15:24           ` Christoph Hellwig
2023-03-17 15:31           ` Matthew Wilcox
2023-03-17 16:14             ` Pankaj Raghav
2023-03-21 13:51               ` Pankaj Raghav [this message]
     [not found]   ` <CGME20230315123235eucas1p1bd62cb2aab435727880769f2e57624fd@eucas1p1.samsung.com>
2023-03-15 12:32     ` [RFC PATCH 2/3] mpage: use bio_for_each_folio_all in mpage_end_io() Pankaj Raghav
2023-03-15 14:47       ` Luis Chamberlain
2023-03-15 14:52       ` Hannes Reinecke
2023-03-15 16:08         ` Matthew Wilcox
2023-03-16 10:07           ` Pankaj Raghav
     [not found]   ` <CGME20230315123236eucas1p1116e1b8537191310bd03dd267b9f8eb8@eucas1p1.samsung.com>
2023-03-15 12:32     ` [RFC PATCH 3/3] orangefs: use folio in orangefs_readahead() Pankaj Raghav
2023-03-15 14:48       ` Luis Chamberlain
2023-03-15 16:05       ` Matthew Wilcox

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=ea4a45b8-837d-ec60-8320-126346e49a42@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@infradead.org \
    --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