Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Marcos Paulo de Souza and committed by
Jens Axboe
c7afa803 8cf05a78

+12 -17
+5
drivers/md/raid1-10.c
··· 34 34 struct page *pages[RESYNC_PAGES]; 35 35 }; 36 36 37 + static void rbio_pool_free(void *rbio, void *data) 38 + { 39 + kfree(rbio); 40 + } 41 + 37 42 static inline int resync_alloc_pages(struct resync_pages *rp, 38 43 gfp_t gfp_flags) 39 44 {
+4 -9
drivers/md/raid1.c
··· 68 68 return kzalloc(size, gfp_flags); 69 69 } 70 70 71 - static void r1bio_pool_free(void *r1_bio, void *data) 72 - { 73 - kfree(r1_bio); 74 - } 75 - 76 71 #define RESYNC_DEPTH 32 77 72 #define RESYNC_SECTORS (RESYNC_BLOCK_SIZE >> 9) 78 73 #define RESYNC_WINDOW (RESYNC_BLOCK_SIZE * RESYNC_DEPTH) ··· 143 148 kfree(rps); 144 149 145 150 out_free_r1bio: 146 - r1bio_pool_free(r1_bio, data); 151 + rbio_pool_free(r1_bio, data); 147 152 return NULL; 148 153 } 149 154 ··· 163 168 /* resync pages array stored in the 1st bio's .bi_private */ 164 169 kfree(rp); 165 170 166 - r1bio_pool_free(r1bio, data); 171 + rbio_pool_free(r1bio, data); 167 172 } 168 173 169 174 static void put_all_bios(struct r1conf *conf, struct r1bio *r1_bio) ··· 2915 2920 goto abort; 2916 2921 conf->poolinfo->raid_disks = mddev->raid_disks * 2; 2917 2922 err = mempool_init(&conf->r1bio_pool, NR_RAID_BIOS, r1bio_pool_alloc, 2918 - r1bio_pool_free, conf->poolinfo); 2923 + rbio_pool_free, conf->poolinfo); 2919 2924 if (err) 2920 2925 goto abort; 2921 2926 ··· 3200 3205 newpoolinfo->raid_disks = raid_disks * 2; 3201 3206 3202 3207 ret = mempool_init(&newpool, NR_RAID_BIOS, r1bio_pool_alloc, 3203 - r1bio_pool_free, newpoolinfo); 3208 + rbio_pool_free, newpoolinfo); 3204 3209 if (ret) { 3205 3210 kfree(newpoolinfo); 3206 3211 return ret;
+3 -8
drivers/md/raid10.c
··· 98 98 return kzalloc(size, gfp_flags); 99 99 } 100 100 101 - static void r10bio_pool_free(void *r10_bio, void *data) 102 - { 103 - kfree(r10_bio); 104 - } 105 - 106 101 #define RESYNC_SECTORS (RESYNC_BLOCK_SIZE >> 9) 107 102 /* amount of memory to reserve for resync requests */ 108 103 #define RESYNC_WINDOW (1024*1024) ··· 203 208 } 204 209 kfree(rps); 205 210 out_free_r10bio: 206 - r10bio_pool_free(r10_bio, conf); 211 + rbio_pool_free(r10_bio, conf); 207 212 return NULL; 208 213 } 209 214 ··· 231 236 /* resync pages array stored in the 1st bio's .bi_private */ 232 237 kfree(rp); 233 238 234 - r10bio_pool_free(r10bio, conf); 239 + rbio_pool_free(r10bio, conf); 235 240 } 236 241 237 242 static void put_all_bios(struct r10conf *conf, struct r10bio *r10_bio) ··· 3646 3651 conf->geo = geo; 3647 3652 conf->copies = copies; 3648 3653 err = mempool_init(&conf->r10bio_pool, NR_RAID_BIOS, r10bio_pool_alloc, 3649 - r10bio_pool_free, conf); 3654 + rbio_pool_free, conf); 3650 3655 if (err) 3651 3656 goto out; 3652 3657