aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorJunichi Nomura <j-nomura@ce.jp.nec.com>2014-10-03 07:55:16 -0400
committerMike Snitzer <snitzer@redhat.com>2014-10-05 20:03:34 -0400
commit997782735c0f1e2e069337129fe0d5738d83d19b (patch)
tree981b35bf9ae43c10ddb668eb254827b3ad775e04 /drivers/md
parentd8f429e1669b9709f5b669aac9d734dbe0640891 (diff)
dm: remove nr_iovecs parameter from alloc_tio()
alloc_tio() uses bio_alloc_bioset() to allocate a clone-bio for a bio. alloc_tio() takes the number of bvecs to allocate for the clone-bio. However, with v3.14's immutable biovec changes DM now uses __bio_clone_fast() and no longer needs to allocate bvecs. In practice, the 'nr_iovecs' passed to alloc_tio() is always effectively 0. __clone_and_map_simple_bio() looked like it was passing non-zero nr_iovecs, but its value was always within the range of inline bvecs and no allocation actually happened. If allocation happened, the BUG_ON() in __bio_clone_fast() would've triggered. Remove the nr_iovecs parameter from alloc_tio() to prevent possible future bio_alloc_bioset() mis-use of a new bioset interface that will no longer allow bvecs to be allocated. Also fix extra whitespace before the __bio_clone_fast() call in __clone_and_map_simple_bio(). Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 32b958dbc499..0b9de07d585b 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1249,13 +1249,13 @@ static void clone_bio(struct dm_target_io *tio, struct bio *bio,
1249} 1249}
1250 1250
1251static struct dm_target_io *alloc_tio(struct clone_info *ci, 1251static struct dm_target_io *alloc_tio(struct clone_info *ci,
1252 struct dm_target *ti, int nr_iovecs, 1252 struct dm_target *ti,
1253 unsigned target_bio_nr) 1253 unsigned target_bio_nr)
1254{ 1254{
1255 struct dm_target_io *tio; 1255 struct dm_target_io *tio;
1256 struct bio *clone; 1256 struct bio *clone;
1257 1257
1258 clone = bio_alloc_bioset(GFP_NOIO, nr_iovecs, ci->md->bs); 1258 clone = bio_alloc_bioset(GFP_NOIO, 0, ci->md->bs);
1259 tio = container_of(clone, struct dm_target_io, clone); 1259 tio = container_of(clone, struct dm_target_io, clone);
1260 1260
1261 tio->io = ci->io; 1261 tio->io = ci->io;
@@ -1269,17 +1269,12 @@ static void __clone_and_map_simple_bio(struct clone_info *ci,
1269 struct dm_target *ti, 1269 struct dm_target *ti,
1270 unsigned target_bio_nr, unsigned *len) 1270 unsigned target_bio_nr, unsigned *len)
1271{ 1271{
1272 struct dm_target_io *tio = alloc_tio(ci, ti, ci->bio->bi_max_vecs, target_bio_nr); 1272 struct dm_target_io *tio = alloc_tio(ci, ti, target_bio_nr);
1273 struct bio *clone = &tio->clone; 1273 struct bio *clone = &tio->clone;
1274 1274
1275 tio->len_ptr = len; 1275 tio->len_ptr = len;
1276 1276
1277 /* 1277 __bio_clone_fast(clone, ci->bio);
1278 * Discard requests require the bio's inline iovecs be initialized.
1279 * ci->bio->bi_max_vecs is BIO_INLINE_VECS anyway, for both flush
1280 * and discard, so no need for concern about wasted bvec allocations.
1281 */
1282 __bio_clone_fast(clone, ci->bio);
1283 if (len) 1278 if (len)
1284 bio_setup_sector(clone, ci->sector, *len); 1279 bio_setup_sector(clone, ci->sector, *len);
1285 1280
@@ -1322,7 +1317,7 @@ static void __clone_and_map_data_bio(struct clone_info *ci, struct dm_target *ti
1322 num_target_bios = ti->num_write_bios(ti, bio); 1317 num_target_bios = ti->num_write_bios(ti, bio);
1323 1318
1324 for (target_bio_nr = 0; target_bio_nr < num_target_bios; target_bio_nr++) { 1319 for (target_bio_nr = 0; target_bio_nr < num_target_bios; target_bio_nr++) {
1325 tio = alloc_tio(ci, ti, 0, target_bio_nr); 1320 tio = alloc_tio(ci, ti, target_bio_nr);
1326 tio->len_ptr = len; 1321 tio->len_ptr = len;
1327 clone_bio(tio, bio, sector, *len); 1322 clone_bio(tio, bio, sector, *len);
1328 __map_bio(tio); 1323 __map_bio(tio);