lightnvm: pblk: use kvmalloc for metadata

There is no reason now not to use kvmalloc, so replace the internal
metadata allocation scheme.

Reviewed-by: Javier González <javier@javigon.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Hans Holmberg <hans@owltronix.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Hans Holmberg
2019-07-31 11:41:35 +02:00
committed by Jens Axboe
parent 48e5da7255
commit ff8f352070
4 changed files with 19 additions and 64 deletions

View File

@@ -481,11 +481,6 @@ struct pblk_line {
#define PBLK_DATA_LINES 4
enum {
PBLK_KMALLOC_META = 1,
PBLK_VMALLOC_META = 2,
};
enum {
PBLK_EMETA_TYPE_HEADER = 1, /* struct line_emeta first sector */
PBLK_EMETA_TYPE_LLBA = 2, /* lba list - type: __le64 */
@@ -521,9 +516,6 @@ struct pblk_line_mgmt {
__le32 *vsc_list; /* Valid sector counts for all lines */
/* Metadata allocation type: VMALLOC | KMALLOC */
int emeta_alloc_type;
/* Pre-allocated metadata for data lines */
struct pblk_smeta *sline_meta[PBLK_DATA_LINES];
struct pblk_emeta *eline_meta[PBLK_DATA_LINES];
@@ -934,21 +926,6 @@ void pblk_rl_werr_line_out(struct pblk_rl *rl);
int pblk_sysfs_init(struct gendisk *tdisk);
void pblk_sysfs_exit(struct gendisk *tdisk);
static inline void *pblk_malloc(size_t size, int type, gfp_t flags)
{
if (type == PBLK_KMALLOC_META)
return kmalloc(size, flags);
return vmalloc(size);
}
static inline void pblk_mfree(void *ptr, int type)
{
if (type == PBLK_KMALLOC_META)
kfree(ptr);
else
vfree(ptr);
}
static inline struct nvm_rq *nvm_rq_from_c_ctx(void *c_ctx)
{
return c_ctx - sizeof(struct nvm_rq);