Re: [PATCH 03/12] iomap: add bioset in iomap_read_folio_ops for filesystems to use own bioset

From: Goldwyn Rodrigues
Date: Thu Oct 10 2024 - 13:52:31 EST


On 2:45 08/10, Christoph Hellwig wrote:
> > !bio_add_folio(ctx->bio, folio, plen, poff)) {
> > + struct bio_set *bioset;
> > gfp_t gfp = mapping_gfp_constraint(folio->mapping, GFP_KERNEL);
> > gfp_t orig_gfp = gfp;
> > unsigned int nr_vecs = DIV_ROUND_UP(length, PAGE_SIZE);
>
> Nit: I try to keep variables just declared and not initialized after
> those initialized at declaration time.
>
> > +
> > + if (ctx->ops && ctx->ops->bio_set)
> > + bioset = ctx->ops->bio_set;
> > + else
> > + bioset = &fs_bio_set;
> > +
> > + ctx->bio = bio_alloc_bioset(iomap->bdev, bio_max_segs(nr_vecs),
> > + REQ_OP_READ, gfp, bioset);
> > +
>
> But it would be nice to move this logic into a helper, similar to what
> is done in the direct I/O code. That should robably include
> picking the gfp flags from the ctx.
>

Agree. I will put this in the next version.

--
Goldwyn