Commit 43db059e authored by Minwoo Im's avatar Minwoo Im Committed by Jens Axboe

lightnvm: introduce pr_fmt for the prefix nvm

all the pr_() family can have this prefix by pr_fmt.
Signed-off-by: default avatarMinwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: default avatarJavier González <javier@javigon.com>
Signed-off-by: default avatarMatias Bjørling <mb@lightnvm.io>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 03754ea3
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* Initial release: Matias Bjorling <m@bjorling.me> * Initial release: Matias Bjorling <m@bjorling.me>
*/ */
#define pr_fmt(fmt) "nvm: " fmt
#include <linux/list.h> #include <linux/list.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/sem.h> #include <linux/sem.h>
...@@ -74,7 +76,7 @@ static int nvm_reserve_luns(struct nvm_dev *dev, int lun_begin, int lun_end) ...@@ -74,7 +76,7 @@ static int nvm_reserve_luns(struct nvm_dev *dev, int lun_begin, int lun_end)
for (i = lun_begin; i <= lun_end; i++) { for (i = lun_begin; i <= lun_end; i++) {
if (test_and_set_bit(i, dev->lun_map)) { if (test_and_set_bit(i, dev->lun_map)) {
pr_err("nvm: lun %d already allocated\n", i); pr_err("lun %d already allocated\n", i);
goto err; goto err;
} }
} }
...@@ -264,7 +266,7 @@ static int nvm_config_check_luns(struct nvm_geo *geo, int lun_begin, ...@@ -264,7 +266,7 @@ static int nvm_config_check_luns(struct nvm_geo *geo, int lun_begin,
int lun_end) int lun_end)
{ {
if (lun_begin > lun_end || lun_end >= geo->all_luns) { if (lun_begin > lun_end || lun_end >= geo->all_luns) {
pr_err("nvm: lun out of bound (%u:%u > %u)\n", pr_err("lun out of bound (%u:%u > %u)\n",
lun_begin, lun_end, geo->all_luns - 1); lun_begin, lun_end, geo->all_luns - 1);
return -EINVAL; return -EINVAL;
} }
...@@ -297,7 +299,7 @@ static int __nvm_config_extended(struct nvm_dev *dev, ...@@ -297,7 +299,7 @@ static int __nvm_config_extended(struct nvm_dev *dev,
if (e->op == 0xFFFF) { if (e->op == 0xFFFF) {
e->op = NVM_TARGET_DEFAULT_OP; e->op = NVM_TARGET_DEFAULT_OP;
} else if (e->op < NVM_TARGET_MIN_OP || e->op > NVM_TARGET_MAX_OP) { } else if (e->op < NVM_TARGET_MIN_OP || e->op > NVM_TARGET_MAX_OP) {
pr_err("nvm: invalid over provisioning value\n"); pr_err("invalid over provisioning value\n");
return -EINVAL; return -EINVAL;
} }
...@@ -334,23 +336,23 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create) ...@@ -334,23 +336,23 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
e = create->conf.e; e = create->conf.e;
break; break;
default: default:
pr_err("nvm: config type not valid\n"); pr_err("config type not valid\n");
return -EINVAL; return -EINVAL;
} }
tt = nvm_find_target_type(create->tgttype); tt = nvm_find_target_type(create->tgttype);
if (!tt) { if (!tt) {
pr_err("nvm: target type %s not found\n", create->tgttype); pr_err("target type %s not found\n", create->tgttype);
return -EINVAL; return -EINVAL;
} }
if ((tt->flags & NVM_TGT_F_HOST_L2P) != (dev->geo.dom & NVM_RSP_L2P)) { if ((tt->flags & NVM_TGT_F_HOST_L2P) != (dev->geo.dom & NVM_RSP_L2P)) {
pr_err("nvm: device is incompatible with target L2P type.\n"); pr_err("device is incompatible with target L2P type.\n");
return -EINVAL; return -EINVAL;
} }
if (nvm_target_exists(create->tgtname)) { if (nvm_target_exists(create->tgtname)) {
pr_err("nvm: target name already exists (%s)\n", pr_err("target name already exists (%s)\n",
create->tgtname); create->tgtname);
return -EINVAL; return -EINVAL;
} }
...@@ -367,7 +369,7 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create) ...@@ -367,7 +369,7 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
tgt_dev = nvm_create_tgt_dev(dev, e.lun_begin, e.lun_end, e.op); tgt_dev = nvm_create_tgt_dev(dev, e.lun_begin, e.lun_end, e.op);
if (!tgt_dev) { if (!tgt_dev) {
pr_err("nvm: could not create target device\n"); pr_err("could not create target device\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_t; goto err_t;
} }
...@@ -686,7 +688,7 @@ static int nvm_set_rqd_ppalist(struct nvm_tgt_dev *tgt_dev, struct nvm_rq *rqd, ...@@ -686,7 +688,7 @@ static int nvm_set_rqd_ppalist(struct nvm_tgt_dev *tgt_dev, struct nvm_rq *rqd,
rqd->nr_ppas = nr_ppas; rqd->nr_ppas = nr_ppas;
rqd->ppa_list = nvm_dev_dma_alloc(dev, GFP_KERNEL, &rqd->dma_ppa_list); rqd->ppa_list = nvm_dev_dma_alloc(dev, GFP_KERNEL, &rqd->dma_ppa_list);
if (!rqd->ppa_list) { if (!rqd->ppa_list) {
pr_err("nvm: failed to allocate dma memory\n"); pr_err("failed to allocate dma memory\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -1073,7 +1075,7 @@ int nvm_set_chunk_meta(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *ppas, ...@@ -1073,7 +1075,7 @@ int nvm_set_chunk_meta(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *ppas,
return 0; return 0;
if (nr_ppas > NVM_MAX_VLBA) { if (nr_ppas > NVM_MAX_VLBA) {
pr_err("nvm: unable to update all blocks atomically\n"); pr_err("unable to update all blocks atomically\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1136,27 +1138,26 @@ static int nvm_init(struct nvm_dev *dev) ...@@ -1136,27 +1138,26 @@ static int nvm_init(struct nvm_dev *dev)
int ret = -EINVAL; int ret = -EINVAL;
if (dev->ops->identity(dev)) { if (dev->ops->identity(dev)) {
pr_err("nvm: device could not be identified\n"); pr_err("device could not be identified\n");
goto err; goto err;
} }
pr_debug("nvm: ver:%u.%u nvm_vendor:%x\n", pr_debug("ver:%u.%u nvm_vendor:%x\n", geo->major_ver_id,
geo->major_ver_id, geo->minor_ver_id, geo->minor_ver_id, geo->vmnt);
geo->vmnt);
ret = nvm_core_init(dev); ret = nvm_core_init(dev);
if (ret) { if (ret) {
pr_err("nvm: could not initialize core structures.\n"); pr_err("could not initialize core structures.\n");
goto err; goto err;
} }
pr_info("nvm: registered %s [%u/%u/%u/%u/%u]\n", pr_info("registered %s [%u/%u/%u/%u/%u]\n",
dev->name, dev->geo.ws_min, dev->geo.ws_opt, dev->name, dev->geo.ws_min, dev->geo.ws_opt,
dev->geo.num_chk, dev->geo.all_luns, dev->geo.num_chk, dev->geo.all_luns,
dev->geo.num_ch); dev->geo.num_ch);
return 0; return 0;
err: err:
pr_err("nvm: failed to initialize nvm\n"); pr_err("failed to initialize nvm\n");
return ret; return ret;
} }
...@@ -1194,7 +1195,7 @@ int nvm_register(struct nvm_dev *dev) ...@@ -1194,7 +1195,7 @@ int nvm_register(struct nvm_dev *dev)
dev->dma_pool = dev->ops->create_dma_pool(dev, "ppalist", dev->dma_pool = dev->ops->create_dma_pool(dev, "ppalist",
exp_pool_size); exp_pool_size);
if (!dev->dma_pool) { if (!dev->dma_pool) {
pr_err("nvm: could not create dma pool\n"); pr_err("could not create dma pool\n");
kref_put(&dev->ref, nvm_free); kref_put(&dev->ref, nvm_free);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1239,7 +1240,7 @@ static int __nvm_configure_create(struct nvm_ioctl_create *create) ...@@ -1239,7 +1240,7 @@ static int __nvm_configure_create(struct nvm_ioctl_create *create)
up_write(&nvm_lock); up_write(&nvm_lock);
if (!dev) { if (!dev) {
pr_err("nvm: device not found\n"); pr_err("device not found\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1313,7 +1314,7 @@ static long nvm_ioctl_get_devices(struct file *file, void __user *arg) ...@@ -1313,7 +1314,7 @@ static long nvm_ioctl_get_devices(struct file *file, void __user *arg)
i++; i++;
if (i > 31) { if (i > 31) {
pr_err("nvm: max 31 devices can be reported.\n"); pr_err("max 31 devices can be reported.\n");
break; break;
} }
} }
...@@ -1340,7 +1341,7 @@ static long nvm_ioctl_dev_create(struct file *file, void __user *arg) ...@@ -1340,7 +1341,7 @@ static long nvm_ioctl_dev_create(struct file *file, void __user *arg)
if (create.conf.type == NVM_CONFIG_TYPE_EXTENDED && if (create.conf.type == NVM_CONFIG_TYPE_EXTENDED &&
create.conf.e.rsv != 0) { create.conf.e.rsv != 0) {
pr_err("nvm: reserved config field in use\n"); pr_err("reserved config field in use\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1356,7 +1357,7 @@ static long nvm_ioctl_dev_create(struct file *file, void __user *arg) ...@@ -1356,7 +1357,7 @@ static long nvm_ioctl_dev_create(struct file *file, void __user *arg)
flags &= ~NVM_TARGET_FACTORY; flags &= ~NVM_TARGET_FACTORY;
if (flags) { if (flags) {
pr_err("nvm: flag not supported\n"); pr_err("flag not supported\n");
return -EINVAL; return -EINVAL;
} }
} }
...@@ -1374,7 +1375,7 @@ static long nvm_ioctl_dev_remove(struct file *file, void __user *arg) ...@@ -1374,7 +1375,7 @@ static long nvm_ioctl_dev_remove(struct file *file, void __user *arg)
remove.tgtname[DISK_NAME_LEN - 1] = '\0'; remove.tgtname[DISK_NAME_LEN - 1] = '\0';
if (remove.flags != 0) { if (remove.flags != 0) {
pr_err("nvm: no flags supported\n"); pr_err("no flags supported\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1390,7 +1391,7 @@ static long nvm_ioctl_dev_init(struct file *file, void __user *arg) ...@@ -1390,7 +1391,7 @@ static long nvm_ioctl_dev_init(struct file *file, void __user *arg)
return -EFAULT; return -EFAULT;
if (init.flags != 0) { if (init.flags != 0) {
pr_err("nvm: no flags supported\n"); pr_err("no flags supported\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment