diff options
| author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-05-20 18:25:52 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2018-05-30 17:33:32 -0400 |
| commit | afeee514ce7f4cab605beedd03be71ebaf0c5fc8 (patch) | |
| tree | ca0a4f7ec08eec11b74e79e2f31afa8a9a836db7 | |
| parent | d19936a26658a7a53edd5619d631ee2c2c3151a2 (diff) | |
md: convert to bioset_init()/mempool_init()
Convert md to embedded bio sets.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
| -rw-r--r-- | drivers/md/md-faulty.c | 2 | ||||
| -rw-r--r-- | drivers/md/md-linear.c | 2 | ||||
| -rw-r--r-- | drivers/md/md-multipath.c | 17 | ||||
| -rw-r--r-- | drivers/md/md-multipath.h | 2 | ||||
| -rw-r--r-- | drivers/md/md.c | 61 | ||||
| -rw-r--r-- | drivers/md/md.h | 4 | ||||
| -rw-r--r-- | drivers/md/raid0.c | 5 | ||||
| -rw-r--r-- | drivers/md/raid1.c | 76 | ||||
| -rw-r--r-- | drivers/md/raid1.h | 6 | ||||
| -rw-r--r-- | drivers/md/raid10.c | 60 | ||||
| -rw-r--r-- | drivers/md/raid10.h | 6 | ||||
| -rw-r--r-- | drivers/md/raid5-cache.c | 43 | ||||
| -rw-r--r-- | drivers/md/raid5-ppl.c | 42 | ||||
| -rw-r--r-- | drivers/md/raid5.c | 12 | ||||
| -rw-r--r-- | drivers/md/raid5.h | 2 |
15 files changed, 159 insertions, 181 deletions
diff --git a/drivers/md/md-faulty.c b/drivers/md/md-faulty.c index 38264b38420f..c2fdf899de14 100644 --- a/drivers/md/md-faulty.c +++ b/drivers/md/md-faulty.c | |||
| @@ -214,7 +214,7 @@ static bool faulty_make_request(struct mddev *mddev, struct bio *bio) | |||
| 214 | } | 214 | } |
| 215 | } | 215 | } |
| 216 | if (failit) { | 216 | if (failit) { |
| 217 | struct bio *b = bio_clone_fast(bio, GFP_NOIO, mddev->bio_set); | 217 | struct bio *b = bio_clone_fast(bio, GFP_NOIO, &mddev->bio_set); |
| 218 | 218 | ||
| 219 | bio_set_dev(b, conf->rdev->bdev); | 219 | bio_set_dev(b, conf->rdev->bdev); |
| 220 | b->bi_private = bio; | 220 | b->bi_private = bio; |
diff --git a/drivers/md/md-linear.c b/drivers/md/md-linear.c index 4964323d936b..d45c697c0ebe 100644 --- a/drivers/md/md-linear.c +++ b/drivers/md/md-linear.c | |||
| @@ -269,7 +269,7 @@ static bool linear_make_request(struct mddev *mddev, struct bio *bio) | |||
| 269 | if (unlikely(bio_end_sector(bio) > end_sector)) { | 269 | if (unlikely(bio_end_sector(bio) > end_sector)) { |
| 270 | /* This bio crosses a device boundary, so we have to split it */ | 270 | /* This bio crosses a device boundary, so we have to split it */ |
| 271 | struct bio *split = bio_split(bio, end_sector - bio_sector, | 271 | struct bio *split = bio_split(bio, end_sector - bio_sector, |
| 272 | GFP_NOIO, mddev->bio_set); | 272 | GFP_NOIO, &mddev->bio_set); |
| 273 | bio_chain(split, bio); | 273 | bio_chain(split, bio); |
| 274 | generic_make_request(bio); | 274 | generic_make_request(bio); |
| 275 | bio = split; | 275 | bio = split; |
diff --git a/drivers/md/md-multipath.c b/drivers/md/md-multipath.c index 0a7e99d62c69..f71fcdb9b39c 100644 --- a/drivers/md/md-multipath.c +++ b/drivers/md/md-multipath.c | |||
| @@ -80,7 +80,7 @@ static void multipath_end_bh_io(struct multipath_bh *mp_bh, blk_status_t status) | |||
| 80 | 80 | ||
| 81 | bio->bi_status = status; | 81 | bio->bi_status = status; |
| 82 | bio_endio(bio); | 82 | bio_endio(bio); |
| 83 | mempool_free(mp_bh, conf->pool); | 83 | mempool_free(mp_bh, &conf->pool); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | static void multipath_end_request(struct bio *bio) | 86 | static void multipath_end_request(struct bio *bio) |
| @@ -117,7 +117,7 @@ static bool multipath_make_request(struct mddev *mddev, struct bio * bio) | |||
| 117 | return true; | 117 | return true; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | mp_bh = mempool_alloc(conf->pool, GFP_NOIO); | 120 | mp_bh = mempool_alloc(&conf->pool, GFP_NOIO); |
| 121 | 121 | ||
| 122 | mp_bh->master_bio = bio; | 122 | mp_bh->master_bio = bio; |
| 123 | mp_bh->mddev = mddev; | 123 | mp_bh->mddev = mddev; |
| @@ -125,7 +125,7 @@ static bool multipath_make_request(struct mddev *mddev, struct bio * bio) | |||
| 125 | mp_bh->path = multipath_map(conf); | 125 | mp_bh->path = multipath_map(conf); |
| 126 | if (mp_bh->path < 0) { | 126 | if (mp_bh->path < 0) { |
| 127 | bio_io_error(bio); | 127 | bio_io_error(bio); |
| 128 | mempool_free(mp_bh, conf->pool); | 128 | mempool_free(mp_bh, &conf->pool); |
| 129 | return true; | 129 | return true; |
| 130 | } | 130 | } |
| 131 | multipath = conf->multipaths + mp_bh->path; | 131 | multipath = conf->multipaths + mp_bh->path; |
| @@ -378,6 +378,7 @@ static int multipath_run (struct mddev *mddev) | |||
| 378 | struct multipath_info *disk; | 378 | struct multipath_info *disk; |
| 379 | struct md_rdev *rdev; | 379 | struct md_rdev *rdev; |
| 380 | int working_disks; | 380 | int working_disks; |
| 381 | int ret; | ||
| 381 | 382 | ||
| 382 | if (md_check_no_bitmap(mddev)) | 383 | if (md_check_no_bitmap(mddev)) |
| 383 | return -EINVAL; | 384 | return -EINVAL; |
| @@ -431,9 +432,9 @@ static int multipath_run (struct mddev *mddev) | |||
| 431 | } | 432 | } |
| 432 | mddev->degraded = conf->raid_disks - working_disks; | 433 | mddev->degraded = conf->raid_disks - working_disks; |
| 433 | 434 | ||
| 434 | conf->pool = mempool_create_kmalloc_pool(NR_RESERVED_BUFS, | 435 | ret = mempool_init_kmalloc_pool(&conf->pool, NR_RESERVED_BUFS, |
| 435 | sizeof(struct multipath_bh)); | 436 | sizeof(struct multipath_bh)); |
| 436 | if (conf->pool == NULL) | 437 | if (ret) |
| 437 | goto out_free_conf; | 438 | goto out_free_conf; |
| 438 | 439 | ||
| 439 | mddev->thread = md_register_thread(multipathd, mddev, | 440 | mddev->thread = md_register_thread(multipathd, mddev, |
| @@ -455,7 +456,7 @@ static int multipath_run (struct mddev *mddev) | |||
| 455 | return 0; | 456 | return 0; |
| 456 | 457 | ||
| 457 | out_free_conf: | 458 | out_free_conf: |
| 458 | mempool_destroy(conf->pool); | 459 | mempool_exit(&conf->pool); |
| 459 | kfree(conf->multipaths); | 460 | kfree(conf->multipaths); |
| 460 | kfree(conf); | 461 | kfree(conf); |
| 461 | mddev->private = NULL; | 462 | mddev->private = NULL; |
| @@ -467,7 +468,7 @@ static void multipath_free(struct mddev *mddev, void *priv) | |||
| 467 | { | 468 | { |
| 468 | struct mpconf *conf = priv; | 469 | struct mpconf *conf = priv; |
| 469 | 470 | ||
| 470 | mempool_destroy(conf->pool); | 471 | mempool_exit(&conf->pool); |
| 471 | kfree(conf->multipaths); | 472 | kfree(conf->multipaths); |
| 472 | kfree(conf); | 473 | kfree(conf); |
| 473 | } | 474 | } |
diff --git a/drivers/md/md-multipath.h b/drivers/md/md-multipath.h index 0adb941f485a..b3099e5fc4d7 100644 --- a/drivers/md/md-multipath.h +++ b/drivers/md/md-multipath.h | |||
| @@ -13,7 +13,7 @@ struct mpconf { | |||
| 13 | spinlock_t device_lock; | 13 | spinlock_t device_lock; |
| 14 | struct list_head retry_list; | 14 | struct list_head retry_list; |
| 15 | 15 | ||
| 16 | mempool_t *pool; | 16 | mempool_t pool; |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | /* | 19 | /* |
diff --git a/drivers/md/md.c b/drivers/md/md.c index c208c01f63a5..fc692b7128bb 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -193,10 +193,10 @@ struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, | |||
| 193 | { | 193 | { |
| 194 | struct bio *b; | 194 | struct bio *b; |
| 195 | 195 | ||
| 196 | if (!mddev || !mddev->bio_set) | 196 | if (!mddev || !bioset_initialized(&mddev->bio_set)) |
| 197 | return bio_alloc(gfp_mask, nr_iovecs); | 197 | return bio_alloc(gfp_mask, nr_iovecs); |
| 198 | 198 | ||
| 199 | b = bio_alloc_bioset(gfp_mask, nr_iovecs, mddev->bio_set); | 199 | b = bio_alloc_bioset(gfp_mask, nr_iovecs, &mddev->bio_set); |
| 200 | if (!b) | 200 | if (!b) |
| 201 | return NULL; | 201 | return NULL; |
| 202 | return b; | 202 | return b; |
| @@ -205,10 +205,10 @@ EXPORT_SYMBOL_GPL(bio_alloc_mddev); | |||
| 205 | 205 | ||
| 206 | static struct bio *md_bio_alloc_sync(struct mddev *mddev) | 206 | static struct bio *md_bio_alloc_sync(struct mddev *mddev) |
| 207 | { | 207 | { |
| 208 | if (!mddev || !mddev->sync_set) | 208 | if (!mddev || !bioset_initialized(&mddev->sync_set)) |
| 209 | return bio_alloc(GFP_NOIO, 1); | 209 | return bio_alloc(GFP_NOIO, 1); |
| 210 | 210 | ||
| 211 | return bio_alloc_bioset(GFP_NOIO, 1, mddev->sync_set); | 211 | return bio_alloc_bioset(GFP_NOIO, 1, &mddev->sync_set); |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | /* | 214 | /* |
| @@ -510,7 +510,10 @@ static void mddev_delayed_delete(struct work_struct *ws); | |||
| 510 | 510 | ||
| 511 | static void mddev_put(struct mddev *mddev) | 511 | static void mddev_put(struct mddev *mddev) |
| 512 | { | 512 | { |
| 513 | struct bio_set *bs = NULL, *sync_bs = NULL; | 513 | struct bio_set bs, sync_bs; |
| 514 | |||
| 515 | memset(&bs, 0, sizeof(bs)); | ||
| 516 | memset(&sync_bs, 0, sizeof(sync_bs)); | ||
| 514 | 517 | ||
| 515 | if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock)) | 518 | if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock)) |
| 516 | return; | 519 | return; |
| @@ -521,8 +524,8 @@ static void mddev_put(struct mddev *mddev) | |||
| 521 | list_del_init(&mddev->all_mddevs); | 524 | list_del_init(&mddev->all_mddevs); |
| 522 | bs = mddev->bio_set; | 525 | bs = mddev->bio_set; |
| 523 | sync_bs = mddev->sync_set; | 526 | sync_bs = mddev->sync_set; |
| 524 | mddev->bio_set = NULL; | 527 | memset(&mddev->bio_set, 0, sizeof(mddev->bio_set)); |
| 525 | mddev->sync_set = NULL; | 528 | memset(&mddev->sync_set, 0, sizeof(mddev->sync_set)); |
| 526 | if (mddev->gendisk) { | 529 | if (mddev->gendisk) { |
| 527 | /* We did a probe so need to clean up. Call | 530 | /* We did a probe so need to clean up. Call |
| 528 | * queue_work inside the spinlock so that | 531 | * queue_work inside the spinlock so that |
| @@ -535,10 +538,8 @@ static void mddev_put(struct mddev *mddev) | |||
| 535 | kfree(mddev); | 538 | kfree(mddev); |
| 536 | } | 539 | } |
| 537 | spin_unlock(&all_mddevs_lock); | 540 | spin_unlock(&all_mddevs_lock); |
| 538 | if (bs) | 541 | bioset_exit(&bs); |
| 539 | bioset_free(bs); | 542 | bioset_exit(&sync_bs); |
| 540 | if (sync_bs) | ||
| 541 | bioset_free(sync_bs); | ||
| 542 | } | 543 | } |
| 543 | 544 | ||
| 544 | static void md_safemode_timeout(struct timer_list *t); | 545 | static void md_safemode_timeout(struct timer_list *t); |
| @@ -2123,7 +2124,7 @@ int md_integrity_register(struct mddev *mddev) | |||
| 2123 | bdev_get_integrity(reference->bdev)); | 2124 | bdev_get_integrity(reference->bdev)); |
| 2124 | 2125 | ||
| 2125 | pr_debug("md: data integrity enabled on %s\n", mdname(mddev)); | 2126 | pr_debug("md: data integrity enabled on %s\n", mdname(mddev)); |
| 2126 | if (bioset_integrity_create(mddev->bio_set, BIO_POOL_SIZE)) { | 2127 | if (bioset_integrity_create(&mddev->bio_set, BIO_POOL_SIZE)) { |
| 2127 | pr_err("md: failed to create integrity pool for %s\n", | 2128 | pr_err("md: failed to create integrity pool for %s\n", |
| 2128 | mdname(mddev)); | 2129 | mdname(mddev)); |
| 2129 | return -EINVAL; | 2130 | return -EINVAL; |
| @@ -5497,17 +5498,15 @@ int md_run(struct mddev *mddev) | |||
| 5497 | sysfs_notify_dirent_safe(rdev->sysfs_state); | 5498 | sysfs_notify_dirent_safe(rdev->sysfs_state); |
| 5498 | } | 5499 | } |
| 5499 | 5500 | ||
| 5500 | if (mddev->bio_set == NULL) { | 5501 | if (!bioset_initialized(&mddev->bio_set)) { |
| 5501 | mddev->bio_set = bioset_create(BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS); | 5502 | err = bioset_init(&mddev->bio_set, BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS); |
| 5502 | if (!mddev->bio_set) | 5503 | if (err) |
| 5503 | return -ENOMEM; | 5504 | return err; |
| 5504 | } | 5505 | } |
| 5505 | if (mddev->sync_set == NULL) { | 5506 | if (!bioset_initialized(&mddev->sync_set)) { |
| 5506 | mddev->sync_set = bioset_create(BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS); | 5507 | err = bioset_init(&mddev->sync_set, BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS); |
| 5507 | if (!mddev->sync_set) { | 5508 | if (err) |
| 5508 | err = -ENOMEM; | ||
| 5509 | goto abort; | 5509 | goto abort; |
| 5510 | } | ||
| 5511 | } | 5510 | } |
| 5512 | 5511 | ||
| 5513 | spin_lock(&pers_lock); | 5512 | spin_lock(&pers_lock); |
| @@ -5668,14 +5667,8 @@ int md_run(struct mddev *mddev) | |||
| 5668 | return 0; | 5667 | return 0; |
| 5669 | 5668 | ||
| 5670 | abort: | 5669 | abort: |
| 5671 | if (mddev->bio_set) { | 5670 | bioset_exit(&mddev->bio_set); |
| 5672 | bioset_free(mddev->bio_set); | 5671 | bioset_exit(&mddev->sync_set); |
| 5673 | mddev->bio_set = NULL; | ||
| 5674 | } | ||
| 5675 | if (mddev->sync_set) { | ||
| 5676 | bioset_free(mddev->sync_set); | ||
| 5677 | mddev->sync_set = NULL; | ||
| 5678 | } | ||
| 5679 | 5672 | ||
| 5680 | return err; | 5673 | return err; |
| 5681 | } | 5674 | } |
| @@ -5888,14 +5881,8 @@ void md_stop(struct mddev *mddev) | |||
| 5888 | * This is called from dm-raid | 5881 | * This is called from dm-raid |
| 5889 | */ | 5882 | */ |
| 5890 | __md_stop(mddev); | 5883 | __md_stop(mddev); |
| 5891 | if (mddev->bio_set) { | 5884 | bioset_exit(&mddev->bio_set); |
| 5892 | bioset_free(mddev->bio_set); | 5885 | bioset_exit(&mddev->sync_set); |
| 5893 | mddev->bio_set = NULL; | ||
| 5894 | } | ||
| 5895 | if (mddev->sync_set) { | ||
| 5896 | bioset_free(mddev->sync_set); | ||
| 5897 | mddev->sync_set = NULL; | ||
| 5898 | } | ||
| 5899 | } | 5886 | } |
| 5900 | 5887 | ||
| 5901 | EXPORT_SYMBOL_GPL(md_stop); | 5888 | EXPORT_SYMBOL_GPL(md_stop); |
diff --git a/drivers/md/md.h b/drivers/md/md.h index fbc925cce810..3507cab22cb6 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
| @@ -452,8 +452,8 @@ struct mddev { | |||
| 452 | 452 | ||
| 453 | struct attribute_group *to_remove; | 453 | struct attribute_group *to_remove; |
| 454 | 454 | ||
| 455 | struct bio_set *bio_set; | 455 | struct bio_set bio_set; |
| 456 | struct bio_set *sync_set; /* for sync operations like | 456 | struct bio_set sync_set; /* for sync operations like |
| 457 | * metadata and bitmap writes | 457 | * metadata and bitmap writes |
| 458 | */ | 458 | */ |
| 459 | 459 | ||
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 584c10347267..65ae47a02218 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
| @@ -479,7 +479,7 @@ static void raid0_handle_discard(struct mddev *mddev, struct bio *bio) | |||
| 479 | if (bio_end_sector(bio) > zone->zone_end) { | 479 | if (bio_end_sector(bio) > zone->zone_end) { |
| 480 | struct bio *split = bio_split(bio, | 480 | struct bio *split = bio_split(bio, |
| 481 | zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO, | 481 | zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO, |
| 482 | mddev->bio_set); | 482 | &mddev->bio_set); |
| 483 | bio_chain(split, bio); | 483 | bio_chain(split, bio); |
| 484 | generic_make_request(bio); | 484 | generic_make_request(bio); |
| 485 | bio = split; | 485 | bio = split; |
| @@ -582,7 +582,8 @@ static bool raid0_make_request(struct mddev *mddev, struct bio *bio) | |||
| 582 | sector = bio_sector; | 582 | sector = bio_sector; |
| 583 | 583 | ||
| 584 | if (sectors < bio_sectors(bio)) { | 584 | if (sectors < bio_sectors(bio)) { |
| 585 | struct bio *split = bio_split(bio, sectors, GFP_NOIO, mddev->bio_set); | 585 | struct bio *split = bio_split(bio, sectors, GFP_NOIO, |
| 586 | &mddev->bio_set); | ||
| 586 | bio_chain(split, bio); | 587 | bio_chain(split, bio); |
| 587 | generic_make_request(bio); | 588 | generic_make_request(bio); |
| 588 | bio = split; | 589 | bio = split; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index e9e3308cb0a7..bad28520719b 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
| @@ -221,7 +221,7 @@ static void free_r1bio(struct r1bio *r1_bio) | |||
| 221 | struct r1conf *conf = r1_bio->mddev->private; | 221 | struct r1conf *conf = r1_bio->mddev->private; |
| 222 | 222 | ||
| 223 | put_all_bios(conf, r1_bio); | 223 | put_all_bios(conf, r1_bio); |
| 224 | mempool_free(r1_bio, conf->r1bio_pool); | 224 | mempool_free(r1_bio, &conf->r1bio_pool); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | static void put_buf(struct r1bio *r1_bio) | 227 | static void put_buf(struct r1bio *r1_bio) |
| @@ -236,7 +236,7 @@ static void put_buf(struct r1bio *r1_bio) | |||
| 236 | rdev_dec_pending(conf->mirrors[i].rdev, r1_bio->mddev); | 236 | rdev_dec_pending(conf->mirrors[i].rdev, r1_bio->mddev); |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | mempool_free(r1_bio, conf->r1buf_pool); | 239 | mempool_free(r1_bio, &conf->r1buf_pool); |
| 240 | 240 | ||
| 241 | lower_barrier(conf, sect); | 241 | lower_barrier(conf, sect); |
| 242 | } | 242 | } |
| @@ -1178,7 +1178,7 @@ alloc_r1bio(struct mddev *mddev, struct bio *bio) | |||
| 1178 | struct r1conf *conf = mddev->private; | 1178 | struct r1conf *conf = mddev->private; |
| 1179 | struct r1bio *r1_bio; | 1179 | struct r1bio *r1_bio; |
| 1180 | 1180 | ||
| 1181 | r1_bio = mempool_alloc(conf->r1bio_pool, GFP_NOIO); | 1181 | r1_bio = mempool_alloc(&conf->r1bio_pool, GFP_NOIO); |
| 1182 | /* Ensure no bio records IO_BLOCKED */ | 1182 | /* Ensure no bio records IO_BLOCKED */ |
| 1183 | memset(r1_bio->bios, 0, conf->raid_disks * sizeof(r1_bio->bios[0])); | 1183 | memset(r1_bio->bios, 0, conf->raid_disks * sizeof(r1_bio->bios[0])); |
| 1184 | init_r1bio(r1_bio, mddev, bio); | 1184 | init_r1bio(r1_bio, mddev, bio); |
| @@ -1268,7 +1268,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, | |||
| 1268 | 1268 | ||
| 1269 | if (max_sectors < bio_sectors(bio)) { | 1269 | if (max_sectors < bio_sectors(bio)) { |
| 1270 | struct bio *split = bio_split(bio, max_sectors, | 1270 | struct bio *split = bio_split(bio, max_sectors, |
| 1271 | gfp, conf->bio_split); | 1271 | gfp, &conf->bio_split); |
| 1272 | bio_chain(split, bio); | 1272 | bio_chain(split, bio); |
| 1273 | generic_make_request(bio); | 1273 | generic_make_request(bio); |
| 1274 | bio = split; | 1274 | bio = split; |
| @@ -1278,7 +1278,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, | |||
| 1278 | 1278 | ||
| 1279 | r1_bio->read_disk = rdisk; | 1279 | r1_bio->read_disk = rdisk; |
| 1280 | 1280 | ||
| 1281 | read_bio = bio_clone_fast(bio, gfp, mddev->bio_set); | 1281 | read_bio = bio_clone_fast(bio, gfp, &mddev->bio_set); |
| 1282 | 1282 | ||
| 1283 | r1_bio->bios[rdisk] = read_bio; | 1283 | r1_bio->bios[rdisk] = read_bio; |
| 1284 | 1284 | ||
| @@ -1439,7 +1439,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, | |||
| 1439 | 1439 | ||
| 1440 | if (max_sectors < bio_sectors(bio)) { | 1440 | if (max_sectors < bio_sectors(bio)) { |
| 1441 | struct bio *split = bio_split(bio, max_sectors, | 1441 | struct bio *split = bio_split(bio, max_sectors, |
| 1442 | GFP_NOIO, conf->bio_split); | 1442 | GFP_NOIO, &conf->bio_split); |
| 1443 | bio_chain(split, bio); | 1443 | bio_chain(split, bio); |
| 1444 | generic_make_request(bio); | 1444 | generic_make_request(bio); |
| 1445 | bio = split; | 1445 | bio = split; |
| @@ -1479,9 +1479,9 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, | |||
| 1479 | 1479 | ||
| 1480 | if (r1_bio->behind_master_bio) | 1480 | if (r1_bio->behind_master_bio) |
| 1481 | mbio = bio_clone_fast(r1_bio->behind_master_bio, | 1481 | mbio = bio_clone_fast(r1_bio->behind_master_bio, |
| 1482 | GFP_NOIO, mddev->bio_set); | 1482 | GFP_NOIO, &mddev->bio_set); |
| 1483 | else | 1483 | else |
| 1484 | mbio = bio_clone_fast(bio, GFP_NOIO, mddev->bio_set); | 1484 | mbio = bio_clone_fast(bio, GFP_NOIO, &mddev->bio_set); |
| 1485 | 1485 | ||
| 1486 | if (r1_bio->behind_master_bio) { | 1486 | if (r1_bio->behind_master_bio) { |
| 1487 | if (test_bit(WriteMostly, &conf->mirrors[i].rdev->flags)) | 1487 | if (test_bit(WriteMostly, &conf->mirrors[i].rdev->flags)) |
| @@ -1657,8 +1657,7 @@ static void close_sync(struct r1conf *conf) | |||
| 1657 | _allow_barrier(conf, idx); | 1657 | _allow_barrier(conf, idx); |
| 1658 | } | 1658 | } |
| 1659 | 1659 | ||
| 1660 | mempool_destroy(conf->r1buf_pool); | 1660 | mempool_exit(&conf->r1buf_pool); |
| 1661 | conf->r1buf_pool = NULL; | ||
| 1662 | } | 1661 | } |
| 1663 | 1662 | ||
| 1664 | static int raid1_spare_active(struct mddev *mddev) | 1663 | static int raid1_spare_active(struct mddev *mddev) |
| @@ -2348,10 +2347,10 @@ static int narrow_write_error(struct r1bio *r1_bio, int i) | |||
| 2348 | if (test_bit(R1BIO_BehindIO, &r1_bio->state)) { | 2347 | if (test_bit(R1BIO_BehindIO, &r1_bio->state)) { |
| 2349 | wbio = bio_clone_fast(r1_bio->behind_master_bio, | 2348 | wbio = bio_clone_fast(r1_bio->behind_master_bio, |
| 2350 | GFP_NOIO, | 2349 | GFP_NOIO, |
| 2351 | mddev->bio_set); | 2350 | &mddev->bio_set); |
| 2352 | } else { | 2351 | } else { |
| 2353 | wbio = bio_clone_fast(r1_bio->master_bio, GFP_NOIO, | 2352 | wbio = bio_clone_fast(r1_bio->master_bio, GFP_NOIO, |
| 2354 | mddev->bio_set); | 2353 | &mddev->bio_set); |
| 2355 | } | 2354 | } |
| 2356 | 2355 | ||
| 2357 | bio_set_op_attrs(wbio, REQ_OP_WRITE, 0); | 2356 | bio_set_op_attrs(wbio, REQ_OP_WRITE, 0); |
| @@ -2564,17 +2563,15 @@ static int init_resync(struct r1conf *conf) | |||
| 2564 | int buffs; | 2563 | int buffs; |
| 2565 | 2564 | ||
| 2566 | buffs = RESYNC_WINDOW / RESYNC_BLOCK_SIZE; | 2565 | buffs = RESYNC_WINDOW / RESYNC_BLOCK_SIZE; |
| 2567 | BUG_ON(conf->r1buf_pool); | 2566 | BUG_ON(mempool_initialized(&conf->r1buf_pool)); |
| 2568 | conf->r1buf_pool = mempool_create(buffs, r1buf_pool_alloc, r1buf_pool_free, | 2567 | |
| 2569 | conf->poolinfo); | 2568 | return mempool_init(&conf->r1buf_pool, buffs, r1buf_pool_alloc, |
| 2570 | if (!conf->r1buf_pool) | 2569 | r1buf_pool_free, conf->poolinfo); |
| 2571 | return -ENOMEM; | ||
| 2572 | return 0; | ||
| 2573 | } | 2570 | } |
| 2574 | 2571 | ||
| 2575 | static struct r1bio *raid1_alloc_init_r1buf(struct r1conf *conf) | 2572 | static struct r1bio *raid1_alloc_init_r1buf(struct r1conf *conf) |
| 2576 | { | 2573 | { |
| 2577 | struct r1bio *r1bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO); | 2574 | struct r1bio *r1bio = mempool_alloc(&conf->r1buf_pool, GFP_NOIO); |
| 2578 | struct resync_pages *rps; | 2575 | struct resync_pages *rps; |
| 2579 | struct bio *bio; | 2576 | struct bio *bio; |
| 2580 | int i; | 2577 | int i; |
| @@ -2617,7 +2614,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, | |||
| 2617 | int idx = sector_to_idx(sector_nr); | 2614 | int idx = sector_to_idx(sector_nr); |
| 2618 | int page_idx = 0; | 2615 | int page_idx = 0; |
| 2619 | 2616 | ||
| 2620 | if (!conf->r1buf_pool) | 2617 | if (!mempool_initialized(&conf->r1buf_pool)) |
| 2621 | if (init_resync(conf)) | 2618 | if (init_resync(conf)) |
| 2622 | return 0; | 2619 | return 0; |
| 2623 | 2620 | ||
| @@ -2953,14 +2950,13 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
| 2953 | if (!conf->poolinfo) | 2950 | if (!conf->poolinfo) |
| 2954 | goto abort; | 2951 | goto abort; |
| 2955 | conf->poolinfo->raid_disks = mddev->raid_disks * 2; | 2952 | conf->poolinfo->raid_disks = mddev->raid_disks * 2; |
| 2956 | conf->r1bio_pool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc, | 2953 | err = mempool_init(&conf->r1bio_pool, NR_RAID1_BIOS, r1bio_pool_alloc, |
| 2957 | r1bio_pool_free, | 2954 | r1bio_pool_free, conf->poolinfo); |
| 2958 | conf->poolinfo); | 2955 | if (err) |
| 2959 | if (!conf->r1bio_pool) | ||
| 2960 | goto abort; | 2956 | goto abort; |
| 2961 | 2957 | ||
| 2962 | conf->bio_split = bioset_create(BIO_POOL_SIZE, 0, 0); | 2958 | err = bioset_init(&conf->bio_split, BIO_POOL_SIZE, 0, 0); |
| 2963 | if (!conf->bio_split) | 2959 | if (err) |
| 2964 | goto abort; | 2960 | goto abort; |
| 2965 | 2961 | ||
| 2966 | conf->poolinfo->mddev = mddev; | 2962 | conf->poolinfo->mddev = mddev; |
| @@ -3033,7 +3029,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
| 3033 | 3029 | ||
| 3034 | abort: | 3030 | abort: |
| 3035 | if (conf) { | 3031 | if (conf) { |
| 3036 | mempool_destroy(conf->r1bio_pool); | 3032 | mempool_exit(&conf->r1bio_pool); |
| 3037 | kfree(conf->mirrors); | 3033 | kfree(conf->mirrors); |
| 3038 | safe_put_page(conf->tmppage); | 3034 | safe_put_page(conf->tmppage); |
| 3039 | kfree(conf->poolinfo); | 3035 | kfree(conf->poolinfo); |
| @@ -3041,8 +3037,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
| 3041 | kfree(conf->nr_waiting); | 3037 | kfree(conf->nr_waiting); |
| 3042 | kfree(conf->nr_queued); | 3038 | kfree(conf->nr_queued); |
| 3043 | kfree(conf->barrier); | 3039 | kfree(conf->barrier); |
| 3044 | if (conf->bio_split) | 3040 | bioset_exit(&conf->bio_split); |
| 3045 | bioset_free(conf->bio_split); | ||
| 3046 | kfree(conf); | 3041 | kfree(conf); |
| 3047 | } | 3042 | } |
| 3048 | return ERR_PTR(err); | 3043 | return ERR_PTR(err); |
| @@ -3144,7 +3139,7 @@ static void raid1_free(struct mddev *mddev, void *priv) | |||
| 3144 | { | 3139 | { |
| 3145 | struct r1conf *conf = priv; | 3140 | struct r1conf *conf = priv; |
| 3146 | 3141 | ||
| 3147 | mempool_destroy(conf->r1bio_pool); | 3142 | mempool_exit(&conf->r1bio_pool); |
| 3148 | kfree(conf->mirrors); | 3143 | kfree(conf->mirrors); |
| 3149 | safe_put_page(conf->tmppage); | 3144 | safe_put_page(conf->tmppage); |
| 3150 | kfree(conf->poolinfo); | 3145 | kfree(conf->poolinfo); |
| @@ -3152,8 +3147,7 @@ static void raid1_free(struct mddev *mddev, void *priv) | |||
| 3152 | kfree(conf->nr_waiting); | 3147 | kfree(conf->nr_waiting); |
| 3153 | kfree(conf->nr_queued); | 3148 | kfree(conf->nr_queued); |
| 3154 | kfree(conf->barrier); | 3149 | kfree(conf->barrier); |
| 3155 | if (conf->bio_split) | 3150 | bioset_exit(&conf->bio_split); |
| 3156 | bioset_free(conf->bio_split); | ||
| 3157 | kfree(conf); | 3151 | kfree(conf); |
| 3158 | } | 3152 | } |
| 3159 | 3153 | ||
| @@ -3199,13 +3193,17 @@ static int raid1_reshape(struct mddev *mddev) | |||
| 3199 | * At the same time, we "pack" the devices so that all the missing | 3193 | * At the same time, we "pack" the devices so that all the missing |
| 3200 | * devices have the higher raid_disk numbers. | 3194 | * devices have the higher raid_disk numbers. |
| 3201 | */ | 3195 | */ |
| 3202 | mempool_t *newpool, *oldpool; | 3196 | mempool_t newpool, oldpool; |
| 3203 | struct pool_info *newpoolinfo; | 3197 | struct pool_info *newpoolinfo; |
| 3204 | struct raid1_info *newmirrors; | 3198 | struct raid1_info *newmirrors; |
| 3205 | struct r1conf *conf = mddev->private; | 3199 | struct r1conf *conf = mddev->private; |
| 3206 | int cnt, raid_disks; | 3200 | int cnt, raid_disks; |
| 3207 | unsigned long flags; | 3201 | unsigned long flags; |
| 3208 | int d, d2; | 3202 | int d, d2; |
| 3203 | int ret; | ||
| 3204 | |||
| 3205 | memset(&newpool, 0, sizeof(newpool)); | ||
| 3206 | memset(&oldpool, 0, sizeof(oldpool)); | ||
| 3209 | 3207 | ||
| 3210 | /* Cannot change chunk_size, layout, or level */ | 3208 | /* Cannot change chunk_size, layout, or level */ |
| 3211 | if (mddev->chunk_sectors != mddev->new_chunk_sectors || | 3209 | if (mddev->chunk_sectors != mddev->new_chunk_sectors || |
| @@ -3237,17 +3235,17 @@ static int raid1_reshape(struct mddev *mddev) | |||
| 3237 | newpoolinfo->mddev = mddev; | 3235 | newpoolinfo->mddev = mddev; |
| 3238 | newpoolinfo->raid_disks = raid_disks * 2; | 3236 | newpoolinfo->raid_disks = raid_disks * 2; |
| 3239 | 3237 | ||
| 3240 | newpool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc, | 3238 | ret = mempool_init(&newpool, NR_RAID1_BIOS, r1bio_pool_alloc, |
| 3241 | r1bio_pool_free, newpoolinfo); | 3239 | r1bio_pool_free, newpoolinfo); |
| 3242 | if (!newpool) { | 3240 | if (ret) { |
| 3243 | kfree(newpoolinfo); | 3241 | kfree(newpoolinfo); |
| 3244 | return -ENOMEM; | 3242 | return ret; |
| 3245 | } | 3243 | } |
| 3246 | newmirrors = kzalloc(sizeof(struct raid1_info) * raid_disks * 2, | 3244 | newmirrors = kzalloc(sizeof(struct raid1_info) * raid_disks * 2, |
| 3247 | GFP_KERNEL); | 3245 | GFP_KERNEL); |
| 3248 | if (!newmirrors) { | 3246 | if (!newmirrors) { |
| 3249 | kfree(newpoolinfo); | 3247 | kfree(newpoolinfo); |
| 3250 | mempool_destroy(newpool); | 3248 | mempool_exit(&newpool); |
| 3251 | return -ENOMEM; | 3249 | return -ENOMEM; |
| 3252 | } | 3250 | } |
| 3253 | 3251 | ||
| @@ -3287,7 +3285,7 @@ static int raid1_reshape(struct mddev *mddev) | |||
| 3287 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 3285 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
| 3288 | md_wakeup_thread(mddev->thread); | 3286 | md_wakeup_thread(mddev->thread); |
| 3289 | 3287 | ||
| 3290 | mempool_destroy(oldpool); | 3288 | mempool_exit(&oldpool); |
| 3291 | return 0; | 3289 | return 0; |
| 3292 | } | 3290 | } |
| 3293 | 3291 | ||
diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h index eb84bc68e2fd..e7ccad898736 100644 --- a/drivers/md/raid1.h +++ b/drivers/md/raid1.h | |||
| @@ -118,10 +118,10 @@ struct r1conf { | |||
| 118 | * mempools - it changes when the array grows or shrinks | 118 | * mempools - it changes when the array grows or shrinks |
| 119 | */ | 119 | */ |
| 120 | struct pool_info *poolinfo; | 120 | struct pool_info *poolinfo; |
| 121 | mempool_t *r1bio_pool; | 121 | mempool_t r1bio_pool; |
| 122 | mempool_t *r1buf_pool; | 122 | mempool_t r1buf_pool; |
| 123 | 123 | ||
| 124 | struct bio_set *bio_split; | 124 | struct bio_set bio_split; |
| 125 | 125 | ||
| 126 | /* temporary buffer to synchronous IO when attempting to repair | 126 | /* temporary buffer to synchronous IO when attempting to repair |
| 127 | * a read error. | 127 | * a read error. |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 3c60774c8430..37d4b236b81b 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
| @@ -291,14 +291,14 @@ static void free_r10bio(struct r10bio *r10_bio) | |||
| 291 | struct r10conf *conf = r10_bio->mddev->private; | 291 | struct r10conf *conf = r10_bio->mddev->private; |
| 292 | 292 | ||
| 293 | put_all_bios(conf, r10_bio); | 293 | put_all_bios(conf, r10_bio); |
| 294 | mempool_free(r10_bio, conf->r10bio_pool); | 294 | mempool_free(r10_bio, &conf->r10bio_pool); |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | static void put_buf(struct r10bio *r10_bio) | 297 | static void put_buf(struct r10bio *r10_bio) |
| 298 | { | 298 | { |
| 299 | struct r10conf *conf = r10_bio->mddev->private; | 299 | struct r10conf *conf = r10_bio->mddev->private; |
| 300 | 300 | ||
| 301 | mempool_free(r10_bio, conf->r10buf_pool); | 301 | mempool_free(r10_bio, &conf->r10buf_pool); |
| 302 | 302 | ||
| 303 | lower_barrier(conf); | 303 | lower_barrier(conf); |
| 304 | } | 304 | } |
| @@ -1204,7 +1204,7 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio, | |||
| 1204 | (unsigned long long)r10_bio->sector); | 1204 | (unsigned long long)r10_bio->sector); |
| 1205 | if (max_sectors < bio_sectors(bio)) { | 1205 | if (max_sectors < bio_sectors(bio)) { |
| 1206 | struct bio *split = bio_split(bio, max_sectors, | 1206 | struct bio *split = bio_split(bio, max_sectors, |
| 1207 | gfp, conf->bio_split); | 1207 | gfp, &conf->bio_split); |
| 1208 | bio_chain(split, bio); | 1208 | bio_chain(split, bio); |
| 1209 | generic_make_request(bio); | 1209 | generic_make_request(bio); |
| 1210 | bio = split; | 1210 | bio = split; |
| @@ -1213,7 +1213,7 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio, | |||
| 1213 | } | 1213 | } |
| 1214 | slot = r10_bio->read_slot; | 1214 | slot = r10_bio->read_slot; |
| 1215 | 1215 | ||
| 1216 | read_bio = bio_clone_fast(bio, gfp, mddev->bio_set); | 1216 | read_bio = bio_clone_fast(bio, gfp, &mddev->bio_set); |
| 1217 | 1217 | ||
| 1218 | r10_bio->devs[slot].bio = read_bio; | 1218 | r10_bio->devs[slot].bio = read_bio; |
| 1219 | r10_bio->devs[slot].rdev = rdev; | 1219 | r10_bio->devs[slot].rdev = rdev; |
| @@ -1261,7 +1261,7 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio, | |||
| 1261 | } else | 1261 | } else |
| 1262 | rdev = conf->mirrors[devnum].rdev; | 1262 | rdev = conf->mirrors[devnum].rdev; |
| 1263 | 1263 | ||
| 1264 | mbio = bio_clone_fast(bio, GFP_NOIO, mddev->bio_set); | 1264 | mbio = bio_clone_fast(bio, GFP_NOIO, &mddev->bio_set); |
| 1265 | if (replacement) | 1265 | if (replacement) |
| 1266 | r10_bio->devs[n_copy].repl_bio = mbio; | 1266 | r10_bio->devs[n_copy].repl_bio = mbio; |
| 1267 | else | 1267 | else |
| @@ -1509,7 +1509,7 @@ retry_write: | |||
| 1509 | 1509 | ||
| 1510 | if (r10_bio->sectors < bio_sectors(bio)) { | 1510 | if (r10_bio->sectors < bio_sectors(bio)) { |
| 1511 | struct bio *split = bio_split(bio, r10_bio->sectors, | 1511 | struct bio *split = bio_split(bio, r10_bio->sectors, |
| 1512 | GFP_NOIO, conf->bio_split); | 1512 | GFP_NOIO, &conf->bio_split); |
| 1513 | bio_chain(split, bio); | 1513 | bio_chain(split, bio); |
| 1514 | generic_make_request(bio); | 1514 | generic_make_request(bio); |
| 1515 | bio = split; | 1515 | bio = split; |
| @@ -1533,7 +1533,7 @@ static void __make_request(struct mddev *mddev, struct bio *bio, int sectors) | |||
| 1533 | struct r10conf *conf = mddev->private; | 1533 | struct r10conf *conf = mddev->private; |
| 1534 | struct r10bio *r10_bio; | 1534 | struct r10bio *r10_bio; |
| 1535 | 1535 | ||
| 1536 | r10_bio = mempool_alloc(conf->r10bio_pool, GFP_NOIO); | 1536 | r10_bio = mempool_alloc(&conf->r10bio_pool, GFP_NOIO); |
| 1537 | 1537 | ||
| 1538 | r10_bio->master_bio = bio; | 1538 | r10_bio->master_bio = bio; |
| 1539 | r10_bio->sectors = sectors; | 1539 | r10_bio->sectors = sectors; |
| @@ -1732,8 +1732,7 @@ static void close_sync(struct r10conf *conf) | |||
| 1732 | wait_barrier(conf); | 1732 | wait_barrier(conf); |
| 1733 | allow_barrier(conf); | 1733 | allow_barrier(conf); |
| 1734 | 1734 | ||
| 1735 | mempool_destroy(conf->r10buf_pool); | 1735 | mempool_exit(&conf->r10buf_pool); |
| 1736 | conf->r10buf_pool = NULL; | ||
| 1737 | } | 1736 | } |
| 1738 | 1737 | ||
| 1739 | static int raid10_spare_active(struct mddev *mddev) | 1738 | static int raid10_spare_active(struct mddev *mddev) |
| @@ -2583,7 +2582,7 @@ static int narrow_write_error(struct r10bio *r10_bio, int i) | |||
| 2583 | if (sectors > sect_to_write) | 2582 | if (sectors > sect_to_write) |
| 2584 | sectors = sect_to_write; | 2583 | sectors = sect_to_write; |
| 2585 | /* Write at 'sector' for 'sectors' */ | 2584 | /* Write at 'sector' for 'sectors' */ |
| 2586 | wbio = bio_clone_fast(bio, GFP_NOIO, mddev->bio_set); | 2585 | wbio = bio_clone_fast(bio, GFP_NOIO, &mddev->bio_set); |
| 2587 | bio_trim(wbio, sector - bio->bi_iter.bi_sector, sectors); | 2586 | bio_trim(wbio, sector - bio->bi_iter.bi_sector, sectors); |
| 2588 | wsector = r10_bio->devs[i].addr + (sector - r10_bio->sector); | 2587 | wsector = r10_bio->devs[i].addr + (sector - r10_bio->sector); |
| 2589 | wbio->bi_iter.bi_sector = wsector + | 2588 | wbio->bi_iter.bi_sector = wsector + |
| @@ -2816,25 +2815,25 @@ static void raid10d(struct md_thread *thread) | |||
| 2816 | 2815 | ||
| 2817 | static int init_resync(struct r10conf *conf) | 2816 | static int init_resync(struct r10conf *conf) |
| 2818 | { | 2817 | { |
| 2819 | int buffs; | 2818 | int ret, buffs, i; |
| 2820 | int i; | ||
| 2821 | 2819 | ||
| 2822 | buffs = RESYNC_WINDOW / RESYNC_BLOCK_SIZE; | 2820 | buffs = RESYNC_WINDOW / RESYNC_BLOCK_SIZE; |
| 2823 | BUG_ON(conf->r10buf_pool); | 2821 | BUG_ON(mempool_initialized(&conf->r10buf_pool)); |
| 2824 | conf->have_replacement = 0; | 2822 | conf->have_replacement = 0; |
| 2825 | for (i = 0; i < conf->geo.raid_disks; i++) | 2823 | for (i = 0; i < conf->geo.raid_disks; i++) |
| 2826 | if (conf->mirrors[i].replacement) | 2824 | if (conf->mirrors[i].replacement) |
| 2827 | conf->have_replacement = 1; | 2825 | conf->have_replacement = 1; |
| 2828 | conf->r10buf_pool = mempool_create(buffs, r10buf_pool_alloc, r10buf_pool_free, conf); | 2826 | ret = mempool_init(&conf->r10buf_pool, buffs, |
| 2829 | if (!conf->r10buf_pool) | 2827 | r10buf_pool_alloc, r10buf_pool_free, conf); |
| 2830 | return -ENOMEM; | 2828 | if (ret) |
| 2829 | return ret; | ||
| 2831 | conf->next_resync = 0; | 2830 | conf->next_resync = 0; |
| 2832 | return 0; | 2831 | return 0; |
| 2833 | } | 2832 | } |
| 2834 | 2833 | ||
| 2835 | static struct r10bio *raid10_alloc_init_r10buf(struct r10conf *conf) | 2834 | static struct r10bio *raid10_alloc_init_r10buf(struct r10conf *conf) |
| 2836 | { | 2835 | { |
| 2837 | struct r10bio *r10bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); | 2836 | struct r10bio *r10bio = mempool_alloc(&conf->r10buf_pool, GFP_NOIO); |
| 2838 | struct rsync_pages *rp; | 2837 | struct rsync_pages *rp; |
| 2839 | struct bio *bio; | 2838 | struct bio *bio; |
| 2840 | int nalloc; | 2839 | int nalloc; |
| @@ -2945,7 +2944,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, | |||
| 2945 | sector_t chunk_mask = conf->geo.chunk_mask; | 2944 | sector_t chunk_mask = conf->geo.chunk_mask; |
| 2946 | int page_idx = 0; | 2945 | int page_idx = 0; |
| 2947 | 2946 | ||
| 2948 | if (!conf->r10buf_pool) | 2947 | if (!mempool_initialized(&conf->r10buf_pool)) |
| 2949 | if (init_resync(conf)) | 2948 | if (init_resync(conf)) |
| 2950 | return 0; | 2949 | return 0; |
| 2951 | 2950 | ||
| @@ -3699,13 +3698,13 @@ static struct r10conf *setup_conf(struct mddev *mddev) | |||
| 3699 | 3698 | ||
| 3700 | conf->geo = geo; | 3699 | conf->geo = geo; |
| 3701 | conf->copies = copies; | 3700 | conf->copies = copies; |
| 3702 | conf->r10bio_pool = mempool_create(NR_RAID10_BIOS, r10bio_pool_alloc, | 3701 | err = mempool_init(&conf->r10bio_pool, NR_RAID10_BIOS, r10bio_pool_alloc, |
| 3703 | r10bio_pool_free, conf); | 3702 | r10bio_pool_free, conf); |
| 3704 | if (!conf->r10bio_pool) | 3703 | if (err) |
| 3705 | goto out; | 3704 | goto out; |
| 3706 | 3705 | ||
| 3707 | conf->bio_split = bioset_create(BIO_POOL_SIZE, 0, 0); | 3706 | err = bioset_init(&conf->bio_split, BIO_POOL_SIZE, 0, 0); |
| 3708 | if (!conf->bio_split) | 3707 | if (err) |
| 3709 | goto out; | 3708 | goto out; |
| 3710 | 3709 | ||
| 3711 | calc_sectors(conf, mddev->dev_sectors); | 3710 | calc_sectors(conf, mddev->dev_sectors); |
| @@ -3733,6 +3732,7 @@ static struct r10conf *setup_conf(struct mddev *mddev) | |||
| 3733 | init_waitqueue_head(&conf->wait_barrier); | 3732 | init_waitqueue_head(&conf->wait_barrier); |
| 3734 | atomic_set(&conf->nr_pending, 0); | 3733 | atomic_set(&conf->nr_pending, 0); |
| 3735 | 3734 | ||
| 3735 | err = -ENOMEM; | ||
| 3736 | conf->thread = md_register_thread(raid10d, mddev, "raid10"); | 3736 | conf->thread = md_register_thread(raid10d, mddev, "raid10"); |
| 3737 | if (!conf->thread) | 3737 | if (!conf->thread) |
| 3738 | goto out; | 3738 | goto out; |
| @@ -3742,11 +3742,10 @@ static struct r10conf *setup_conf(struct mddev *mddev) | |||
| 3742 | 3742 | ||
| 3743 | out: | 3743 | out: |
| 3744 | if (conf) { | 3744 | if (conf) { |
| 3745 | mempool_destroy(conf->r10bio_pool); | 3745 | mempool_exit(&conf->r10bio_pool); |
| 3746 | kfree(conf->mirrors); | 3746 | kfree(conf->mirrors); |
| 3747 | safe_put_page(conf->tmppage); | 3747 | safe_put_page(conf->tmppage); |
| 3748 | if (conf->bio_split) | 3748 | bioset_exit(&conf->bio_split); |
| 3749 | bioset_free(conf->bio_split); | ||
| 3750 | kfree(conf); | 3749 | kfree(conf); |
| 3751 | } | 3750 | } |
| 3752 | return ERR_PTR(err); | 3751 | return ERR_PTR(err); |
| @@ -3953,7 +3952,7 @@ static int raid10_run(struct mddev *mddev) | |||
| 3953 | 3952 | ||
| 3954 | out_free_conf: | 3953 | out_free_conf: |
| 3955 | md_unregister_thread(&mddev->thread); | 3954 | md_unregister_thread(&mddev->thread); |
| 3956 | mempool_destroy(conf->r10bio_pool); | 3955 | mempool_exit(&conf->r10bio_pool); |
| 3957 | safe_put_page(conf->tmppage); | 3956 | safe_put_page(conf->tmppage); |
| 3958 | kfree(conf->mirrors); | 3957 | kfree(conf->mirrors); |
| 3959 | kfree(conf); | 3958 | kfree(conf); |
| @@ -3966,13 +3965,12 @@ static void raid10_free(struct mddev *mddev, void *priv) | |||
| 3966 | { | 3965 | { |
| 3967 | struct r10conf *conf = priv; | 3966 | struct r10conf *conf = priv; |
| 3968 | 3967 | ||
| 3969 | mempool_destroy(conf->r10bio_pool); | 3968 | mempool_exit(&conf->r10bio_pool); |
| 3970 | safe_put_page(conf->tmppage); | 3969 | safe_put_page(conf->tmppage); |
| 3971 | kfree(conf->mirrors); | 3970 | kfree(conf->mirrors); |
| 3972 | kfree(conf->mirrors_old); | 3971 | kfree(conf->mirrors_old); |
| 3973 | kfree(conf->mirrors_new); | 3972 | kfree(conf->mirrors_new); |
| 3974 | if (conf->bio_split) | 3973 | bioset_exit(&conf->bio_split); |
| 3975 | bioset_free(conf->bio_split); | ||
| 3976 | kfree(conf); | 3974 | kfree(conf); |
| 3977 | } | 3975 | } |
| 3978 | 3976 | ||
| @@ -4543,7 +4541,7 @@ read_more: | |||
| 4543 | * on all the target devices. | 4541 | * on all the target devices. |
| 4544 | */ | 4542 | */ |
| 4545 | // FIXME | 4543 | // FIXME |
| 4546 | mempool_free(r10_bio, conf->r10buf_pool); | 4544 | mempool_free(r10_bio, &conf->r10buf_pool); |
| 4547 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 4545 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
| 4548 | return sectors_done; | 4546 | return sectors_done; |
| 4549 | } | 4547 | } |
diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h index e2e8840de9bf..d3eaaf3eb1bc 100644 --- a/drivers/md/raid10.h +++ b/drivers/md/raid10.h | |||
| @@ -93,10 +93,10 @@ struct r10conf { | |||
| 93 | */ | 93 | */ |
| 94 | wait_queue_head_t wait_barrier; | 94 | wait_queue_head_t wait_barrier; |
| 95 | 95 | ||
| 96 | mempool_t *r10bio_pool; | 96 | mempool_t r10bio_pool; |
| 97 | mempool_t *r10buf_pool; | 97 | mempool_t r10buf_pool; |
| 98 | struct page *tmppage; | 98 | struct page *tmppage; |
| 99 | struct bio_set *bio_split; | 99 | struct bio_set bio_split; |
| 100 | 100 | ||
| 101 | /* When taking over an array from a different personality, we store | 101 | /* When taking over an array from a different personality, we store |
| 102 | * the new thread here until we fully activate the array. | 102 | * the new thread here until we fully activate the array. |
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 3c65f52b68f5..2b775abf377b 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c | |||
| @@ -125,9 +125,9 @@ struct r5l_log { | |||
| 125 | struct list_head no_mem_stripes; /* pending stripes, -ENOMEM */ | 125 | struct list_head no_mem_stripes; /* pending stripes, -ENOMEM */ |
| 126 | 126 | ||
| 127 | struct kmem_cache *io_kc; | 127 | struct kmem_cache *io_kc; |
| 128 | mempool_t *io_pool; | 128 | mempool_t io_pool; |
| 129 | struct bio_set *bs; | 129 | struct bio_set bs; |
| 130 | mempool_t *meta_pool; | 130 | mempool_t meta_pool; |
| 131 | 131 | ||
| 132 | struct md_thread *reclaim_thread; | 132 | struct md_thread *reclaim_thread; |
| 133 | unsigned long reclaim_target; /* number of space that need to be | 133 | unsigned long reclaim_target; /* number of space that need to be |
| @@ -579,7 +579,7 @@ static void r5l_log_endio(struct bio *bio) | |||
| 579 | md_error(log->rdev->mddev, log->rdev); | 579 | md_error(log->rdev->mddev, log->rdev); |
| 580 | 580 | ||
| 581 | bio_put(bio); | 581 | bio_put(bio); |
| 582 | mempool_free(io->meta_page, log->meta_pool); | 582 | mempool_free(io->meta_page, &log->meta_pool); |
| 583 | 583 | ||
| 584 | spin_lock_irqsave(&log->io_list_lock, flags); | 584 | spin_lock_irqsave(&log->io_list_lock, flags); |
| 585 | __r5l_set_io_unit_state(io, IO_UNIT_IO_END); | 585 | __r5l_set_io_unit_state(io, IO_UNIT_IO_END); |
| @@ -748,7 +748,7 @@ static void r5l_submit_current_io(struct r5l_log *log) | |||
| 748 | 748 | ||
| 749 | static struct bio *r5l_bio_alloc(struct r5l_log *log) | 749 | static struct bio *r5l_bio_alloc(struct r5l_log *log) |
| 750 | { | 750 | { |
| 751 | struct bio *bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_PAGES, log->bs); | 751 | struct bio *bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_PAGES, &log->bs); |
| 752 | 752 | ||
| 753 | bio_set_op_attrs(bio, REQ_OP_WRITE, 0); | 753 | bio_set_op_attrs(bio, REQ_OP_WRITE, 0); |
| 754 | bio_set_dev(bio, log->rdev->bdev); | 754 | bio_set_dev(bio, log->rdev->bdev); |
| @@ -780,7 +780,7 @@ static struct r5l_io_unit *r5l_new_meta(struct r5l_log *log) | |||
| 780 | struct r5l_io_unit *io; | 780 | struct r5l_io_unit *io; |
| 781 | struct r5l_meta_block *block; | 781 | struct r5l_meta_block *block; |
| 782 | 782 | ||
| 783 | io = mempool_alloc(log->io_pool, GFP_ATOMIC); | 783 | io = mempool_alloc(&log->io_pool, GFP_ATOMIC); |
| 784 | if (!io) | 784 | if (!io) |
| 785 | return NULL; | 785 | return NULL; |
| 786 | memset(io, 0, sizeof(*io)); | 786 | memset(io, 0, sizeof(*io)); |
| @@ -791,7 +791,7 @@ static struct r5l_io_unit *r5l_new_meta(struct r5l_log *log) | |||
| 791 | bio_list_init(&io->flush_barriers); | 791 | bio_list_init(&io->flush_barriers); |
| 792 | io->state = IO_UNIT_RUNNING; | 792 | io->state = IO_UNIT_RUNNING; |
| 793 | 793 | ||
| 794 | io->meta_page = mempool_alloc(log->meta_pool, GFP_NOIO); | 794 | io->meta_page = mempool_alloc(&log->meta_pool, GFP_NOIO); |
| 795 | block = page_address(io->meta_page); | 795 | block = page_address(io->meta_page); |
| 796 | clear_page(block); | 796 | clear_page(block); |
| 797 | block->magic = cpu_to_le32(R5LOG_MAGIC); | 797 | block->magic = cpu_to_le32(R5LOG_MAGIC); |
| @@ -1223,7 +1223,7 @@ static bool r5l_complete_finished_ios(struct r5l_log *log) | |||
| 1223 | log->next_checkpoint = io->log_start; | 1223 | log->next_checkpoint = io->log_start; |
| 1224 | 1224 | ||
| 1225 | list_del(&io->log_sibling); | 1225 | list_del(&io->log_sibling); |
| 1226 | mempool_free(io, log->io_pool); | 1226 | mempool_free(io, &log->io_pool); |
| 1227 | r5l_run_no_mem_stripe(log); | 1227 | r5l_run_no_mem_stripe(log); |
| 1228 | 1228 | ||
| 1229 | found = true; | 1229 | found = true; |
| @@ -1647,7 +1647,7 @@ static int r5l_recovery_allocate_ra_pool(struct r5l_log *log, | |||
| 1647 | { | 1647 | { |
| 1648 | struct page *page; | 1648 | struct page *page; |
| 1649 | 1649 | ||
| 1650 | ctx->ra_bio = bio_alloc_bioset(GFP_KERNEL, BIO_MAX_PAGES, log->bs); | 1650 | ctx->ra_bio = bio_alloc_bioset(GFP_KERNEL, BIO_MAX_PAGES, &log->bs); |
| 1651 | if (!ctx->ra_bio) | 1651 | if (!ctx->ra_bio) |
| 1652 | return -ENOMEM; | 1652 | return -ENOMEM; |
| 1653 | 1653 | ||
| @@ -3066,6 +3066,7 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev) | |||
| 3066 | struct request_queue *q = bdev_get_queue(rdev->bdev); | 3066 | struct request_queue *q = bdev_get_queue(rdev->bdev); |
| 3067 | struct r5l_log *log; | 3067 | struct r5l_log *log; |
| 3068 | char b[BDEVNAME_SIZE]; | 3068 | char b[BDEVNAME_SIZE]; |
| 3069 | int ret; | ||
| 3069 | 3070 | ||
| 3070 | pr_debug("md/raid:%s: using device %s as journal\n", | 3071 | pr_debug("md/raid:%s: using device %s as journal\n", |
| 3071 | mdname(conf->mddev), bdevname(rdev->bdev, b)); | 3072 | mdname(conf->mddev), bdevname(rdev->bdev, b)); |
| @@ -3111,16 +3112,16 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev) | |||
| 3111 | if (!log->io_kc) | 3112 | if (!log->io_kc) |
| 3112 | goto io_kc; | 3113 | goto io_kc; |
| 3113 | 3114 | ||
| 3114 | log->io_pool = mempool_create_slab_pool(R5L_POOL_SIZE, log->io_kc); | 3115 | ret = mempool_init_slab_pool(&log->io_pool, R5L_POOL_SIZE, log->io_kc); |
| 3115 | if (!log->io_pool) | 3116 | if (ret) |
| 3116 | goto io_pool; | 3117 | goto io_pool; |
| 3117 | 3118 | ||
| 3118 | log->bs = bioset_create(R5L_POOL_SIZE, 0, BIOSET_NEED_BVECS); | 3119 | ret = bioset_init(&log->bs, R5L_POOL_SIZE, 0, BIOSET_NEED_BVECS); |
| 3119 | if (!log->bs) | 3120 | if (ret) |
| 3120 | goto io_bs; | 3121 | goto io_bs; |
| 3121 | 3122 | ||
| 3122 | log->meta_pool = mempool_create_page_pool(R5L_POOL_SIZE, 0); | 3123 | ret = mempool_init_page_pool(&log->meta_pool, R5L_POOL_SIZE, 0); |
| 3123 | if (!log->meta_pool) | 3124 | if (ret) |
| 3124 | goto out_mempool; | 3125 | goto out_mempool; |
| 3125 | 3126 | ||
| 3126 | spin_lock_init(&log->tree_lock); | 3127 | spin_lock_init(&log->tree_lock); |
| @@ -3155,11 +3156,11 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev) | |||
| 3155 | rcu_assign_pointer(conf->log, NULL); | 3156 | rcu_assign_pointer(conf->log, NULL); |
| 3156 | md_unregister_thread(&log->reclaim_thread); | 3157 | md_unregister_thread(&log->reclaim_thread); |
| 3157 | reclaim_thread: | 3158 | reclaim_thread: |
| 3158 | mempool_destroy(log->meta_pool); | 3159 | mempool_exit(&log->meta_pool); |
| 3159 | out_mempool: | 3160 | out_mempool: |
| 3160 | bioset_free(log->bs); | 3161 | bioset_exit(&log->bs); |
| 3161 | io_bs: | 3162 | io_bs: |
| 3162 | mempool_destroy(log->io_pool); | 3163 | mempool_exit(&log->io_pool); |
| 3163 | io_pool: | 3164 | io_pool: |
| 3164 | kmem_cache_destroy(log->io_kc); | 3165 | kmem_cache_destroy(log->io_kc); |
| 3165 | io_kc: | 3166 | io_kc: |
| @@ -3178,9 +3179,9 @@ void r5l_exit_log(struct r5conf *conf) | |||
| 3178 | wake_up(&conf->mddev->sb_wait); | 3179 | wake_up(&conf->mddev->sb_wait); |
| 3179 | flush_work(&log->disable_writeback_work); | 3180 | flush_work(&log->disable_writeback_work); |
| 3180 | md_unregister_thread(&log->reclaim_thread); | 3181 | md_unregister_thread(&log->reclaim_thread); |
| 3181 | mempool_destroy(log->meta_pool); | 3182 | mempool_exit(&log->meta_pool); |
| 3182 | bioset_free(log->bs); | 3183 | bioset_exit(&log->bs); |
| 3183 | mempool_destroy(log->io_pool); | 3184 | mempool_exit(&log->io_pool); |
| 3184 | kmem_cache_destroy(log->io_kc); | 3185 | kmem_cache_destroy(log->io_kc); |
| 3185 | kfree(log); | 3186 | kfree(log); |
| 3186 | } | 3187 | } |
diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c index 42890a08375b..3a7c36326589 100644 --- a/drivers/md/raid5-ppl.c +++ b/drivers/md/raid5-ppl.c | |||
| @@ -105,9 +105,9 @@ struct ppl_conf { | |||
| 105 | atomic64_t seq; /* current log write sequence number */ | 105 | atomic64_t seq; /* current log write sequence number */ |
| 106 | 106 | ||
| 107 | struct kmem_cache *io_kc; | 107 | struct kmem_cache *io_kc; |
| 108 | mempool_t *io_pool; | 108 | mempool_t io_pool; |
| 109 | struct bio_set *bs; | 109 | struct bio_set bs; |
| 110 | struct bio_set *flush_bs; | 110 | struct bio_set flush_bs; |
| 111 | 111 | ||
| 112 | /* used only for recovery */ | 112 | /* used only for recovery */ |
| 113 | int recovered_entries; | 113 | int recovered_entries; |
| @@ -244,7 +244,7 @@ static struct ppl_io_unit *ppl_new_iounit(struct ppl_log *log, | |||
| 244 | struct ppl_header *pplhdr; | 244 | struct ppl_header *pplhdr; |
| 245 | struct page *header_page; | 245 | struct page *header_page; |
| 246 | 246 | ||
| 247 | io = mempool_alloc(ppl_conf->io_pool, GFP_NOWAIT); | 247 | io = mempool_alloc(&ppl_conf->io_pool, GFP_NOWAIT); |
| 248 | if (!io) | 248 | if (!io) |
| 249 | return NULL; | 249 | return NULL; |
| 250 | 250 | ||
| @@ -503,7 +503,7 @@ static void ppl_submit_iounit(struct ppl_io_unit *io) | |||
| 503 | struct bio *prev = bio; | 503 | struct bio *prev = bio; |
| 504 | 504 | ||
| 505 | bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_PAGES, | 505 | bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_PAGES, |
| 506 | ppl_conf->bs); | 506 | &ppl_conf->bs); |
| 507 | bio->bi_opf = prev->bi_opf; | 507 | bio->bi_opf = prev->bi_opf; |
| 508 | bio_copy_dev(bio, prev); | 508 | bio_copy_dev(bio, prev); |
| 509 | bio->bi_iter.bi_sector = bio_end_sector(prev); | 509 | bio->bi_iter.bi_sector = bio_end_sector(prev); |
| @@ -570,7 +570,7 @@ static void ppl_io_unit_finished(struct ppl_io_unit *io) | |||
| 570 | list_del(&io->log_sibling); | 570 | list_del(&io->log_sibling); |
| 571 | spin_unlock(&log->io_list_lock); | 571 | spin_unlock(&log->io_list_lock); |
| 572 | 572 | ||
| 573 | mempool_free(io, ppl_conf->io_pool); | 573 | mempool_free(io, &ppl_conf->io_pool); |
| 574 | 574 | ||
| 575 | spin_lock(&ppl_conf->no_mem_stripes_lock); | 575 | spin_lock(&ppl_conf->no_mem_stripes_lock); |
| 576 | if (!list_empty(&ppl_conf->no_mem_stripes)) { | 576 | if (!list_empty(&ppl_conf->no_mem_stripes)) { |
| @@ -642,7 +642,7 @@ static void ppl_do_flush(struct ppl_io_unit *io) | |||
| 642 | struct bio *bio; | 642 | struct bio *bio; |
| 643 | char b[BDEVNAME_SIZE]; | 643 | char b[BDEVNAME_SIZE]; |
| 644 | 644 | ||
| 645 | bio = bio_alloc_bioset(GFP_NOIO, 0, ppl_conf->flush_bs); | 645 | bio = bio_alloc_bioset(GFP_NOIO, 0, &ppl_conf->flush_bs); |
| 646 | bio_set_dev(bio, bdev); | 646 | bio_set_dev(bio, bdev); |
| 647 | bio->bi_private = io; | 647 | bio->bi_private = io; |
| 648 | bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH; | 648 | bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH; |
| @@ -1246,11 +1246,9 @@ static void __ppl_exit_log(struct ppl_conf *ppl_conf) | |||
| 1246 | 1246 | ||
| 1247 | kfree(ppl_conf->child_logs); | 1247 | kfree(ppl_conf->child_logs); |
| 1248 | 1248 | ||
| 1249 | if (ppl_conf->bs) | 1249 | bioset_exit(&ppl_conf->bs); |
| 1250 | bioset_free(ppl_conf->bs); | 1250 | bioset_exit(&ppl_conf->flush_bs); |
| 1251 | if (ppl_conf->flush_bs) | 1251 | mempool_exit(&ppl_conf->io_pool); |
| 1252 | bioset_free(ppl_conf->flush_bs); | ||
| 1253 | mempool_destroy(ppl_conf->io_pool); | ||
| 1254 | kmem_cache_destroy(ppl_conf->io_kc); | 1252 | kmem_cache_destroy(ppl_conf->io_kc); |
| 1255 | 1253 | ||
| 1256 | kfree(ppl_conf); | 1254 | kfree(ppl_conf); |
| @@ -1387,24 +1385,18 @@ int ppl_init_log(struct r5conf *conf) | |||
| 1387 | goto err; | 1385 | goto err; |
| 1388 | } | 1386 | } |
| 1389 | 1387 | ||
| 1390 | ppl_conf->io_pool = mempool_create(conf->raid_disks, ppl_io_pool_alloc, | 1388 | ret = mempool_init(&ppl_conf->io_pool, conf->raid_disks, ppl_io_pool_alloc, |
| 1391 | ppl_io_pool_free, ppl_conf->io_kc); | 1389 | ppl_io_pool_free, ppl_conf->io_kc); |
| 1392 | if (!ppl_conf->io_pool) { | 1390 | if (ret) |
| 1393 | ret = -ENOMEM; | ||
| 1394 | goto err; | 1391 | goto err; |
| 1395 | } | ||
| 1396 | 1392 | ||
| 1397 | ppl_conf->bs = bioset_create(conf->raid_disks, 0, BIOSET_NEED_BVECS); | 1393 | ret = bioset_init(&ppl_conf->bs, conf->raid_disks, 0, BIOSET_NEED_BVECS); |
| 1398 | if (!ppl_conf->bs) { | 1394 | if (ret) |
| 1399 | ret = -ENOMEM; | ||
| 1400 | goto err; | 1395 | goto err; |
| 1401 | } | ||
| 1402 | 1396 | ||
| 1403 | ppl_conf->flush_bs = bioset_create(conf->raid_disks, 0, 0); | 1397 | ret = bioset_init(&ppl_conf->flush_bs, conf->raid_disks, 0, 0); |
| 1404 | if (!ppl_conf->flush_bs) { | 1398 | if (ret) |
| 1405 | ret = -ENOMEM; | ||
| 1406 | goto err; | 1399 | goto err; |
| 1407 | } | ||
| 1408 | 1400 | ||
| 1409 | ppl_conf->count = conf->raid_disks; | 1401 | ppl_conf->count = conf->raid_disks; |
| 1410 | ppl_conf->child_logs = kcalloc(ppl_conf->count, sizeof(struct ppl_log), | 1402 | ppl_conf->child_logs = kcalloc(ppl_conf->count, sizeof(struct ppl_log), |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index be117d0a65a8..a2e64989b01f 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -5192,7 +5192,7 @@ static int raid5_read_one_chunk(struct mddev *mddev, struct bio *raid_bio) | |||
| 5192 | /* | 5192 | /* |
| 5193 | * use bio_clone_fast to make a copy of the bio | 5193 | * use bio_clone_fast to make a copy of the bio |
| 5194 | */ | 5194 | */ |
| 5195 | align_bi = bio_clone_fast(raid_bio, GFP_NOIO, mddev->bio_set); | 5195 | align_bi = bio_clone_fast(raid_bio, GFP_NOIO, &mddev->bio_set); |
| 5196 | if (!align_bi) | 5196 | if (!align_bi) |
| 5197 | return 0; | 5197 | return 0; |
| 5198 | /* | 5198 | /* |
| @@ -5277,7 +5277,7 @@ static struct bio *chunk_aligned_read(struct mddev *mddev, struct bio *raid_bio) | |||
| 5277 | 5277 | ||
| 5278 | if (sectors < bio_sectors(raid_bio)) { | 5278 | if (sectors < bio_sectors(raid_bio)) { |
| 5279 | struct r5conf *conf = mddev->private; | 5279 | struct r5conf *conf = mddev->private; |
| 5280 | split = bio_split(raid_bio, sectors, GFP_NOIO, conf->bio_split); | 5280 | split = bio_split(raid_bio, sectors, GFP_NOIO, &conf->bio_split); |
| 5281 | bio_chain(split, raid_bio); | 5281 | bio_chain(split, raid_bio); |
| 5282 | generic_make_request(raid_bio); | 5282 | generic_make_request(raid_bio); |
| 5283 | raid_bio = split; | 5283 | raid_bio = split; |
| @@ -6773,8 +6773,7 @@ static void free_conf(struct r5conf *conf) | |||
| 6773 | if (conf->disks[i].extra_page) | 6773 | if (conf->disks[i].extra_page) |
| 6774 | put_page(conf->disks[i].extra_page); | 6774 | put_page(conf->disks[i].extra_page); |
| 6775 | kfree(conf->disks); | 6775 | kfree(conf->disks); |
| 6776 | if (conf->bio_split) | 6776 | bioset_exit(&conf->bio_split); |
| 6777 | bioset_free(conf->bio_split); | ||
| 6778 | kfree(conf->stripe_hashtbl); | 6777 | kfree(conf->stripe_hashtbl); |
| 6779 | kfree(conf->pending_data); | 6778 | kfree(conf->pending_data); |
| 6780 | kfree(conf); | 6779 | kfree(conf); |
| @@ -6853,6 +6852,7 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
| 6853 | int i; | 6852 | int i; |
| 6854 | int group_cnt, worker_cnt_per_group; | 6853 | int group_cnt, worker_cnt_per_group; |
| 6855 | struct r5worker_group *new_group; | 6854 | struct r5worker_group *new_group; |
| 6855 | int ret; | ||
| 6856 | 6856 | ||
| 6857 | if (mddev->new_level != 5 | 6857 | if (mddev->new_level != 5 |
| 6858 | && mddev->new_level != 4 | 6858 | && mddev->new_level != 4 |
| @@ -6950,8 +6950,8 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
| 6950 | goto abort; | 6950 | goto abort; |
| 6951 | } | 6951 | } |
| 6952 | 6952 | ||
| 6953 | conf->bio_split = bioset_create(BIO_POOL_SIZE, 0, 0); | 6953 | ret = bioset_init(&conf->bio_split, BIO_POOL_SIZE, 0, 0); |
| 6954 | if (!conf->bio_split) | 6954 | if (ret) |
| 6955 | goto abort; | 6955 | goto abort; |
| 6956 | conf->mddev = mddev; | 6956 | conf->mddev = mddev; |
| 6957 | 6957 | ||
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 3f8da26032ac..72e75ba6abf0 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
| @@ -669,7 +669,7 @@ struct r5conf { | |||
| 669 | int pool_size; /* number of disks in stripeheads in pool */ | 669 | int pool_size; /* number of disks in stripeheads in pool */ |
| 670 | spinlock_t device_lock; | 670 | spinlock_t device_lock; |
| 671 | struct disk_info *disks; | 671 | struct disk_info *disks; |
| 672 | struct bio_set *bio_split; | 672 | struct bio_set bio_split; |
| 673 | 673 | ||
| 674 | /* When taking over an array from a different personality, we store | 674 | /* When taking over an array from a different personality, we store |
| 675 | * the new thread here until we fully activate the array. | 675 | * the new thread here until we fully activate the array. |
