summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-02-02 09:48:52 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2009-02-02 09:48:52 +1100
commit44f8676235ead36cb101c15d43b3624e61eaa7e1 (patch)
tree5e0e8158e1204ece4c5cbedc40b0d5d5b3594ff5 /drivers/md
parentbb79129f58bc586998c93f93b45351080141e275 (diff)
dm-io-respect-BIO_MAX_PAGES-limit
dm-io calls bio_get_nr_vecs to get the maximum number of pages to use for a given device. It allocates one additional bio_vec to use internally, but this fails to respect BIO_MAX_PAGES so fix this. This was the likely cause of: https://bugzilla.redhat.com/show_bug.cgi?id=173153 Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index a34338567a2a..64dbd9765be1 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -292,6 +292,8 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
(PAGE_SIZE >> SECTOR_SHIFT));
num_bvecs = 1 + min_t(int, bio_get_nr_vecs(where->bdev),
num_bvecs);
+ if (unlikely(num_bvecs > BIO_MAX_PAGES))
+ num_bvecs = BIO_MAX_PAGES;
bio = bio_alloc_bioset(GFP_NOIO, num_bvecs, io->client->bios);
bio->bi_sector = where->sector + (where->count - remaining);
bio->bi_bdev = where->bdev;