md: raid1-10: Unify r{1,10}bio_pool_free

Avoiding duplicated code, since they just execute a kfree.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Marcos Paulo de Souza 2019-06-14 15:41:10 -07:00 committed by Jens Axboe
parent 8cf05a7841
commit c7afa8034b
3 changed files with 12 additions and 17 deletions

View File

@ -34,6 +34,11 @@ struct resync_pages {
struct page *pages[RESYNC_PAGES];
};
static void rbio_pool_free(void *rbio, void *data)
{
kfree(rbio);
}
static inline int resync_alloc_pages(struct resync_pages *rp,
gfp_t gfp_flags)
{

View File

@ -68,11 +68,6 @@ static void * r1bio_pool_alloc(gfp_t gfp_flags, void *data)
return kzalloc(size, gfp_flags);
}
static void r1bio_pool_free(void *r1_bio, void *data)
{
kfree(r1_bio);
}
#define RESYNC_DEPTH 32
#define RESYNC_SECTORS (RESYNC_BLOCK_SIZE >> 9)
#define RESYNC_WINDOW (RESYNC_BLOCK_SIZE * RESYNC_DEPTH)
@ -148,7 +143,7 @@ out_free_bio:
kfree(rps);
out_free_r1bio:
r1bio_pool_free(r1_bio, data);
rbio_pool_free(r1_bio, data);
return NULL;
}
@ -168,7 +163,7 @@ static void r1buf_pool_free(void *__r1_bio, void *data)
/* resync pages array stored in the 1st bio's .bi_private */
kfree(rp);
r1bio_pool_free(r1bio, data);
rbio_pool_free(r1bio, data);
}
static void put_all_bios(struct r1conf *conf, struct r1bio *r1_bio)
@ -2920,7 +2915,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
goto abort;
conf->poolinfo->raid_disks = mddev->raid_disks * 2;
err = mempool_init(&conf->r1bio_pool, NR_RAID_BIOS, r1bio_pool_alloc,
r1bio_pool_free, conf->poolinfo);
rbio_pool_free, conf->poolinfo);
if (err)
goto abort;
@ -3205,7 +3200,7 @@ static int raid1_reshape(struct mddev *mddev)
newpoolinfo->raid_disks = raid_disks * 2;
ret = mempool_init(&newpool, NR_RAID_BIOS, r1bio_pool_alloc,
r1bio_pool_free, newpoolinfo);
rbio_pool_free, newpoolinfo);
if (ret) {
kfree(newpoolinfo);
return ret;

View File

@ -98,11 +98,6 @@ static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data)
return kzalloc(size, gfp_flags);
}
static void r10bio_pool_free(void *r10_bio, void *data)
{
kfree(r10_bio);
}
#define RESYNC_SECTORS (RESYNC_BLOCK_SIZE >> 9)
/* amount of memory to reserve for resync requests */
#define RESYNC_WINDOW (1024*1024)
@ -208,7 +203,7 @@ out_free_bio:
}
kfree(rps);
out_free_r10bio:
r10bio_pool_free(r10_bio, conf);
rbio_pool_free(r10_bio, conf);
return NULL;
}
@ -236,7 +231,7 @@ static void r10buf_pool_free(void *__r10_bio, void *data)
/* resync pages array stored in the 1st bio's .bi_private */
kfree(rp);
r10bio_pool_free(r10bio, conf);
rbio_pool_free(r10bio, conf);
}
static void put_all_bios(struct r10conf *conf, struct r10bio *r10_bio)
@ -3651,7 +3646,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
conf->geo = geo;
conf->copies = copies;
err = mempool_init(&conf->r10bio_pool, NR_RAID_BIOS, r10bio_pool_alloc,
r10bio_pool_free, conf);
rbio_pool_free, conf);
if (err)
goto out;