[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210607120822.GA11665@lst.de>
Date: Mon, 7 Jun 2021 14:08:22 +0200
From: Christoph Hellwig <hch@....de>
To: Coly Li <colyli@...e.de>
Cc: Christoph Hellwig <hch@....de>, axboe@...nel.dk,
linux-bcache@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
Alexander Ullrich <ealex1979@...il.com>,
Diego Ercolani <diego.ercolani@...il.com>,
Jan Szubiak <jan.szubiak@...uxpolska.pl>,
Marco Rebhan <me@...saiko.net>,
Matthias Ferdinand <bcache@...dv.net>,
Victor Westerhuis <victor@...terhu.is>,
Vojtech Pavlik <vojtech@...e.cz>,
Rolf Fokkens <rolf@...ffokkens.nl>,
Thorsten Knabe <linux@...rsten-knabe.de>,
stable@...r.kernel.org,
Kent Overstreet <kent.overstreet@...il.com>,
Nix <nix@...eri.org.uk>, Takashi Iwai <tiwai@...e.com>
Subject: Re: [PATCH v5 2/2] bcache: avoid oversized read request in cache
missing code path
On Mon, Jun 07, 2021 at 07:55:22PM +0800, Coly Li wrote:
> On 6/7/21 7:06 PM, Christoph Hellwig wrote:
> > On Mon, Jun 07, 2021 at 06:35:39PM +0800, Coly Li wrote:
> >> + /* Limitation for valid replace key size and cache_bio bvecs number */
> >> + size_limit = min_t(unsigned int, bio_max_segs(UINT_MAX) * PAGE_SECTORS,
> >> + (1 << KEY_SIZE_BITS) - 1);
> > bio_max_segs kaps the argument to BIO_MAX_VECS, so you might as well
>
> It was suggested to not directly access BIO_MAX_VECS by you, maybe I
> misunderstood you.
Yes, drivers really should not care about it. But hiding that behind
a tiny wrapper doesn't help either.
> > directly write BIO_MAX_VECS. Can you explain the PAGE_SECTORS here a bit
> > more? Does this code path use discontiguous per-sector allocations?
> > Preferably in a comment.
>
>
> It is just because bch_bio_map() assume the maximum bio size is 1MB. It
> was not true since the multiple pages bvecs
> was merged in mainline kernel.
>
> The PAGE_SECTORS part is legacy for 1MB maximum size bio (256*4KB), it
> should be fixed/improved later to
> use multiple pages for bio size > 1MB and replace bch_bio_map().
bch_bio_map and bch_bio_alloc_pages that poke directly into the bio are
the root cause of a lot of these problems.
I had a series fixing some of that but Kent did not like it. Drivers must
not diretly access bi_vcnt or directly build bios.
> Not any more. Now the line limit is 100 characters. Though I still
> prefer 80 characters, place 86 characters in single line
> makes the change more obvious.
It makes it really hard to read in a normal terminal.
Powered by blists - more mailing lists