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 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.
- s->insert_bio_sectors = min3(size_limit, sectors, bio_sectors(bio));
Also I don't really understand the units involved here. s->insert_bio_sectors, sectors, and bio_sectors is in unit of 512 byte sectors.
- miss = bio_next_split(bio, sectors, GFP_NOIO, &s->d->bio_split);
- miss = bio_next_split(bio, s->insert_bio_sectors, GFP_NOIO, &s->d->bio_split);
Overly long line.