]> git.ipfire.org Git - thirdparty/linux.git/commit
block: fix adding folio to bio
authorMing Lei <ming.lei@redhat.com>
Wed, 12 Mar 2025 14:51:36 +0000 (22:51 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 12 Mar 2025 20:07:11 +0000 (14:07 -0600)
commit26064d3e2b4d9a14df1072980e558c636fb023ea
tree44f3f322b3e879eb00b8d7e7e2a8315afbb3c6c7
parent61667cb6644f6fb01eb8baa928e381c016b5ed7b
block: fix adding folio to bio

>4GB folio is possible on some ARCHs, such as aarch64, 16GB hugepage
is supported, then 'offset' of folio can't be held in 'unsigned int',
cause warning in bio_add_folio_nofail() and IO failure.

Fix it by adjusting 'page' & trimming 'offset' so that `->bi_offset` won't
be overflow, and folio can be added to bio successfully.

Fixes: ed9832bc08db ("block: introduce folio awareness and add a bigger size from folio")
Cc: Kundan Kumar <kundan.kumar@samsung.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Gavin Shan <gshan@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://lore.kernel.org/r/20250312145136.2891229-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c