kfree(l_mg->vsc_list);
for (i = 0; i < PBLK_DATA_LINES; i++) {
- pblk_mfree(&l_mg->sline_meta[i], l_mg->smeta_alloc_type);
+ kfree(l_mg->sline_meta[i]);
pblk_mfree(l_mg->eline_meta[i]->buf, l_mg->emeta_alloc_type);
- kfree(&l_mg->eline_meta[i]);
+ kfree(l_mg->eline_meta[i]);
}
kfree(pblk->lines);
/* smeta is always small enough to fit on a kmalloc memory allocation,
* emeta depends on the number of LUNs allocated to the pblk instance
*/
- l_mg->smeta_alloc_type = PBLK_KMALLOC_META;
for (i = 0; i < PBLK_DATA_LINES; i++) {
l_mg->sline_meta[i] = kmalloc(lm->smeta_len, GFP_KERNEL);
if (!l_mg->sline_meta[i])
fail_free_emeta:
while (--i >= 0) {
vfree(l_mg->eline_meta[i]->buf);
- kfree(&l_mg->eline_meta[i]);
+ kfree(l_mg->eline_meta[i]);
}
fail_free_smeta:
for (i = 0; i < PBLK_DATA_LINES; i++)
- pblk_mfree(&l_mg->sline_meta[i], l_mg->smeta_alloc_type);
+ kfree(l_mg->sline_meta[i]);
return -ENOMEM;
}
list_add(&meta_line->list, &meta_line->list);
spin_unlock(&l_mg->close_lock);
fail_free_bio:
- bio_put(bio);
+ if (likely(l_mg->emeta_alloc_type == PBLK_VMALLOC_META))
+ bio_put(bio);
fail_free_rqd:
pblk_free_rqd(pblk, rqd, READ);
return ret;
__le32 *vsc_list; /* Valid sector counts for all lines */
/* Metadata allocation type: VMALLOC | KMALLOC */
- int smeta_alloc_type;
int emeta_alloc_type;
/* Pre-allocated metadata for data lines */