diff options
author | Javier González <jg@lightnvm.io> | 2017-06-26 11:57:21 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-06-26 16:27:39 -0600 |
commit | f680f19aa6dbbbabf499250d49f18a426b14f1c2 (patch) | |
tree | 78dbe23eb94ec0680ed1f5ece1bec7916d124a23 /drivers/lightnvm/pblk-init.c | |
parent | f9c101523da75cd483b95f04c21242bb83960d93 (diff) | |
download | lwn-f680f19aa6dbbbabf499250d49f18a426b14f1c2.tar.gz lwn-f680f19aa6dbbbabf499250d49f18a426b14f1c2.zip |
lightnvm: pblk: simplify meta. memory allocation
smeta size will always be suitable for a kmalloc allocation. Simplify
the code and leave the vmalloc fallback only for emeta, where the pblk
configuration has an impact.
Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm/pblk-init.c')
-rw-r--r-- | drivers/lightnvm/pblk-init.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index cd10f2d74cf9..a9115ff9555f 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -355,9 +355,9 @@ static void pblk_line_meta_free(struct pblk *pblk) 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); @@ -550,7 +550,6 @@ static int pblk_lines_alloc_metadata(struct pblk *pblk) /* 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]) @@ -604,12 +603,12 @@ static int pblk_lines_alloc_metadata(struct pblk *pblk) 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; } |