]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
dm io: bump num_bvecs to handle offset memory
authorBenjamin Marzinski <bmarzins@redhat.com>
Tue, 2 Jul 2024 09:56:45 +0000 (11:56 +0200)
committerMikulas Patocka <mpatocka@redhat.com>
Tue, 2 Jul 2024 09:58:08 +0000 (11:58 +0200)
If dp->get_page() returns a non-zero offset, the bio might need an
additional bvec to deal with the offset. For example, if remaining is
exactly one page size, but there is an offset, the memory will span
two pages.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-io.c

index 7409490259d1d4e0407a1b38e4d3f3cdfc33b36c..3333943fe28827e5646b4a353c4d3606ebc9e4d3 100644 (file)
@@ -347,7 +347,7 @@ static void do_region(const blk_opf_t opf, unsigned int region,
                        break;
                default:
                        num_bvecs = bio_max_segs(dm_sector_div_up(remaining,
-                                               (PAGE_SIZE >> SECTOR_SHIFT)));
+                                               (PAGE_SIZE >> SECTOR_SHIFT)) + 1);
                }
 
                bio = bio_alloc_bioset(where->bdev, num_bvecs, opf, GFP_NOIO,