* [PATCH 01/14] block: refactor get_contig_folio_len
2026-01-19 7:44 ` bounce buffer direct I/O when stable pages are required v2 Christoph Hellwig
@ 2026-01-19 7:44 ` Christoph Hellwig
2026-01-22 11:00 ` Johannes Thumshirn
` (4 more replies)
2026-01-19 7:44 ` [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges Christoph Hellwig
` (14 subsequent siblings)
15 siblings, 5 replies; 76+ messages in thread
From: Christoph Hellwig @ 2026-01-19 7:44 UTC (permalink / raw)
To: Jens Axboe, Christian Brauner
Cc: Darrick J. Wong, Carlos Maiolino, Qu Wenruo, Al Viro, linux-block,
linux-xfs, linux-fsdevel
Move all of the logic to find the contigous length inside a folio into
get_contig_folio_len instead of keeping some of it in the caller.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/bio.c | 62 +++++++++++++++++++++++------------------------------
1 file changed, 27 insertions(+), 35 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 2359c0723b88..18dfdaba0c73 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1172,33 +1172,35 @@ void bio_iov_bvec_set(struct bio *bio, const struct iov_iter *iter)
bio_set_flag(bio, BIO_CLONED);
}
-static unsigned int get_contig_folio_len(unsigned int *num_pages,
- struct page **pages, unsigned int i,
- struct folio *folio, size_t left,
+static unsigned int get_contig_folio_len(struct page **pages,
+ unsigned int *num_pages, size_t left,
size_t offset)
{
- size_t bytes = left;
- size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, bytes);
- unsigned int j;
+ struct folio *folio = page_folio(pages[0]);
+ size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, left);
+ unsigned int max_pages, i;
+ size_t folio_offset, len;
+
+ folio_offset = PAGE_SIZE * folio_page_idx(folio, pages[0]) + offset;
+ len = min(folio_size(folio) - folio_offset, left);
/*
- * We might COW a single page in the middle of
- * a large folio, so we have to check that all
- * pages belong to the same folio.
+ * We might COW a single page in the middle of a large folio, so we have
+ * to check that all pages belong to the same folio.
*/
- bytes -= contig_sz;
- for (j = i + 1; j < i + *num_pages; j++) {
- size_t next = min_t(size_t, PAGE_SIZE, bytes);
+ left -= contig_sz;
+ max_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
+ for (i = 1; i < max_pages; i++) {
+ size_t next = min_t(size_t, PAGE_SIZE, left);
- if (page_folio(pages[j]) != folio ||
- pages[j] != pages[j - 1] + 1) {
+ if (page_folio(pages[i]) != folio ||
+ pages[i] != pages[i - 1] + 1)
break;
- }
contig_sz += next;
- bytes -= next;
+ left -= next;
}
- *num_pages = j - i;
+ *num_pages = i;
return contig_sz;
}
@@ -1222,8 +1224,8 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt;
struct page **pages = (struct page **)bv;
ssize_t size;
- unsigned int num_pages, i = 0;
- size_t offset, folio_offset, left, len;
+ unsigned int i = 0;
+ size_t offset, left, len;
int ret = 0;
/*
@@ -1244,23 +1246,12 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
return size ? size : -EFAULT;
nr_pages = DIV_ROUND_UP(offset + size, PAGE_SIZE);
- for (left = size, i = 0; left > 0; left -= len, i += num_pages) {
- struct page *page = pages[i];
- struct folio *folio = page_folio(page);
+ for (left = size; left > 0; left -= len) {
unsigned int old_vcnt = bio->bi_vcnt;
+ unsigned int nr_to_add;
- folio_offset = ((size_t)folio_page_idx(folio, page) <<
- PAGE_SHIFT) + offset;
-
- len = min(folio_size(folio) - folio_offset, left);
-
- num_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
-
- if (num_pages > 1)
- len = get_contig_folio_len(&num_pages, pages, i,
- folio, left, offset);
-
- if (!bio_add_folio(bio, folio, len, folio_offset)) {
+ len = get_contig_folio_len(&pages[i], &nr_to_add, left, offset);
+ if (!bio_add_page(bio, pages[i], len, offset)) {
WARN_ON_ONCE(1);
ret = -EINVAL;
goto out;
@@ -1275,8 +1266,9 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
* single pin per page.
*/
if (offset && bio->bi_vcnt == old_vcnt)
- unpin_user_folio(folio, 1);
+ unpin_user_folio(page_folio(pages[i]), 1);
}
+ i += nr_to_add;
offset = 0;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 76+ messages in thread* Re: [PATCH 01/14] block: refactor get_contig_folio_len
2026-01-19 7:44 ` [PATCH 01/14] block: refactor get_contig_folio_len Christoph Hellwig
@ 2026-01-22 11:00 ` Johannes Thumshirn
2026-01-22 17:54 ` Darrick J. Wong
` (3 subsequent siblings)
4 siblings, 0 replies; 76+ messages in thread
From: Johannes Thumshirn @ 2026-01-22 11:00 UTC (permalink / raw)
To: hch, Jens Axboe, Christian Brauner
Cc: Darrick J. Wong, Carlos Maiolino, WenRuo Qu, Al Viro,
linux-block@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 01/14] block: refactor get_contig_folio_len
2026-01-19 7:44 ` [PATCH 01/14] block: refactor get_contig_folio_len Christoph Hellwig
2026-01-22 11:00 ` Johannes Thumshirn
@ 2026-01-22 17:54 ` Darrick J. Wong
2026-01-23 8:32 ` Damien Le Moal
` (2 subsequent siblings)
4 siblings, 0 replies; 76+ messages in thread
From: Darrick J. Wong @ 2026-01-22 17:54 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Christian Brauner, Carlos Maiolino, Qu Wenruo,
Al Viro, linux-block, linux-xfs, linux-fsdevel
On Mon, Jan 19, 2026 at 08:44:08AM +0100, Christoph Hellwig wrote:
> Move all of the logic to find the contigous length inside a folio into
> get_contig_folio_len instead of keeping some of it in the caller.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
I like that this change makes it easier for me to guess what
get_contig_folio_len does just by looking at the arguments.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> block/bio.c | 62 +++++++++++++++++++++++------------------------------
> 1 file changed, 27 insertions(+), 35 deletions(-)
>
> diff --git a/block/bio.c b/block/bio.c
> index 2359c0723b88..18dfdaba0c73 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -1172,33 +1172,35 @@ void bio_iov_bvec_set(struct bio *bio, const struct iov_iter *iter)
> bio_set_flag(bio, BIO_CLONED);
> }
>
> -static unsigned int get_contig_folio_len(unsigned int *num_pages,
> - struct page **pages, unsigned int i,
> - struct folio *folio, size_t left,
> +static unsigned int get_contig_folio_len(struct page **pages,
> + unsigned int *num_pages, size_t left,
> size_t offset)
> {
> - size_t bytes = left;
> - size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, bytes);
> - unsigned int j;
> + struct folio *folio = page_folio(pages[0]);
> + size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, left);
> + unsigned int max_pages, i;
> + size_t folio_offset, len;
> +
> + folio_offset = PAGE_SIZE * folio_page_idx(folio, pages[0]) + offset;
> + len = min(folio_size(folio) - folio_offset, left);
>
> /*
> - * We might COW a single page in the middle of
> - * a large folio, so we have to check that all
> - * pages belong to the same folio.
> + * We might COW a single page in the middle of a large folio, so we have
> + * to check that all pages belong to the same folio.
> */
> - bytes -= contig_sz;
> - for (j = i + 1; j < i + *num_pages; j++) {
> - size_t next = min_t(size_t, PAGE_SIZE, bytes);
> + left -= contig_sz;
> + max_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
> + for (i = 1; i < max_pages; i++) {
> + size_t next = min_t(size_t, PAGE_SIZE, left);
>
> - if (page_folio(pages[j]) != folio ||
> - pages[j] != pages[j - 1] + 1) {
> + if (page_folio(pages[i]) != folio ||
> + pages[i] != pages[i - 1] + 1)
> break;
> - }
> contig_sz += next;
> - bytes -= next;
> + left -= next;
> }
> - *num_pages = j - i;
>
> + *num_pages = i;
> return contig_sz;
> }
>
> @@ -1222,8 +1224,8 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
> struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt;
> struct page **pages = (struct page **)bv;
> ssize_t size;
> - unsigned int num_pages, i = 0;
> - size_t offset, folio_offset, left, len;
> + unsigned int i = 0;
> + size_t offset, left, len;
> int ret = 0;
>
> /*
> @@ -1244,23 +1246,12 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
> return size ? size : -EFAULT;
>
> nr_pages = DIV_ROUND_UP(offset + size, PAGE_SIZE);
> - for (left = size, i = 0; left > 0; left -= len, i += num_pages) {
> - struct page *page = pages[i];
> - struct folio *folio = page_folio(page);
> + for (left = size; left > 0; left -= len) {
> unsigned int old_vcnt = bio->bi_vcnt;
> + unsigned int nr_to_add;
>
> - folio_offset = ((size_t)folio_page_idx(folio, page) <<
> - PAGE_SHIFT) + offset;
> -
> - len = min(folio_size(folio) - folio_offset, left);
> -
> - num_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
> -
> - if (num_pages > 1)
> - len = get_contig_folio_len(&num_pages, pages, i,
> - folio, left, offset);
> -
> - if (!bio_add_folio(bio, folio, len, folio_offset)) {
> + len = get_contig_folio_len(&pages[i], &nr_to_add, left, offset);
> + if (!bio_add_page(bio, pages[i], len, offset)) {
> WARN_ON_ONCE(1);
> ret = -EINVAL;
> goto out;
> @@ -1275,8 +1266,9 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
> * single pin per page.
> */
> if (offset && bio->bi_vcnt == old_vcnt)
> - unpin_user_folio(folio, 1);
> + unpin_user_folio(page_folio(pages[i]), 1);
> }
> + i += nr_to_add;
> offset = 0;
> }
>
> --
> 2.47.3
>
>
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 01/14] block: refactor get_contig_folio_len
2026-01-19 7:44 ` [PATCH 01/14] block: refactor get_contig_folio_len Christoph Hellwig
2026-01-22 11:00 ` Johannes Thumshirn
2026-01-22 17:54 ` Darrick J. Wong
@ 2026-01-23 8:32 ` Damien Le Moal
2026-01-23 8:35 ` Christoph Hellwig
2026-01-23 8:45 ` Damien Le Moal
2026-01-23 12:14 ` Anuj Gupta
4 siblings, 1 reply; 76+ messages in thread
From: Damien Le Moal @ 2026-01-23 8:32 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe, Christian Brauner
Cc: Darrick J. Wong, Carlos Maiolino, Qu Wenruo, Al Viro, linux-block,
linux-xfs, linux-fsdevel
On 2026/01/19 18:44, Christoph Hellwig wrote:
> Move all of the logic to find the contigous length inside a folio into
> get_contig_folio_len instead of keeping some of it in the caller.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> block/bio.c | 62 +++++++++++++++++++++++------------------------------
> 1 file changed, 27 insertions(+), 35 deletions(-)
>
> diff --git a/block/bio.c b/block/bio.c
> index 2359c0723b88..18dfdaba0c73 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -1172,33 +1172,35 @@ void bio_iov_bvec_set(struct bio *bio, const struct iov_iter *iter)
> bio_set_flag(bio, BIO_CLONED);
> }
>
> -static unsigned int get_contig_folio_len(unsigned int *num_pages,
> - struct page **pages, unsigned int i,
> - struct folio *folio, size_t left,
> +static unsigned int get_contig_folio_len(struct page **pages,
> + unsigned int *num_pages, size_t left,
> size_t offset)
> {
> - size_t bytes = left;
> - size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, bytes);
> - unsigned int j;
> + struct folio *folio = page_folio(pages[0]);
> + size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, left);
> + unsigned int max_pages, i;
> + size_t folio_offset, len;
> +
> + folio_offset = PAGE_SIZE * folio_page_idx(folio, pages[0]) + offset;
folio_page_idx(folio, pages[0]) is always going to be 0 here, no ?
> + len = min(folio_size(folio) - folio_offset, left);
>
> /*
> - * We might COW a single page in the middle of
> - * a large folio, so we have to check that all
> - * pages belong to the same folio.
> + * We might COW a single page in the middle of a large folio, so we have
> + * to check that all pages belong to the same folio.
> */
> - bytes -= contig_sz;
> - for (j = i + 1; j < i + *num_pages; j++) {
> - size_t next = min_t(size_t, PAGE_SIZE, bytes);
> + left -= contig_sz;
> + max_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
> + for (i = 1; i < max_pages; i++) {
> + size_t next = min_t(size_t, PAGE_SIZE, left);
>
> - if (page_folio(pages[j]) != folio ||
> - pages[j] != pages[j - 1] + 1) {
> + if (page_folio(pages[i]) != folio ||
> + pages[i] != pages[i - 1] + 1)
> break;
> - }
> contig_sz += next;
> - bytes -= next;
> + left -= next;
> }
> - *num_pages = j - i;
>
> + *num_pages = i;
> return contig_sz;
> }
>
> @@ -1222,8 +1224,8 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
> struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt;
> struct page **pages = (struct page **)bv;
> ssize_t size;
> - unsigned int num_pages, i = 0;
> - size_t offset, folio_offset, left, len;
> + unsigned int i = 0;
> + size_t offset, left, len;
> int ret = 0;
>
> /*
> @@ -1244,23 +1246,12 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
> return size ? size : -EFAULT;
>
> nr_pages = DIV_ROUND_UP(offset + size, PAGE_SIZE);
> - for (left = size, i = 0; left > 0; left -= len, i += num_pages) {
> - struct page *page = pages[i];
> - struct folio *folio = page_folio(page);
> + for (left = size; left > 0; left -= len) {
> unsigned int old_vcnt = bio->bi_vcnt;
> + unsigned int nr_to_add;
>
> - folio_offset = ((size_t)folio_page_idx(folio, page) <<
> - PAGE_SHIFT) + offset;
> -
> - len = min(folio_size(folio) - folio_offset, left);
> -
> - num_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
> -
> - if (num_pages > 1)
> - len = get_contig_folio_len(&num_pages, pages, i,
> - folio, left, offset);
> -
> - if (!bio_add_folio(bio, folio, len, folio_offset)) {
> + len = get_contig_folio_len(&pages[i], &nr_to_add, left, offset);
> + if (!bio_add_page(bio, pages[i], len, offset)) {
> WARN_ON_ONCE(1);
> ret = -EINVAL;
> goto out;
> @@ -1275,8 +1266,9 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
> * single pin per page.
> */
> if (offset && bio->bi_vcnt == old_vcnt)
> - unpin_user_folio(folio, 1);
> + unpin_user_folio(page_folio(pages[i]), 1);
> }
> + i += nr_to_add;
> offset = 0;
> }
>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 01/14] block: refactor get_contig_folio_len
2026-01-23 8:32 ` Damien Le Moal
@ 2026-01-23 8:35 ` Christoph Hellwig
2026-01-23 8:44 ` Damien Le Moal
0 siblings, 1 reply; 76+ messages in thread
From: Christoph Hellwig @ 2026-01-23 8:35 UTC (permalink / raw)
To: Damien Le Moal
Cc: Christoph Hellwig, Jens Axboe, Christian Brauner, Darrick J. Wong,
Carlos Maiolino, Qu Wenruo, Al Viro, linux-block, linux-xfs,
linux-fsdevel
On Fri, Jan 23, 2026 at 07:32:04PM +1100, Damien Le Moal wrote:
> > - unsigned int j;
> > + struct folio *folio = page_folio(pages[0]);
> > + size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, left);
> > + unsigned int max_pages, i;
> > + size_t folio_offset, len;
> > +
> > + folio_offset = PAGE_SIZE * folio_page_idx(folio, pages[0]) + offset;
>
> folio_page_idx(folio, pages[0]) is always going to be 0 here, no ?
No, page could be at an offset into the folio.
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 01/14] block: refactor get_contig_folio_len
2026-01-23 8:35 ` Christoph Hellwig
@ 2026-01-23 8:44 ` Damien Le Moal
0 siblings, 0 replies; 76+ messages in thread
From: Damien Le Moal @ 2026-01-23 8:44 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Christian Brauner, Darrick J. Wong, Carlos Maiolino,
Qu Wenruo, Al Viro, linux-block, linux-xfs, linux-fsdevel
On 2026/01/23 19:35, Christoph Hellwig wrote:
> On Fri, Jan 23, 2026 at 07:32:04PM +1100, Damien Le Moal wrote:
>>> - unsigned int j;
>>> + struct folio *folio = page_folio(pages[0]);
>>> + size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, left);
>>> + unsigned int max_pages, i;
>>> + size_t folio_offset, len;
>>> +
>>> + folio_offset = PAGE_SIZE * folio_page_idx(folio, pages[0]) + offset;
>>
>> folio_page_idx(folio, pages[0]) is always going to be 0 here, no ?
>
> No, page could be at an offset into the folio.
Arg... yes. pages[0] may not be the first page of the compound page...
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 01/14] block: refactor get_contig_folio_len
2026-01-19 7:44 ` [PATCH 01/14] block: refactor get_contig_folio_len Christoph Hellwig
` (2 preceding siblings ...)
2026-01-23 8:32 ` Damien Le Moal
@ 2026-01-23 8:45 ` Damien Le Moal
2026-01-23 12:14 ` Anuj Gupta
4 siblings, 0 replies; 76+ messages in thread
From: Damien Le Moal @ 2026-01-23 8:45 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe, Christian Brauner
Cc: Darrick J. Wong, Carlos Maiolino, Qu Wenruo, Al Viro, linux-block,
linux-xfs, linux-fsdevel
On 2026/01/19 18:44, Christoph Hellwig wrote:
> Move all of the logic to find the contigous length inside a folio into
> get_contig_folio_len instead of keeping some of it in the caller.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks OK to me.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 01/14] block: refactor get_contig_folio_len
2026-01-19 7:44 ` [PATCH 01/14] block: refactor get_contig_folio_len Christoph Hellwig
` (3 preceding siblings ...)
2026-01-23 8:45 ` Damien Le Moal
@ 2026-01-23 12:14 ` Anuj Gupta
4 siblings, 0 replies; 76+ messages in thread
From: Anuj Gupta @ 2026-01-23 12:14 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Christian Brauner, Darrick J. Wong, Carlos Maiolino,
Qu Wenruo, Al Viro, linux-block, linux-xfs, linux-fsdevel
[-- Attachment #1: Type: text/plain, Size: 281 bytes --]
On 19/01/26 08:44AM, Christoph Hellwig wrote:
>Move all of the logic to find the contigous length inside a folio into
>get_contig_folio_len instead of keeping some of it in the caller.
>
>Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 76+ messages in thread
* [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges
2026-01-19 7:44 ` bounce buffer direct I/O when stable pages are required v2 Christoph Hellwig
2026-01-19 7:44 ` [PATCH 01/14] block: refactor get_contig_folio_len Christoph Hellwig
@ 2026-01-19 7:44 ` Christoph Hellwig
2026-01-22 11:04 ` Johannes Thumshirn
` (3 more replies)
2026-01-19 7:44 ` [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code Christoph Hellwig
` (13 subsequent siblings)
15 siblings, 4 replies; 76+ messages in thread
From: Christoph Hellwig @ 2026-01-19 7:44 UTC (permalink / raw)
To: Jens Axboe, Christian Brauner
Cc: Darrick J. Wong, Carlos Maiolino, Qu Wenruo, Al Viro, linux-block,
linux-xfs, linux-fsdevel
bio_add_page fails to add data to the bio when mixing P2P with non-P2P
ranges, or ranges that map to different P2P providers. In that case
it will trigger that WARN_ON and return an error up the chain instead of
simply starting a new bio as intended. Fix this by open coding
bio_add_page and handling this case explicitly. While doing so, stop
merging physical contiguous data that belongs to multiple folios. While
this merge could lead to more efficient bio packing in some case,
dropping will allow to remove handling of this corner case in other
places and make the code more robust.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/bio.c | 37 +++++++++++++------------------------
1 file changed, 13 insertions(+), 24 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 18dfdaba0c73..46ff33f4de04 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1216,7 +1216,7 @@ static unsigned int get_contig_folio_len(struct page **pages,
* For a multi-segment *iter, this function only adds pages from the next
* non-empty segment of the iov iterator.
*/
-static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
+static ssize_t __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
{
iov_iter_extraction_t extraction_flags = 0;
unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt;
@@ -1226,7 +1226,6 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
ssize_t size;
unsigned int i = 0;
size_t offset, left, len;
- int ret = 0;
/*
* Move page array up in the allocated memory for the bio vecs as far as
@@ -1247,37 +1246,26 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
nr_pages = DIV_ROUND_UP(offset + size, PAGE_SIZE);
for (left = size; left > 0; left -= len) {
- unsigned int old_vcnt = bio->bi_vcnt;
unsigned int nr_to_add;
- len = get_contig_folio_len(&pages[i], &nr_to_add, left, offset);
- if (!bio_add_page(bio, pages[i], len, offset)) {
- WARN_ON_ONCE(1);
- ret = -EINVAL;
- goto out;
- }
+ if (bio->bi_vcnt > 0) {
+ struct bio_vec *prev = &bio->bi_io_vec[bio->bi_vcnt - 1];
- if (bio_flagged(bio, BIO_PAGE_PINNED)) {
- /*
- * We're adding another fragment of a page that already
- * was part of the last segment. Undo our pin as the
- * page was pinned when an earlier fragment of it was
- * added to the bio and __bio_release_pages expects a
- * single pin per page.
- */
- if (offset && bio->bi_vcnt == old_vcnt)
- unpin_user_folio(page_folio(pages[i]), 1);
+ if (!zone_device_pages_have_same_pgmap(prev->bv_page,
+ pages[i]))
+ break;
}
+
+ len = get_contig_folio_len(&pages[i], &nr_to_add, left, offset);
+ __bio_add_page(bio, pages[i], len, offset);
i += nr_to_add;
offset = 0;
}
iov_iter_revert(iter, left);
-out:
while (i < nr_pages)
bio_release_page(bio, pages[i++]);
-
- return ret;
+ return size - left;
}
/*
@@ -1337,7 +1325,7 @@ static int bio_iov_iter_align_down(struct bio *bio, struct iov_iter *iter,
int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter,
unsigned len_align_mask)
{
- int ret = 0;
+ ssize_t ret;
if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)))
return -EIO;
@@ -1350,9 +1338,10 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter,
if (iov_iter_extract_will_pin(iter))
bio_set_flag(bio, BIO_PAGE_PINNED);
+
do {
ret = __bio_iov_iter_get_pages(bio, iter);
- } while (!ret && iov_iter_count(iter) && !bio_full(bio, 0));
+ } while (ret > 0 && iov_iter_count(iter) && !bio_full(bio, 0));
if (bio->bi_vcnt)
return bio_iov_iter_align_down(bio, iter, len_align_mask);
--
2.47.3
^ permalink raw reply related [flat|nested] 76+ messages in thread* Re: [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges
2026-01-19 7:44 ` [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges Christoph Hellwig
@ 2026-01-22 11:04 ` Johannes Thumshirn
2026-01-22 17:59 ` Darrick J. Wong
` (2 subsequent siblings)
3 siblings, 0 replies; 76+ messages in thread
From: Johannes Thumshirn @ 2026-01-22 11:04 UTC (permalink / raw)
To: hch, Jens Axboe, Christian Brauner
Cc: Darrick J. Wong, Carlos Maiolino, WenRuo Qu, Al Viro,
linux-block@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges
2026-01-19 7:44 ` [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges Christoph Hellwig
2026-01-22 11:04 ` Johannes Thumshirn
@ 2026-01-22 17:59 ` Darrick J. Wong
2026-01-23 5:43 ` Christoph Hellwig
2026-01-23 8:35 ` Damien Le Moal
2026-01-23 12:15 ` Anuj Gupta
3 siblings, 1 reply; 76+ messages in thread
From: Darrick J. Wong @ 2026-01-22 17:59 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Christian Brauner, Carlos Maiolino, Qu Wenruo,
Al Viro, linux-block, linux-xfs, linux-fsdevel
On Mon, Jan 19, 2026 at 08:44:09AM +0100, Christoph Hellwig wrote:
> bio_add_page fails to add data to the bio when mixing P2P with non-P2P
> ranges, or ranges that map to different P2P providers. In that case
> it will trigger that WARN_ON and return an error up the chain instead of
> simply starting a new bio as intended. Fix this by open coding
AFAICT we've already done all the other checks in bio_add_page, so
calling __bio_add_page directly from within the loop is ok since you've
explicitly handled the !zone_device_pages_have_same_pgmap() case.
> bio_add_page and handling this case explicitly. While doing so, stop
> merging physical contiguous data that belongs to multiple folios. While
> this merge could lead to more efficient bio packing in some case,
> dropping will allow to remove handling of this corner case in other
> places and make the code more robust.
That does sound like a landmine waiting to go off...
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks good to me,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> block/bio.c | 37 +++++++++++++------------------------
> 1 file changed, 13 insertions(+), 24 deletions(-)
>
> diff --git a/block/bio.c b/block/bio.c
> index 18dfdaba0c73..46ff33f4de04 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -1216,7 +1216,7 @@ static unsigned int get_contig_folio_len(struct page **pages,
> * For a multi-segment *iter, this function only adds pages from the next
> * non-empty segment of the iov iterator.
> */
> -static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
> +static ssize_t __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
> {
> iov_iter_extraction_t extraction_flags = 0;
> unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt;
> @@ -1226,7 +1226,6 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
> ssize_t size;
> unsigned int i = 0;
> size_t offset, left, len;
> - int ret = 0;
>
> /*
> * Move page array up in the allocated memory for the bio vecs as far as
> @@ -1247,37 +1246,26 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
>
> nr_pages = DIV_ROUND_UP(offset + size, PAGE_SIZE);
> for (left = size; left > 0; left -= len) {
> - unsigned int old_vcnt = bio->bi_vcnt;
> unsigned int nr_to_add;
>
> - len = get_contig_folio_len(&pages[i], &nr_to_add, left, offset);
> - if (!bio_add_page(bio, pages[i], len, offset)) {
> - WARN_ON_ONCE(1);
> - ret = -EINVAL;
> - goto out;
> - }
> + if (bio->bi_vcnt > 0) {
> + struct bio_vec *prev = &bio->bi_io_vec[bio->bi_vcnt - 1];
>
> - if (bio_flagged(bio, BIO_PAGE_PINNED)) {
> - /*
> - * We're adding another fragment of a page that already
> - * was part of the last segment. Undo our pin as the
> - * page was pinned when an earlier fragment of it was
> - * added to the bio and __bio_release_pages expects a
> - * single pin per page.
> - */
> - if (offset && bio->bi_vcnt == old_vcnt)
> - unpin_user_folio(page_folio(pages[i]), 1);
> + if (!zone_device_pages_have_same_pgmap(prev->bv_page,
> + pages[i]))
> + break;
> }
> +
> + len = get_contig_folio_len(&pages[i], &nr_to_add, left, offset);
> + __bio_add_page(bio, pages[i], len, offset);
> i += nr_to_add;
> offset = 0;
> }
>
> iov_iter_revert(iter, left);
> -out:
> while (i < nr_pages)
> bio_release_page(bio, pages[i++]);
> -
> - return ret;
> + return size - left;
> }
>
> /*
> @@ -1337,7 +1325,7 @@ static int bio_iov_iter_align_down(struct bio *bio, struct iov_iter *iter,
> int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter,
> unsigned len_align_mask)
> {
> - int ret = 0;
> + ssize_t ret;
>
> if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)))
> return -EIO;
> @@ -1350,9 +1338,10 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter,
>
> if (iov_iter_extract_will_pin(iter))
> bio_set_flag(bio, BIO_PAGE_PINNED);
> +
> do {
> ret = __bio_iov_iter_get_pages(bio, iter);
> - } while (!ret && iov_iter_count(iter) && !bio_full(bio, 0));
> + } while (ret > 0 && iov_iter_count(iter) && !bio_full(bio, 0));
>
> if (bio->bi_vcnt)
> return bio_iov_iter_align_down(bio, iter, len_align_mask);
> --
> 2.47.3
>
>
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges
2026-01-22 17:59 ` Darrick J. Wong
@ 2026-01-23 5:43 ` Christoph Hellwig
2026-01-23 7:05 ` Darrick J. Wong
0 siblings, 1 reply; 76+ messages in thread
From: Christoph Hellwig @ 2026-01-23 5:43 UTC (permalink / raw)
To: Darrick J. Wong
Cc: Christoph Hellwig, Jens Axboe, Christian Brauner, Carlos Maiolino,
Qu Wenruo, Al Viro, linux-block, linux-xfs, linux-fsdevel
On Thu, Jan 22, 2026 at 09:59:08AM -0800, Darrick J. Wong wrote:
> On Mon, Jan 19, 2026 at 08:44:09AM +0100, Christoph Hellwig wrote:
> > bio_add_page fails to add data to the bio when mixing P2P with non-P2P
> > ranges, or ranges that map to different P2P providers. In that case
> > it will trigger that WARN_ON and return an error up the chain instead of
> > simply starting a new bio as intended. Fix this by open coding
>
> AFAICT we've already done all the other checks in bio_add_page, so
> calling __bio_add_page directly from within the loop is ok since you've
> explicitly handled the !zone_device_pages_have_same_pgmap() case.
>
> > bio_add_page and handling this case explicitly. While doing so, stop
> > merging physical contiguous data that belongs to multiple folios. While
> > this merge could lead to more efficient bio packing in some case,
> > dropping will allow to remove handling of this corner case in other
> > places and make the code more robust.
>
> That does sound like a landmine waiting to go off...
What? Removing the handling?
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges
2026-01-23 5:43 ` Christoph Hellwig
@ 2026-01-23 7:05 ` Darrick J. Wong
0 siblings, 0 replies; 76+ messages in thread
From: Darrick J. Wong @ 2026-01-23 7:05 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Christian Brauner, Carlos Maiolino, Qu Wenruo,
Al Viro, linux-block, linux-xfs, linux-fsdevel
On Fri, Jan 23, 2026 at 06:43:14AM +0100, Christoph Hellwig wrote:
> On Thu, Jan 22, 2026 at 09:59:08AM -0800, Darrick J. Wong wrote:
> > On Mon, Jan 19, 2026 at 08:44:09AM +0100, Christoph Hellwig wrote:
> > > bio_add_page fails to add data to the bio when mixing P2P with non-P2P
> > > ranges, or ranges that map to different P2P providers. In that case
> > > it will trigger that WARN_ON and return an error up the chain instead of
> > > simply starting a new bio as intended. Fix this by open coding
> >
> > AFAICT we've already done all the other checks in bio_add_page, so
> > calling __bio_add_page directly from within the loop is ok since you've
> > explicitly handled the !zone_device_pages_have_same_pgmap() case.
> >
> > > bio_add_page and handling this case explicitly. While doing so, stop
> > > merging physical contiguous data that belongs to multiple folios. While
> > > this merge could lead to more efficient bio packing in some case,
> > > dropping will allow to remove handling of this corner case in other
> > > places and make the code more robust.
> >
> > That does sound like a landmine waiting to go off...
>
> What? Removing the handling?
Urk, sorry. I meant to say that the *old code* combining pages from
multiple folios sounded like a landmine waiting to go off.
--D
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges
2026-01-19 7:44 ` [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges Christoph Hellwig
2026-01-22 11:04 ` Johannes Thumshirn
2026-01-22 17:59 ` Darrick J. Wong
@ 2026-01-23 8:35 ` Damien Le Moal
2026-01-23 12:15 ` Anuj Gupta
3 siblings, 0 replies; 76+ messages in thread
From: Damien Le Moal @ 2026-01-23 8:35 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe, Christian Brauner
Cc: Darrick J. Wong, Carlos Maiolino, Qu Wenruo, Al Viro, linux-block,
linux-xfs, linux-fsdevel
On 2026/01/19 18:44, Christoph Hellwig wrote:
> bio_add_page fails to add data to the bio when mixing P2P with non-P2P
> ranges, or ranges that map to different P2P providers. In that case
> it will trigger that WARN_ON and return an error up the chain instead of
> simply starting a new bio as intended. Fix this by open coding
> bio_add_page and handling this case explicitly. While doing so, stop
> merging physical contiguous data that belongs to multiple folios. While
> this merge could lead to more efficient bio packing in some case,
> dropping will allow to remove handling of this corner case in other
> places and make the code more robust.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks OK to me.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges
2026-01-19 7:44 ` [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges Christoph Hellwig
` (2 preceding siblings ...)
2026-01-23 8:35 ` Damien Le Moal
@ 2026-01-23 12:15 ` Anuj Gupta
3 siblings, 0 replies; 76+ messages in thread
From: Anuj Gupta @ 2026-01-23 12:15 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Christian Brauner, Darrick J. Wong, Carlos Maiolino,
Qu Wenruo, Al Viro, linux-block, linux-xfs, linux-fsdevel
[-- Attachment #1: Type: text/plain, Size: 743 bytes --]
On 19/01/26 08:44AM, Christoph Hellwig wrote:
>bio_add_page fails to add data to the bio when mixing P2P with non-P2P
>ranges, or ranges that map to different P2P providers. In that case
>it will trigger that WARN_ON and return an error up the chain instead of
>simply starting a new bio as intended. Fix this by open coding
>bio_add_page and handling this case explicitly. While doing so, stop
>merging physical contiguous data that belongs to multiple folios. While
>this merge could lead to more efficient bio packing in some case,
>dropping will allow to remove handling of this corner case in other
>places and make the code more robust.
>
>Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 76+ messages in thread
* [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-19 7:44 ` bounce buffer direct I/O when stable pages are required v2 Christoph Hellwig
2026-01-19 7:44 ` [PATCH 01/14] block: refactor get_contig_folio_len Christoph Hellwig
2026-01-19 7:44 ` [PATCH 02/14] block: open code bio_add_page and fix handling of mismatching P2P ranges Christoph Hellwig
@ 2026-01-19 7:44 ` Christoph Hellwig
2026-01-22 17:47 ` Darrick J. Wong
2026-01-23 11:37 ` David Howells
2026-01-19 7:44 ` [PATCH 04/14] block: remove bio_release_page Christoph Hellwig
` (12 subsequent siblings)
15 siblings, 2 replies; 76+ messages in thread
From: Christoph Hellwig @ 2026-01-19 7:44 UTC (permalink / raw)
To: Jens Axboe, Christian Brauner
Cc: Darrick J. Wong, Carlos Maiolino, Qu Wenruo, Al Viro, linux-block,
linux-xfs, linux-fsdevel
Massage __bio_iov_iter_get_pages so that it doesn't need the bio, and
move it to lib/iov_iter.c so that it can be used by block code for
other things than filling a bio and by other subsystems like netfs.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/bio.c | 120 +++++++-------------------------------------
include/linux/uio.h | 3 ++
lib/iov_iter.c | 98 ++++++++++++++++++++++++++++++++++++
3 files changed, 119 insertions(+), 102 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 46ff33f4de04..12cd3c5f6d6d 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1172,102 +1172,6 @@ void bio_iov_bvec_set(struct bio *bio, const struct iov_iter *iter)
bio_set_flag(bio, BIO_CLONED);
}
-static unsigned int get_contig_folio_len(struct page **pages,
- unsigned int *num_pages, size_t left,
- size_t offset)
-{
- struct folio *folio = page_folio(pages[0]);
- size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, left);
- unsigned int max_pages, i;
- size_t folio_offset, len;
-
- folio_offset = PAGE_SIZE * folio_page_idx(folio, pages[0]) + offset;
- len = min(folio_size(folio) - folio_offset, left);
-
- /*
- * We might COW a single page in the middle of a large folio, so we have
- * to check that all pages belong to the same folio.
- */
- left -= contig_sz;
- max_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
- for (i = 1; i < max_pages; i++) {
- size_t next = min_t(size_t, PAGE_SIZE, left);
-
- if (page_folio(pages[i]) != folio ||
- pages[i] != pages[i - 1] + 1)
- break;
- contig_sz += next;
- left -= next;
- }
-
- *num_pages = i;
- return contig_sz;
-}
-
-#define PAGE_PTRS_PER_BVEC (sizeof(struct bio_vec) / sizeof(struct page *))
-
-/**
- * __bio_iov_iter_get_pages - pin user or kernel pages and add them to a bio
- * @bio: bio to add pages to
- * @iter: iov iterator describing the region to be mapped
- *
- * Extracts pages from *iter and appends them to @bio's bvec array. The pages
- * will have to be cleaned up in the way indicated by the BIO_PAGE_PINNED flag.
- * For a multi-segment *iter, this function only adds pages from the next
- * non-empty segment of the iov iterator.
- */
-static ssize_t __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
-{
- iov_iter_extraction_t extraction_flags = 0;
- unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt;
- unsigned short entries_left = bio->bi_max_vecs - bio->bi_vcnt;
- struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt;
- struct page **pages = (struct page **)bv;
- ssize_t size;
- unsigned int i = 0;
- size_t offset, left, len;
-
- /*
- * Move page array up in the allocated memory for the bio vecs as far as
- * possible so that we can start filling biovecs from the beginning
- * without overwriting the temporary page array.
- */
- BUILD_BUG_ON(PAGE_PTRS_PER_BVEC < 2);
- pages += entries_left * (PAGE_PTRS_PER_BVEC - 1);
-
- if (bio->bi_bdev && blk_queue_pci_p2pdma(bio->bi_bdev->bd_disk->queue))
- extraction_flags |= ITER_ALLOW_P2PDMA;
-
- size = iov_iter_extract_pages(iter, &pages,
- UINT_MAX - bio->bi_iter.bi_size,
- nr_pages, extraction_flags, &offset);
- if (unlikely(size <= 0))
- return size ? size : -EFAULT;
-
- nr_pages = DIV_ROUND_UP(offset + size, PAGE_SIZE);
- for (left = size; left > 0; left -= len) {
- unsigned int nr_to_add;
-
- if (bio->bi_vcnt > 0) {
- struct bio_vec *prev = &bio->bi_io_vec[bio->bi_vcnt - 1];
-
- if (!zone_device_pages_have_same_pgmap(prev->bv_page,
- pages[i]))
- break;
- }
-
- len = get_contig_folio_len(&pages[i], &nr_to_add, left, offset);
- __bio_add_page(bio, pages[i], len, offset);
- i += nr_to_add;
- offset = 0;
- }
-
- iov_iter_revert(iter, left);
- while (i < nr_pages)
- bio_release_page(bio, pages[i++]);
- return size - left;
-}
-
/*
* Aligns the bio size to the len_align_mask, releasing excessive bio vecs that
* __bio_iov_iter_get_pages may have inserted, and reverts the trimmed length
@@ -1325,7 +1229,7 @@ static int bio_iov_iter_align_down(struct bio *bio, struct iov_iter *iter,
int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter,
unsigned len_align_mask)
{
- ssize_t ret;
+ iov_iter_extraction_t flags = 0;
if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)))
return -EIO;
@@ -1338,14 +1242,26 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter,
if (iov_iter_extract_will_pin(iter))
bio_set_flag(bio, BIO_PAGE_PINNED);
+ if (bio->bi_bdev && blk_queue_pci_p2pdma(bio->bi_bdev->bd_disk->queue))
+ flags |= ITER_ALLOW_P2PDMA;
do {
- ret = __bio_iov_iter_get_pages(bio, iter);
- } while (ret > 0 && iov_iter_count(iter) && !bio_full(bio, 0));
+ ssize_t ret;
+
+ ret = iov_iter_extract_bvecs(iter, bio->bi_io_vec,
+ UINT_MAX - bio->bi_iter.bi_size, &bio->bi_vcnt,
+ bio->bi_max_vecs, flags);
+ if (ret <= 0) {
+ if (!bio->bi_vcnt)
+ return ret;
+ break;
+ }
+ bio->bi_iter.bi_size += ret;
+ } while (iov_iter_count(iter) && !bio_full(bio, 0));
- if (bio->bi_vcnt)
- return bio_iov_iter_align_down(bio, iter, len_align_mask);
- return ret;
+ if (is_pci_p2pdma_page(bio->bi_io_vec->bv_page))
+ bio->bi_opf |= REQ_NOMERGE;
+ return bio_iov_iter_align_down(bio, iter, len_align_mask);
}
static void submit_bio_wait_endio(struct bio *bio)
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 5b127043a151..a9bc5b3067e3 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -389,6 +389,9 @@ ssize_t iov_iter_extract_pages(struct iov_iter *i, struct page ***pages,
size_t maxsize, unsigned int maxpages,
iov_iter_extraction_t extraction_flags,
size_t *offset0);
+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, iov_iter_extraction_t extraction_flags);
/**
* iov_iter_extract_will_pin - Indicate how pages from the iterator will be retained
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 896760bad455..545250507f08 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1845,3 +1845,101 @@ ssize_t iov_iter_extract_pages(struct iov_iter *i,
return -EFAULT;
}
EXPORT_SYMBOL_GPL(iov_iter_extract_pages);
+
+static unsigned int get_contig_folio_len(struct page **pages,
+ unsigned int *num_pages, size_t left, size_t offset)
+{
+ struct folio *folio = page_folio(pages[0]);
+ size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, left);
+ unsigned int max_pages, i;
+ size_t folio_offset, len;
+
+ folio_offset = PAGE_SIZE * folio_page_idx(folio, pages[0]) + offset;
+ len = min(folio_size(folio) - folio_offset, left);
+
+ /*
+ * We might COW a single page in the middle of a large folio, so we have
+ * to check that all pages belong to the same folio.
+ */
+ left -= contig_sz;
+ max_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
+ for (i = 1; i < max_pages; i++) {
+ size_t next = min_t(size_t, PAGE_SIZE, left);
+
+ if (page_folio(pages[i]) != folio ||
+ pages[i] != pages[i - 1] + 1)
+ break;
+ contig_sz += next;
+ left -= next;
+ }
+
+ *num_pages = i;
+ return contig_sz;
+}
+
+#define PAGE_PTRS_PER_BVEC (sizeof(struct bio_vec) / sizeof(struct page *))
+
+/**
+ * iov_iter_extract_bvecs - Extract bvecs from an iterator
+ * @iter: the iterator to extract from
+ * @bv: bvec return array
+ * @max_size: maximum size to extract from @iter
+ * @nr_vecs: number of vectors in @bv (on in and output)
+ * @max_vecs: maximum vectors in @bv, including those filled before calling
+ * @extraction_flags: flags to qualify request
+ *
+ * Like iov_iter_extract_pages(), but returns physically contiguous ranges
+ * contained in a single folio as a single bvec instead of multiple entries.
+ *
+ * Returns the number of bytes extracted when successful, or a negative errno.
+ * If @nr_vecs was non-zero on entry, the number of successfully extracted bytes
+ * can be 0.
+ */
+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, iov_iter_extraction_t extraction_flags)
+{
+ unsigned short entries_left = max_vecs - *nr_vecs;
+ unsigned short nr_pages, i = 0;
+ size_t left, offset, len;
+ struct page **pages;
+ ssize_t size;
+
+ /*
+ * Move page array up in the allocated memory for the bio vecs as far as
+ * possible so that we can start filling biovecs from the beginning
+ * without overwriting the temporary page array.
+ */
+ BUILD_BUG_ON(PAGE_PTRS_PER_BVEC < 2);
+ pages = (struct page **)(bv + *nr_vecs) +
+ entries_left * (PAGE_PTRS_PER_BVEC - 1);
+
+ size = iov_iter_extract_pages(iter, &pages, max_size, entries_left,
+ extraction_flags, &offset);
+ if (unlikely(size <= 0))
+ return size ? size : -EFAULT;
+
+ nr_pages = DIV_ROUND_UP(offset + size, PAGE_SIZE);
+ for (left = size; left > 0; left -= len) {
+ unsigned int nr_to_add;
+
+ if (*nr_vecs > 0 &&
+ !zone_device_pages_have_same_pgmap(bv[*nr_vecs - 1].bv_page,
+ pages[i]))
+ break;
+
+ len = get_contig_folio_len(&pages[i], &nr_to_add, left, offset);
+ bvec_set_page(&bv[*nr_vecs], pages[i], len, offset);
+ i += nr_to_add;
+ (*nr_vecs)++;
+ offset = 0;
+ }
+
+ iov_iter_revert(iter, left);
+ if (iov_iter_extract_will_pin(iter)) {
+ while (i < nr_pages)
+ unpin_user_page(pages[i++]);
+ }
+ return size - left;
+}
+EXPORT_SYMBOL_GPL(iov_iter_extract_bvecs);
--
2.47.3
^ permalink raw reply related [flat|nested] 76+ messages in thread* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-19 7:44 ` [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code Christoph Hellwig
@ 2026-01-22 17:47 ` Darrick J. Wong
2026-01-23 5:44 ` Christoph Hellwig
2026-01-23 11:37 ` David Howells
1 sibling, 1 reply; 76+ messages in thread
From: Darrick J. Wong @ 2026-01-22 17:47 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Christian Brauner, Carlos Maiolino, Qu Wenruo,
Al Viro, linux-block, linux-xfs, linux-fsdevel
On Mon, Jan 19, 2026 at 08:44:10AM +0100, Christoph Hellwig wrote:
> Massage __bio_iov_iter_get_pages so that it doesn't need the bio, and
> move it to lib/iov_iter.c so that it can be used by block code for
> other things than filling a bio and by other subsystems like netfs.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> block/bio.c | 120 +++++++-------------------------------------
> include/linux/uio.h | 3 ++
> lib/iov_iter.c | 98 ++++++++++++++++++++++++++++++++++++
> 3 files changed, 119 insertions(+), 102 deletions(-)
>
> diff --git a/block/bio.c b/block/bio.c
> index 46ff33f4de04..12cd3c5f6d6d 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -1172,102 +1172,6 @@ void bio_iov_bvec_set(struct bio *bio, const struct iov_iter *iter)
> bio_set_flag(bio, BIO_CLONED);
> }
>
> -static unsigned int get_contig_folio_len(struct page **pages,
> - unsigned int *num_pages, size_t left,
> - size_t offset)
> -{
> - struct folio *folio = page_folio(pages[0]);
> - size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, left);
> - unsigned int max_pages, i;
> - size_t folio_offset, len;
> -
> - folio_offset = PAGE_SIZE * folio_page_idx(folio, pages[0]) + offset;
> - len = min(folio_size(folio) - folio_offset, left);
> -
> - /*
> - * We might COW a single page in the middle of a large folio, so we have
> - * to check that all pages belong to the same folio.
> - */
> - left -= contig_sz;
> - max_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
> - for (i = 1; i < max_pages; i++) {
> - size_t next = min_t(size_t, PAGE_SIZE, left);
> -
> - if (page_folio(pages[i]) != folio ||
> - pages[i] != pages[i - 1] + 1)
> - break;
> - contig_sz += next;
> - left -= next;
> - }
> -
> - *num_pages = i;
> - return contig_sz;
> -}
> -
> -#define PAGE_PTRS_PER_BVEC (sizeof(struct bio_vec) / sizeof(struct page *))
> -
> -/**
> - * __bio_iov_iter_get_pages - pin user or kernel pages and add them to a bio
> - * @bio: bio to add pages to
> - * @iter: iov iterator describing the region to be mapped
> - *
> - * Extracts pages from *iter and appends them to @bio's bvec array. The pages
> - * will have to be cleaned up in the way indicated by the BIO_PAGE_PINNED flag.
> - * For a multi-segment *iter, this function only adds pages from the next
> - * non-empty segment of the iov iterator.
> - */
> -static ssize_t __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
> -{
> - iov_iter_extraction_t extraction_flags = 0;
> - unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt;
> - unsigned short entries_left = bio->bi_max_vecs - bio->bi_vcnt;
> - struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt;
> - struct page **pages = (struct page **)bv;
Huh. We type-abuse an array of bio_vec's as an array of struct page
pointers??
As a straight hoist the patch looks correct but I'm confused about this.
--D
> - ssize_t size;
> - unsigned int i = 0;
> - size_t offset, left, len;
> -
> - /*
> - * Move page array up in the allocated memory for the bio vecs as far as
> - * possible so that we can start filling biovecs from the beginning
> - * without overwriting the temporary page array.
> - */
> - BUILD_BUG_ON(PAGE_PTRS_PER_BVEC < 2);
> - pages += entries_left * (PAGE_PTRS_PER_BVEC - 1);
> -
> - if (bio->bi_bdev && blk_queue_pci_p2pdma(bio->bi_bdev->bd_disk->queue))
> - extraction_flags |= ITER_ALLOW_P2PDMA;
> -
> - size = iov_iter_extract_pages(iter, &pages,
> - UINT_MAX - bio->bi_iter.bi_size,
> - nr_pages, extraction_flags, &offset);
> - if (unlikely(size <= 0))
> - return size ? size : -EFAULT;
> -
> - nr_pages = DIV_ROUND_UP(offset + size, PAGE_SIZE);
> - for (left = size; left > 0; left -= len) {
> - unsigned int nr_to_add;
> -
> - if (bio->bi_vcnt > 0) {
> - struct bio_vec *prev = &bio->bi_io_vec[bio->bi_vcnt - 1];
> -
> - if (!zone_device_pages_have_same_pgmap(prev->bv_page,
> - pages[i]))
> - break;
> - }
> -
> - len = get_contig_folio_len(&pages[i], &nr_to_add, left, offset);
> - __bio_add_page(bio, pages[i], len, offset);
> - i += nr_to_add;
> - offset = 0;
> - }
> -
> - iov_iter_revert(iter, left);
> - while (i < nr_pages)
> - bio_release_page(bio, pages[i++]);
> - return size - left;
> -}
> -
> /*
> * Aligns the bio size to the len_align_mask, releasing excessive bio vecs that
> * __bio_iov_iter_get_pages may have inserted, and reverts the trimmed length
> @@ -1325,7 +1229,7 @@ static int bio_iov_iter_align_down(struct bio *bio, struct iov_iter *iter,
> int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter,
> unsigned len_align_mask)
> {
> - ssize_t ret;
> + iov_iter_extraction_t flags = 0;
>
> if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)))
> return -EIO;
> @@ -1338,14 +1242,26 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter,
>
> if (iov_iter_extract_will_pin(iter))
> bio_set_flag(bio, BIO_PAGE_PINNED);
> + if (bio->bi_bdev && blk_queue_pci_p2pdma(bio->bi_bdev->bd_disk->queue))
> + flags |= ITER_ALLOW_P2PDMA;
>
> do {
> - ret = __bio_iov_iter_get_pages(bio, iter);
> - } while (ret > 0 && iov_iter_count(iter) && !bio_full(bio, 0));
> + ssize_t ret;
> +
> + ret = iov_iter_extract_bvecs(iter, bio->bi_io_vec,
> + UINT_MAX - bio->bi_iter.bi_size, &bio->bi_vcnt,
> + bio->bi_max_vecs, flags);
> + if (ret <= 0) {
> + if (!bio->bi_vcnt)
> + return ret;
> + break;
> + }
> + bio->bi_iter.bi_size += ret;
> + } while (iov_iter_count(iter) && !bio_full(bio, 0));
>
> - if (bio->bi_vcnt)
> - return bio_iov_iter_align_down(bio, iter, len_align_mask);
> - return ret;
> + if (is_pci_p2pdma_page(bio->bi_io_vec->bv_page))
> + bio->bi_opf |= REQ_NOMERGE;
> + return bio_iov_iter_align_down(bio, iter, len_align_mask);
> }
>
> static void submit_bio_wait_endio(struct bio *bio)
> diff --git a/include/linux/uio.h b/include/linux/uio.h
> index 5b127043a151..a9bc5b3067e3 100644
> --- a/include/linux/uio.h
> +++ b/include/linux/uio.h
> @@ -389,6 +389,9 @@ ssize_t iov_iter_extract_pages(struct iov_iter *i, struct page ***pages,
> size_t maxsize, unsigned int maxpages,
> iov_iter_extraction_t extraction_flags,
> size_t *offset0);
> +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, iov_iter_extraction_t extraction_flags);
>
> /**
> * iov_iter_extract_will_pin - Indicate how pages from the iterator will be retained
> diff --git a/lib/iov_iter.c b/lib/iov_iter.c
> index 896760bad455..545250507f08 100644
> --- a/lib/iov_iter.c
> +++ b/lib/iov_iter.c
> @@ -1845,3 +1845,101 @@ ssize_t iov_iter_extract_pages(struct iov_iter *i,
> return -EFAULT;
> }
> EXPORT_SYMBOL_GPL(iov_iter_extract_pages);
> +
> +static unsigned int get_contig_folio_len(struct page **pages,
> + unsigned int *num_pages, size_t left, size_t offset)
> +{
> + struct folio *folio = page_folio(pages[0]);
> + size_t contig_sz = min_t(size_t, PAGE_SIZE - offset, left);
> + unsigned int max_pages, i;
> + size_t folio_offset, len;
> +
> + folio_offset = PAGE_SIZE * folio_page_idx(folio, pages[0]) + offset;
> + len = min(folio_size(folio) - folio_offset, left);
> +
> + /*
> + * We might COW a single page in the middle of a large folio, so we have
> + * to check that all pages belong to the same folio.
> + */
> + left -= contig_sz;
> + max_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
> + for (i = 1; i < max_pages; i++) {
> + size_t next = min_t(size_t, PAGE_SIZE, left);
> +
> + if (page_folio(pages[i]) != folio ||
> + pages[i] != pages[i - 1] + 1)
> + break;
> + contig_sz += next;
> + left -= next;
> + }
> +
> + *num_pages = i;
> + return contig_sz;
> +}
> +
> +#define PAGE_PTRS_PER_BVEC (sizeof(struct bio_vec) / sizeof(struct page *))
> +
> +/**
> + * iov_iter_extract_bvecs - Extract bvecs from an iterator
> + * @iter: the iterator to extract from
> + * @bv: bvec return array
> + * @max_size: maximum size to extract from @iter
> + * @nr_vecs: number of vectors in @bv (on in and output)
> + * @max_vecs: maximum vectors in @bv, including those filled before calling
> + * @extraction_flags: flags to qualify request
> + *
> + * Like iov_iter_extract_pages(), but returns physically contiguous ranges
> + * contained in a single folio as a single bvec instead of multiple entries.
> + *
> + * Returns the number of bytes extracted when successful, or a negative errno.
> + * If @nr_vecs was non-zero on entry, the number of successfully extracted bytes
> + * can be 0.
> + */
> +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, iov_iter_extraction_t extraction_flags)
> +{
> + unsigned short entries_left = max_vecs - *nr_vecs;
> + unsigned short nr_pages, i = 0;
> + size_t left, offset, len;
> + struct page **pages;
> + ssize_t size;
> +
> + /*
> + * Move page array up in the allocated memory for the bio vecs as far as
> + * possible so that we can start filling biovecs from the beginning
> + * without overwriting the temporary page array.
> + */
> + BUILD_BUG_ON(PAGE_PTRS_PER_BVEC < 2);
> + pages = (struct page **)(bv + *nr_vecs) +
> + entries_left * (PAGE_PTRS_PER_BVEC - 1);
> +
> + size = iov_iter_extract_pages(iter, &pages, max_size, entries_left,
> + extraction_flags, &offset);
> + if (unlikely(size <= 0))
> + return size ? size : -EFAULT;
> +
> + nr_pages = DIV_ROUND_UP(offset + size, PAGE_SIZE);
> + for (left = size; left > 0; left -= len) {
> + unsigned int nr_to_add;
> +
> + if (*nr_vecs > 0 &&
> + !zone_device_pages_have_same_pgmap(bv[*nr_vecs - 1].bv_page,
> + pages[i]))
> + break;
> +
> + len = get_contig_folio_len(&pages[i], &nr_to_add, left, offset);
> + bvec_set_page(&bv[*nr_vecs], pages[i], len, offset);
> + i += nr_to_add;
> + (*nr_vecs)++;
> + offset = 0;
> + }
> +
> + iov_iter_revert(iter, left);
> + if (iov_iter_extract_will_pin(iter)) {
> + while (i < nr_pages)
> + unpin_user_page(pages[i++]);
> + }
> + return size - left;
> +}
> +EXPORT_SYMBOL_GPL(iov_iter_extract_bvecs);
> --
> 2.47.3
>
>
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-22 17:47 ` Darrick J. Wong
@ 2026-01-23 5:44 ` Christoph Hellwig
2026-01-23 7:09 ` Darrick J. Wong
0 siblings, 1 reply; 76+ messages in thread
From: Christoph Hellwig @ 2026-01-23 5:44 UTC (permalink / raw)
To: Darrick J. Wong
Cc: Christoph Hellwig, Jens Axboe, Christian Brauner, Carlos Maiolino,
Qu Wenruo, Al Viro, linux-block, linux-xfs, linux-fsdevel
On Thu, Jan 22, 2026 at 09:47:03AM -0800, Darrick J. Wong wrote:
> > - struct page **pages = (struct page **)bv;
>
> Huh. We type-abuse an array of bio_vec's as an array of struct page
> pointers??
>
> As a straight hoist the patch looks correct but I'm confused about this.
Yes. This uses the larger space allocated for bio_vecs to first
place the pages at the end, and then filling in the bio_vecs from the
beginning. I think the comments describe it pretty well, but if you
have ideas for enhancement, this might be a good time to update them.
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-23 5:44 ` Christoph Hellwig
@ 2026-01-23 7:09 ` Darrick J. Wong
2026-01-23 7:14 ` Christoph Hellwig
0 siblings, 1 reply; 76+ messages in thread
From: Darrick J. Wong @ 2026-01-23 7:09 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Christian Brauner, Carlos Maiolino, Qu Wenruo,
Al Viro, linux-block, linux-xfs, linux-fsdevel
On Fri, Jan 23, 2026 at 06:44:48AM +0100, Christoph Hellwig wrote:
> On Thu, Jan 22, 2026 at 09:47:03AM -0800, Darrick J. Wong wrote:
> > > - struct page **pages = (struct page **)bv;
> >
> > Huh. We type-abuse an array of bio_vec's as an array of struct page
> > pointers??
> >
> > As a straight hoist the patch looks correct but I'm confused about this.
>
> Yes. This uses the larger space allocated for bio_vecs to first
> place the pages at the end, and then filling in the bio_vecs from the
> beginning. I think the comments describe it pretty well, but if you
> have ideas for enhancement, this might be a good time to update them.
I'm not sure, since the alternative is to wrap the whole mess in a
union, which makes the type-abuse more explicit but then is still pretty
ugly. The only improvement I can really think of would be a huge
comment wherever we start this, which I think Kent's original code from
2011 had ("deep magic", etc).
--D
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-23 7:09 ` Darrick J. Wong
@ 2026-01-23 7:14 ` Christoph Hellwig
0 siblings, 0 replies; 76+ messages in thread
From: Christoph Hellwig @ 2026-01-23 7:14 UTC (permalink / raw)
To: Darrick J. Wong
Cc: Christoph Hellwig, Jens Axboe, Christian Brauner, Carlos Maiolino,
Qu Wenruo, Al Viro, linux-block, linux-xfs, linux-fsdevel
On Thu, Jan 22, 2026 at 11:09:33PM -0800, Darrick J. Wong wrote:
> On Fri, Jan 23, 2026 at 06:44:48AM +0100, Christoph Hellwig wrote:
> > On Thu, Jan 22, 2026 at 09:47:03AM -0800, Darrick J. Wong wrote:
> > > > - struct page **pages = (struct page **)bv;
> > >
> > > Huh. We type-abuse an array of bio_vec's as an array of struct page
> > > pointers??
> > >
> > > As a straight hoist the patch looks correct but I'm confused about this.
> >
> > Yes. This uses the larger space allocated for bio_vecs to first
> > place the pages at the end, and then filling in the bio_vecs from the
> > beginning. I think the comments describe it pretty well, but if you
> > have ideas for enhancement, this might be a good time to update them.
>
> I'm not sure, since the alternative is to wrap the whole mess in a
> union, which makes the type-abuse more explicit but then is still pretty
> ugly. The only improvement I can really think of would be a huge
> comment wherever we start this, which I think Kent's original code from
> 2011 had ("deep magic", etc).
I don't think a union would be good here. It primarily operates on
the bio_vecs embedded in the bio, which certainly should not be a
union.
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-19 7:44 ` [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code Christoph Hellwig
2026-01-22 17:47 ` Darrick J. Wong
@ 2026-01-23 11:37 ` David Howells
2026-01-23 13:58 ` Christoph Hellwig
1 sibling, 1 reply; 76+ messages in thread
From: David Howells @ 2026-01-23 11:37 UTC (permalink / raw)
To: Christoph Hellwig
Cc: dhowells, Jens Axboe, Christian Brauner, Darrick J. Wong,
Carlos Maiolino, Qu Wenruo, Al Viro, linux-block, linux-xfs,
linux-fsdevel
Christoph Hellwig <hch@lst.de> wrote:
> +static unsigned int get_contig_folio_len(struct page **pages,
> + unsigned int *num_pages, size_t left, size_t offset)
> +{
> + struct folio *folio = page_folio(pages[0]);
You can't do this. You cannot assume that pages[0] is of folio type.
vmsplice() is unfortunately a thing and the page could be a network read
buffer.
David
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-23 11:37 ` David Howells
@ 2026-01-23 13:58 ` Christoph Hellwig
2026-01-23 14:57 ` David Howells
0 siblings, 1 reply; 76+ messages in thread
From: Christoph Hellwig @ 2026-01-23 13:58 UTC (permalink / raw)
To: David Howells
Cc: Christoph Hellwig, Jens Axboe, Christian Brauner, Darrick J. Wong,
Carlos Maiolino, Qu Wenruo, Al Viro, linux-block, linux-xfs,
linux-fsdevel, Kundan Kumar, Matthew Wilcox
On Fri, Jan 23, 2026 at 11:37:17AM +0000, David Howells wrote:
> Christoph Hellwig <hch@lst.de> wrote:
>
> > +static unsigned int get_contig_folio_len(struct page **pages,
> > + unsigned int *num_pages, size_t left, size_t offset)
> > +{
> > + struct folio *folio = page_folio(pages[0]);
>
> You can't do this. You cannot assume that pages[0] is of folio type.
> vmsplice() is unfortunately a thing and the page could be a network read
> buffer.
Hmm, this just moves around existing code added in commit ed9832bc08db
("block: introduce folio awareness and add a bigger size from folio").
How do we get these network read buffers into either a user address
space or a (non-bvec) iter passed to O_DIRECT reads/writes?
Can we come up with testcase for xfstests or blktests for this?
How do we find out if a given page is a folio and that we can do this?
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-23 13:58 ` Christoph Hellwig
@ 2026-01-23 14:57 ` David Howells
2026-01-26 17:36 ` Matthew Wilcox
` (2 more replies)
0 siblings, 3 replies; 76+ messages in thread
From: David Howells @ 2026-01-23 14:57 UTC (permalink / raw)
To: Christoph Hellwig
Cc: dhowells, Jens Axboe, Christian Brauner, Darrick J. Wong,
Carlos Maiolino, Qu Wenruo, Al Viro, linux-block, linux-xfs,
linux-fsdevel, Kundan Kumar, Matthew Wilcox
Christoph Hellwig <hch@lst.de> wrote:
> On Fri, Jan 23, 2026 at 11:37:17AM +0000, David Howells wrote:
> > Christoph Hellwig <hch@lst.de> wrote:
> >
> > > +static unsigned int get_contig_folio_len(struct page **pages,
> > > + unsigned int *num_pages, size_t left, size_t offset)
> > > +{
> > > + struct folio *folio = page_folio(pages[0]);
> >
> > You can't do this. You cannot assume that pages[0] is of folio type.
> > vmsplice() is unfortunately a thing and the page could be a network read
> > buffer.
>
> Hmm, this just moves around existing code added in commit ed9832bc08db
> ("block: introduce folio awareness and add a bigger size from folio").
>
> How do we get these network read buffers into either a user address
> space or a (non-bvec) iter passed to O_DIRECT reads/writes?
Splice from TCP socket to pipe, vmsplice from there into process address
space; DIO write() from there I think should do it.
What you might need to do is write page-sized chunks into one end of the TCP
socket and flush it after each one so that vmsplice() sees page-sized chunks
of data. I'm not sure how well an external connection would work to get
actual transmission buffers. The problem is that the received packet is
page-aligned, including the network headers (I think), so if you can, say,
send 8K packets, you'd have to try and guess where the page boundaries are as
vmsplice can only work on whole pages.
Can we make vmsplice() just copy data?
> Can we come up with testcase for xfstests or blktests for this?
>
> How do we find out if a given page is a folio and that we can do this?
That's a question for Willy.
David
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-23 14:57 ` David Howells
@ 2026-01-26 17:36 ` Matthew Wilcox
2026-01-27 5:13 ` Christoph Hellwig
2026-02-03 8:20 ` Askar Safin
2026-02-03 10:28 ` Askar Safin
2 siblings, 1 reply; 76+ messages in thread
From: Matthew Wilcox @ 2026-01-26 17:36 UTC (permalink / raw)
To: David Howells
Cc: Christoph Hellwig, Jens Axboe, Christian Brauner, Darrick J. Wong,
Carlos Maiolino, Qu Wenruo, Al Viro, linux-block, linux-xfs,
linux-fsdevel, Kundan Kumar
On Fri, Jan 23, 2026 at 02:57:06PM +0000, David Howells wrote:
> Christoph Hellwig <hch@lst.de> wrote:
>
> > On Fri, Jan 23, 2026 at 11:37:17AM +0000, David Howells wrote:
> > > Christoph Hellwig <hch@lst.de> wrote:
> > >
> > > > +static unsigned int get_contig_folio_len(struct page **pages,
> > > > + unsigned int *num_pages, size_t left, size_t offset)
> > > > +{
> > > > + struct folio *folio = page_folio(pages[0]);
> > >
> > > You can't do this. You cannot assume that pages[0] is of folio type.
> > > vmsplice() is unfortunately a thing and the page could be a network read
> > > buffer.
> >
> > Hmm, this just moves around existing code added in commit ed9832bc08db
> > ("block: introduce folio awareness and add a bigger size from folio").
> >
> > How do we get these network read buffers into either a user address
> > space or a (non-bvec) iter passed to O_DIRECT reads/writes?
>
> Splice from TCP socket to pipe, vmsplice from there into process address
> space; DIO write() from there I think should do it.
Some other ways to get something that isn't a folio mapped into a user
address space:
- mmap() a vmalloc-allocated buffer. We don't have a good story here
yet; we could declare every driver that does this to be buggy and
force them to allocate folios and vmap them. Seems a bit
unreasonable and likely to end up with a lot of duplicate code with
bugs. I've prototyped another approach, but it's not reeady to share
yet.
- mmap() the perf ring buffer. We could decide to refuse to do DIO to
this buffer.
> > How do we find out if a given page is a folio and that we can do this?
>
> That's a question for Willy.
Today there's no way. Although you could test for page_has_type()?
The eventual solution is that page_folio() will return NULL for pages
which do not belong to folios. That's independent of whether we decide
to make user-mappable-vmalloc contain folios, or whether we have some
other way to map/track pages-that-belong-to-vmalloc.
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-26 17:36 ` Matthew Wilcox
@ 2026-01-27 5:13 ` Christoph Hellwig
2026-01-27 5:44 ` Matthew Wilcox
0 siblings, 1 reply; 76+ messages in thread
From: Christoph Hellwig @ 2026-01-27 5:13 UTC (permalink / raw)
To: Matthew Wilcox
Cc: David Howells, Christoph Hellwig, Jens Axboe, Christian Brauner,
Darrick J. Wong, Carlos Maiolino, Qu Wenruo, Al Viro, linux-block,
linux-xfs, linux-fsdevel, Kundan Kumar
On Mon, Jan 26, 2026 at 05:36:12PM +0000, Matthew Wilcox wrote:
> > > Hmm, this just moves around existing code added in commit ed9832bc08db
> > > ("block: introduce folio awareness and add a bigger size from folio").
> > >
> > > How do we get these network read buffers into either a user address
> > > space or a (non-bvec) iter passed to O_DIRECT reads/writes?
> >
> > Splice from TCP socket to pipe, vmsplice from there into process address
> > space; DIO write() from there I think should do it.
>
> Some other ways to get something that isn't a folio mapped into a user
> address space:
>
> - mmap() a vmalloc-allocated buffer. We don't have a good story here
> yet; we could declare every driver that does this to be buggy and
> force them to allocate folios and vmap them. Seems a bit
> unreasonable and likely to end up with a lot of duplicate code with
> bugs. I've prototyped another approach, but it's not reeady to share
> yet.
> - mmap() the perf ring buffer. We could decide to refuse to do DIO to
> this buffer.
I'm confused. Your example are all about something that would happen if
we actually split up what is currently struct page in some way. But I
read Dave's mail as something is broken right now already. Which of
those is the case?
> The eventual solution is that page_folio() will return NULL for pages
> which do not belong to folios. That's independent of whether we decide
> to make user-mappable-vmalloc contain folios, or whether we have some
> other way to map/track pages-that-belong-to-vmalloc.
vmalloc is a tiny wrapper around alloc_page* + vmap/vm_map_area, and a
lot of code all over the kernel relies on that. Trying to have a
separate "memory type" for vmalloc is going to break things left right
and center for not much obvious gain. I'm not going to say you can't
do it, but I doubt that is actually ends up easy and particularly
useful.
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-27 5:13 ` Christoph Hellwig
@ 2026-01-27 5:44 ` Matthew Wilcox
2026-01-27 5:47 ` Christoph Hellwig
0 siblings, 1 reply; 76+ messages in thread
From: Matthew Wilcox @ 2026-01-27 5:44 UTC (permalink / raw)
To: Christoph Hellwig
Cc: David Howells, Jens Axboe, Christian Brauner, Darrick J. Wong,
Carlos Maiolino, Qu Wenruo, Al Viro, linux-block, linux-xfs,
linux-fsdevel, Kundan Kumar
On Tue, Jan 27, 2026 at 06:13:52AM +0100, Christoph Hellwig wrote:
> On Mon, Jan 26, 2026 at 05:36:12PM +0000, Matthew Wilcox wrote:
> > > > Hmm, this just moves around existing code added in commit ed9832bc08db
> > > > ("block: introduce folio awareness and add a bigger size from folio").
> > > >
> > > > How do we get these network read buffers into either a user address
> > > > space or a (non-bvec) iter passed to O_DIRECT reads/writes?
> > >
> > > Splice from TCP socket to pipe, vmsplice from there into process address
> > > space; DIO write() from there I think should do it.
> >
> > Some other ways to get something that isn't a folio mapped into a user
> > address space:
> >
> > - mmap() a vmalloc-allocated buffer. We don't have a good story here
> > yet; we could declare every driver that does this to be buggy and
> > force them to allocate folios and vmap them. Seems a bit
> > unreasonable and likely to end up with a lot of duplicate code with
> > bugs. I've prototyped another approach, but it's not reeady to share
> > yet.
> > - mmap() the perf ring buffer. We could decide to refuse to do DIO to
> > this buffer.
>
> I'm confused. Your example are all about something that would happen if
> we actually split up what is currently struct page in some way. But I
> read Dave's mail as something is broken right now already. Which of
> those is the case?
What's broken right now is that the network buffers are now using frozen
pages, so they have a zero refcount (Dave, do I remember the current
state of play correctly?)
> > The eventual solution is that page_folio() will return NULL for pages
> > which do not belong to folios. That's independent of whether we decide
> > to make user-mappable-vmalloc contain folios, or whether we have some
> > other way to map/track pages-that-belong-to-vmalloc.
>
> vmalloc is a tiny wrapper around alloc_page* + vmap/vm_map_area, and a
> lot of code all over the kernel relies on that. Trying to have a
> separate "memory type" for vmalloc is going to break things left right
> and center for not much obvious gain. I'm not going to say you can't
> do it, but I doubt that is actually ends up easy and particularly
> useful.
Most of the code in the kernel doesn't drill down from vmalloc to page.
I don't think it's going to be all that painful, but I also don't think
I'll need to address vmalloc in the first half of this year. Just trying
to fill you in on the current plans.
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-27 5:44 ` Matthew Wilcox
@ 2026-01-27 5:47 ` Christoph Hellwig
0 siblings, 0 replies; 76+ messages in thread
From: Christoph Hellwig @ 2026-01-27 5:47 UTC (permalink / raw)
To: Matthew Wilcox
Cc: Christoph Hellwig, David Howells, Jens Axboe, Christian Brauner,
Darrick J. Wong, Carlos Maiolino, Qu Wenruo, Al Viro, linux-block,
linux-xfs, linux-fsdevel, Kundan Kumar
On Tue, Jan 27, 2026 at 05:44:01AM +0000, Matthew Wilcox wrote:
> > I'm confused. Your example are all about something that would happen if
> > we actually split up what is currently struct page in some way. But I
> > read Dave's mail as something is broken right now already. Which of
> > those is the case?
>
> What's broken right now is that the network buffers are now using frozen
> pages, so they have a zero refcount (Dave, do I remember the current
> state of play correctly?)
Nothing using this function right now ever deals with the page refcounts,
so that should not be an issue.
> > vmalloc is a tiny wrapper around alloc_page* + vmap/vm_map_area, and a
> > lot of code all over the kernel relies on that. Trying to have a
> > separate "memory type" for vmalloc is going to break things left right
> > and center for not much obvious gain. I'm not going to say you can't
> > do it, but I doubt that is actually ends up easy and particularly
> > useful.
>
> Most of the code in the kernel doesn't drill down from vmalloc to page.
> I don't think it's going to be all that painful, but I also don't think
> I'll need to address vmalloc in the first half of this year. Just trying
> to fill you in on the current plans.
Maybe not most of the kernel, but vmalloc_to_page and is_vmalloc_addr
are used in quite a lot of places, and usually need to handle both
actual vmalloc allocations, and page/folio allocations mapped into
vmalloc space.
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-23 14:57 ` David Howells
2026-01-26 17:36 ` Matthew Wilcox
@ 2026-02-03 8:20 ` Askar Safin
2026-02-03 10:28 ` Askar Safin
2 siblings, 0 replies; 76+ messages in thread
From: Askar Safin @ 2026-02-03 8:20 UTC (permalink / raw)
To: dhowells
Cc: axboe, brauner, cem, djwong, hch, kundan.kumar, linux-block,
linux-fsdevel, linux-xfs, viro, willy, wqu
David Howells <dhowells@redhat.com>:
> vmsplice from there into process address
> space
You mean vmsplice from pipe? According to this comment
(but I didn't read actual code) vmsplice *from* pipe
(as opposed to vmsplice *to* pipe) is equivalent to
normal readv:
https://elixir.bootlin.com/linux/v6.19-rc5/source/fs/splice.c#L1500
--
Askar Safin
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-01-23 14:57 ` David Howells
2026-01-26 17:36 ` Matthew Wilcox
2026-02-03 8:20 ` Askar Safin
@ 2026-02-03 10:28 ` Askar Safin
2026-02-03 16:32 ` Christoph Hellwig
2 siblings, 1 reply; 76+ messages in thread
From: Askar Safin @ 2026-02-03 10:28 UTC (permalink / raw)
To: dhowells
Cc: axboe, brauner, cem, djwong, hch, kundan.kumar, linux-block,
linux-fsdevel, linux-xfs, viro, willy, wqu
David Howells <dhowells@redhat.com>:
> Can we make vmsplice() just copy data?
vmsplice already caused at least one security issue in the past:
CVE-2020-29374 (see https://lwn.net/Articles/849638/ ). There may be other
CVEs, try to search CVE database.
Also, I think vmsplice is rarely used.
So, if you author a patch, which makes vmsplice equivalent to readv/writev,
and mention these CVEs, then, I think, such patch has high chance to
succeed.
Also, as well as I understand, this patch introduces kbufs,
which are modern uring-based alternative to whatever splice/pipe originally
meant to be:
https://lore.kernel.org/all/20260116233044.1532965-4-joannelkoong@gmail.com/ .
I. e. these kbufs provide kernel-managed buffer for fast I/O.
So, I think it is good idea to deprecate splice in favor of these kbufs.
--
Askar Safin
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
2026-02-03 10:28 ` Askar Safin
@ 2026-02-03 16:32 ` Christoph Hellwig
0 siblings, 0 replies; 76+ messages in thread
From: Christoph Hellwig @ 2026-02-03 16:32 UTC (permalink / raw)
To: Askar Safin
Cc: dhowells, axboe, brauner, cem, djwong, hch, kundan.kumar,
linux-block, linux-fsdevel, linux-xfs, viro, willy, wqu
On Tue, Feb 03, 2026 at 01:28:21PM +0300, Askar Safin wrote:
> David Howells <dhowells@redhat.com>:
> > Can we make vmsplice() just copy data?
>
> vmsplice already caused at least one security issue in the past:
> CVE-2020-29374 (see https://lwn.net/Articles/849638/ ). There may be other
> CVEs, try to search CVE database.
>
> Also, I think vmsplice is rarely used.
>
> So, if you author a patch, which makes vmsplice equivalent to readv/writev,
> and mention these CVEs, then, I think, such patch has high chance to
> succeed.
I'd be all for killing it, especially as getting it to properly pin
the user buffers is still unsolved so far.
^ permalink raw reply [flat|nested] 76+ messages in thread
* [PATCH 04/14] block: remove bio_release_page
2026-01-19 7:44 ` bounce buffer direct I/O when stable pages are required v2 Christoph Hellwig
` (2 preceding siblings ...)
2026-01-19 7:44 ` [PATCH 03/14] iov_iter: extract a iov_iter_extract_bvecs helper from bio code Christoph Hellwig
@ 2026-01-19 7:44 ` Christoph Hellwig
2026-01-22 11:14 ` Johannes Thumshirn
` (3 more replies)
2026-01-19 7:44 ` [PATCH 05/14] block: add helpers to bounce buffer an iov_iter into bios Christoph Hellwig
` (11 subsequent siblings)
15 siblings, 4 replies; 76+ messages in thread
From: Christoph Hellwig @ 2026-01-19 7:44 UTC (permalink / raw)
To: Jens Axboe, Christian Brauner
Cc: Darrick J. Wong, Carlos Maiolino, Qu Wenruo, Al Viro, linux-block,
linux-xfs, linux-fsdevel
Merge bio_release_page into the only remaining caller.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/bio.c | 4 +++-
block/blk.h | 11 -----------
2 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 12cd3c5f6d6d..c51b4e2470e2 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1195,7 +1195,9 @@ static int bio_iov_iter_align_down(struct bio *bio, struct iov_iter *iter,
break;
}
- bio_release_page(bio, bv->bv_page);
+ if (bio_flagged(bio, BIO_PAGE_PINNED))
+ unpin_user_page(bv->bv_page);
+
bio->bi_vcnt--;
nbytes -= bv->bv_len;
} while (nbytes);
diff --git a/block/blk.h b/block/blk.h
index 980eef1f5690..886238cae5f1 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -595,17 +595,6 @@ void bdev_set_nr_sectors(struct block_device *bdev, sector_t sectors);
struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id,
struct lock_class_key *lkclass);
-
-/*
- * Clean up a page appropriately, where the page may be pinned, may have a
- * ref taken on it or neither.
- */
-static inline void bio_release_page(struct bio *bio, struct page *page)
-{
- if (bio_flagged(bio, BIO_PAGE_PINNED))
- unpin_user_page(page);
-}
-
struct request_queue *blk_alloc_queue(struct queue_limits *lim, int node_id);
int disk_scan_partitions(struct gendisk *disk, blk_mode_t mode);
--
2.47.3
^ permalink raw reply related [flat|nested] 76+ messages in thread* Re: [PATCH 04/14] block: remove bio_release_page
2026-01-19 7:44 ` [PATCH 04/14] block: remove bio_release_page Christoph Hellwig
@ 2026-01-22 11:14 ` Johannes Thumshirn
2026-01-22 17:26 ` Darrick J. Wong
` (2 subsequent siblings)
3 siblings, 0 replies; 76+ messages in thread
From: Johannes Thumshirn @ 2026-01-22 11:14 UTC (permalink / raw)
To: hch, Jens Axboe, Christian Brauner
Cc: Darrick J. Wong, Carlos Maiolino, WenRuo Qu, Al Viro,
linux-block@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 04/14] block: remove bio_release_page
2026-01-19 7:44 ` [PATCH 04/14] block: remove bio_release_page Christoph Hellwig
2026-01-22 11:14 ` Johannes Thumshirn
@ 2026-01-22 17:26 ` Darrick J. Wong
2026-01-23 8:43 ` Damien Le Moal
2026-01-23 12:17 ` Anuj Gupta
3 siblings, 0 replies; 76+ messages in thread
From: Darrick J. Wong @ 2026-01-22 17:26 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Christian Brauner, Carlos Maiolino, Qu Wenruo,
Al Viro, linux-block, linux-xfs, linux-fsdevel
On Mon, Jan 19, 2026 at 08:44:11AM +0100, Christoph Hellwig wrote:
> Merge bio_release_page into the only remaining caller.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> block/bio.c | 4 +++-
> block/blk.h | 11 -----------
> 2 files changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/block/bio.c b/block/bio.c
> index 12cd3c5f6d6d..c51b4e2470e2 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -1195,7 +1195,9 @@ static int bio_iov_iter_align_down(struct bio *bio, struct iov_iter *iter,
> break;
> }
>
> - bio_release_page(bio, bv->bv_page);
> + if (bio_flagged(bio, BIO_PAGE_PINNED))
> + unpin_user_page(bv->bv_page);
> +
> bio->bi_vcnt--;
> nbytes -= bv->bv_len;
> } while (nbytes);
> diff --git a/block/blk.h b/block/blk.h
> index 980eef1f5690..886238cae5f1 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -595,17 +595,6 @@ void bdev_set_nr_sectors(struct block_device *bdev, sector_t sectors);
>
> struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id,
> struct lock_class_key *lkclass);
> -
> -/*
> - * Clean up a page appropriately, where the page may be pinned, may have a
> - * ref taken on it or neither.
> - */
> -static inline void bio_release_page(struct bio *bio, struct page *page)
> -{
> - if (bio_flagged(bio, BIO_PAGE_PINNED))
> - unpin_user_page(page);
> -}
> -
> struct request_queue *blk_alloc_queue(struct queue_limits *lim, int node_id);
>
> int disk_scan_partitions(struct gendisk *disk, blk_mode_t mode);
> --
> 2.47.3
>
>
^ permalink raw reply [flat|nested] 76+ messages in thread* Re: [PATCH 04/14] block: remove bio_release_page
2026-01-19 7:44 ` [PATCH 04/14] block: remove bio_release_page Christoph Hellwig
2026-01-22 11:14 ` Johannes Thumshirn
2026-01-22 17:26 ` Darrick J. Wong
@ 2026-01-23 8:43 ` Damien Le Moal
2026-01-23 12:17 ` Anuj Gupta
3 siblings, 0 replies; 76+ messages in thread
From: Damien Le Moal @ 2026-01-23 8:43 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe, Christian Brauner
Cc: Darrick J. Wong, Carlos Maiolino, Qu Wenruo, Al Viro, linux-block,
linux-xfs, linux-fsdevel
On 2026/01/19 18:44, Christoph Hellwig wrote:
> Merge bio_release_page into the only remaining caller.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 04/14] block: remove bio_release_page
2026-01-19 7:44 ` [PATCH 04/14] block: remove bio_release_page Christoph Hellwig
` (2 preceding siblings ...)
2026-01-23 8:43 ` Damien Le Moal
@ 2026-01-23 12:17 ` Anuj Gupta
3 siblings, 0 replies; 76+ messages in thread
From: Anuj Gupta @ 2026-01-23 12:17 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Christian Brauner, Darrick J. Wong, Carlos Maiolino,
Qu Wenruo, Al Viro, linux-block, linux-xfs, linux-fsdevel
[-- Attachment #1: Type: text/plain, Size: 198 bytes --]
On 19/01/26 08:44AM, Christoph Hellwig wrote:
>Merge bio_release_page into the only remaining caller.
>
>Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 76+ messages in thread
* [PATCH 05/14] block: add helpers to bounce buffer an iov_iter into bios
2026-01-19 7:44 ` bounce buffer direct I/O when stable pages are required v2 Christoph Hellwig
` (3 preceding siblings ...)
2026-01-19 7:44 ` [PATCH 04/14] block: remove bio_release_page Christoph Hellwig
@ 2026-01-19 7:44 ` Christoph Hellwig
2026-01-22 13:05 ` Johannes Thumshirn
` (3 more replies)
2026-01-19 7:44 ` [PATCH 06/14] iomap