Re: [PATCHv3 3/8] block: align the bio after building it

From: Keith Busch
Date: Mon Aug 25 2025 - 10:08:49 EST


On Mon, Aug 25, 2025 at 09:46:06AM +0200, Christoph Hellwig wrote:
> On Tue, Aug 19, 2025 at 09:49:17AM -0700, Keith Busch wrote:
> > +
> > + if (!bio->bi_iter.bi_size)
> > + return -EFAULT;
>
> And as bi_size doesn't change in the loop, this should probably move
> above the loop.

The loop also releases pinned pages if necessary. We can't count on the
caller to do that if we return error here. __blkdev_direct_IO is the
only one that tries to release pages on error, everyone else would leak
them.