Linux block layer
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Qu Wenruo <wqu@suse.com>, Neptune <z1281552865@gmail.com>,
	linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/3] block,iov_iter: move bio_iov_iter_align_down into iov_iter_extract_bvecs
Date: Tue, 14 Jul 2026 08:26:31 -0600	[thread overview]
Message-ID: <alZHF1wZY58JSU7N@kbusch-mbp> (raw)
In-Reply-To: <20260714131318.2670042-4-hch@lst.de>

On Tue, Jul 14, 2026 at 03:12:00PM +0200, Christoph Hellwig wrote:
>  ssize_t iov_iter_extract_bvecs(struct iov_iter *iter, struct bio_vec *bv,
>  		size_t max_size, unsigned short *nr_vecs,
>  		unsigned short max_vecs, unsigned mem_align_mask,
> -		iov_iter_extraction_t extraction_flags)
> +		unsigned len_align_mask, iov_iter_extraction_t extraction_flags)
>  {
>  	unsigned long start = (unsigned long)iter_iov_addr(iter);
>  	unsigned short entries_left = max_vecs - *nr_vecs;
> @@ -1960,11 +1991,13 @@ ssize_t iov_iter_extract_bvecs(struct iov_iter *iter, struct bio_vec *bv,
>  		offset = 0;
>  	}
>  
> +	size -= left;
>  	iov_iter_revert(iter, left);
>  	if (iov_iter_extract_will_pin(iter)) {
>  		while (i < nr_pages)
>  			unpin_user_page(pages[i++]);
>  	}
> -	return size - left;
> +
> +	return bvec_iter_align_down(iter, bv, size, nr_vecs, len_align_mask);

I don't think we can do this alignment inline with building the bio_vec.
The len_align_mask is usually the logical block size. We can submit
sub-sector sized vectors so aligning down after extracting such a vector
will result in a zero size for that iteration.

  reply	other threads:[~2026-07-14 14:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14 13:11 bio bounce buffering fixes Christoph Hellwig
2026-07-14 13:11 ` [PATCH 1/3] block: handle huge zero folios in bio_free_folios Christoph Hellwig
2026-07-14 13:11 ` [PATCH 2/3] block: simplify minsize alignment in bio_iov_iter_bounce_write Christoph Hellwig
2026-07-14 13:12 ` [PATCH 3/3] block,iov_iter: move bio_iov_iter_align_down into iov_iter_extract_bvecs Christoph Hellwig
2026-07-14 14:26   ` Keith Busch [this message]
2026-07-14 14:50     ` Christoph Hellwig
2026-07-14 16:44       ` Keith Busch
2026-07-15  4:34         ` Christoph Hellwig
2026-07-15 15:00           ` Keith Busch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alZHF1wZY58JSU7N@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wqu@suse.com \
    --cc=z1281552865@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox