[PATCH v2 6/6] blk-integrity: avoid sector_t in bip_{get,set}_seed()

Christoph Hellwig hch at lst.de
Fri Apr 17 00:55:07 PDT 2026


On Thu, Apr 16, 2026 at 06:53:05PM -0700, Caleb Sander Mateos wrote:
> > > +static inline void bip_set_seed(struct bio_integrity_payload *bip,
> > > +                             const struct blk_integrity *bi,
> > > +                             const struct bio *bio)
> > > +{
> > > +     bip->bip_iter.bi_sector =
> > > +             bio_integrity_intervals(bi, bio->bi_iter.bi_sector);
> >
> > The bip is pointed to by the bio, so we don't need to pass it separately.
> > Same for struct blk_integrity.
> 
> I did consider that, but all callers already have bip and bi in
> variables that they also use elsewhere. Seemed like it might be
> slightly more efficient to just pass the precomputed values instead of
> looking them up again. Not a big deal either way. I'll go ahead and
> implement your suggestion.

In general I much prefer API-simplicity over a little bit more
efficiency unless we can show it makes a difference that matters.
And given that this is an inline function where compiler tend to
avoid duplicate dereferences anyway I doubt we'll see a difference
here.




More information about the Linux-nvme mailing list