linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@redhat.com>
To: Chao Yu <yuchao0@huawei.com>
Cc: Martin DEVERA <devik@eaxlabs.cz>,
	linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] erofs: fix bio->bi_max_vecs behavior change
Date: Fri, 19 Mar 2021 12:16:21 +0800	[thread overview]
Message-ID: <20210319041621.GB1431129@xiangao.remote.csb> (raw)
In-Reply-To: <dffa941d-63b5-2068-80f4-dd012f520147@huawei.com>

Hi Chao,

On Fri, Mar 19, 2021 at 10:15:18AM +0800, Chao Yu wrote:
> On 2021/3/6 12:04, Gao Xiang wrote:

...

> > +	    (*last_block + 1 != current_block || !*eblks)) {
> 
> Xiang,
> 
> I found below function during checking bi_max_vecs usage in f2fs:
> 
> /**
>  * bio_full - check if the bio is full
>  * @bio:        bio to check
>  * @len:        length of one segment to be added
>  *
>  * Return true if @bio is full and one segment with @len bytes can't be
>  * added to the bio, otherwise return false
>  */
> static inline bool bio_full(struct bio *bio, unsigned len)
> {
>         if (bio->bi_vcnt >= bio->bi_max_vecs)
>                 return true;
> 
>         if (bio->bi_iter.bi_size > UINT_MAX - len)
>                 return true;
> 
>         return false;
> }
> 
> Could you please check that whether it will be better to use bio_full()
> rather than using left-space-in-bio maintained by erofs itself? something
> like:
> 
> if (bio && (bio_full(bio, PAGE_SIZE) ||
> 	/* not continuous */
> 	(*last_block + 1 != current_block))
> 
> I'm thinking we need to decouple bio detail implementation as much as
> possible, to avoid regression whenever bio used/max size definition
> updates, though I've no idea how to fix f2fs case.

Thanks for your suggestion.

Not quite sure I understand the idea... The original problem was that
when EROFS bio_alloc, the number of requested bvec also partially stood
for remaining blocks of the current on-disk extent to limit the read
length. but after that bio behavior change, bi_max_vec could be increased
internally by block layer (e.g. 1 --> 4), so bi_max_vecs is no longer
as what we expect (I mean passed-in). so could cause read request
out-of-bound or hung. That's why I decided to record it manually (never
rely on bio statistics anymore...)

Also btw, AFAIK, Jianan is still investigating to use iomap instead
(mainly resolve tail-packing inline path). And I'm also busy in big
pcluster and LZMA new features for the next cycle. So I think we might
leave it just as is and it would be replaced with iomap in the future.

Thanks,
Gao Xiang

> 
> Let me know if you have other concern.
> 
> Thanks,


      reply	other threads:[~2021-03-19  4:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210306033109.28466-1-hsiangkao.ref@aol.com>
2021-03-06  3:31 ` [PATCH] erofs: fix bio->bi_max_vecs behavior change Gao Xiang via Linux-erofs
2021-03-06  4:04   ` [PATCH v2] " Gao Xiang via Linux-erofs
2021-03-08  1:29     ` Chao Yu
2021-03-08  2:36       ` Gao Xiang
2021-03-08  2:52         ` Chao Yu
2021-03-08  3:01           ` Gao Xiang
2021-03-19  2:15     ` Chao Yu
2021-03-19  4:16       ` Gao Xiang [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=20210319041621.GB1431129@xiangao.remote.csb \
    --to=hsiangkao@redhat.com \
    --cc=devik@eaxlabs.cz \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).