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

From: Christoph Hellwig
Date: Tue Oct 08 2024 - 05:45:42 EST


> !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.