mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 10:00:51 +07:00
lightnvm: allow to force mm initialization
System block allows the device to initialize with its configured media manager. The system blocks is written to disk, and read again when media manager is determined. For this to work, the backend must store the data. Device drivers, such as null_blk, does not have any backend storage. This patch allows the media manager to be initialized without a storage backend. It also fix incorrect configuration of capabilities in null_blk, as it does not support get/set bad block interface. Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
6dde1d6c90
commit
bf64318564
@ -478,7 +478,7 @@ static int null_lnvm_id(struct nvm_dev *dev, struct nvm_id *id)
|
||||
id->ver_id = 0x1;
|
||||
id->vmnt = 0;
|
||||
id->cgrps = 1;
|
||||
id->cap = 0x3;
|
||||
id->cap = 0x2;
|
||||
id->dom = 0x1;
|
||||
|
||||
id->ppaf.blk_offset = 0;
|
||||
|
@ -572,11 +572,13 @@ int nvm_register(struct request_queue *q, char *disk_name,
|
||||
}
|
||||
}
|
||||
|
||||
ret = nvm_get_sysblock(dev, &dev->sb);
|
||||
if (!ret)
|
||||
pr_err("nvm: device not initialized.\n");
|
||||
else if (ret < 0)
|
||||
pr_err("nvm: err (%d) on device initialization\n", ret);
|
||||
if (dev->identity.cap & NVM_ID_DCAP_BBLKMGMT) {
|
||||
ret = nvm_get_sysblock(dev, &dev->sb);
|
||||
if (!ret)
|
||||
pr_err("nvm: device not initialized.\n");
|
||||
else if (ret < 0)
|
||||
pr_err("nvm: err (%d) on device initialization\n", ret);
|
||||
}
|
||||
|
||||
/* register device with a supported media manager */
|
||||
down_write(&nvm_lock);
|
||||
@ -1055,9 +1057,11 @@ static long __nvm_ioctl_dev_init(struct nvm_ioctl_dev_init *init)
|
||||
strncpy(info.mmtype, init->mmtype, NVM_MMTYPE_LEN);
|
||||
info.fs_ppa.ppa = -1;
|
||||
|
||||
ret = nvm_init_sysblock(dev, &info);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (dev->identity.cap & NVM_ID_DCAP_BBLKMGMT) {
|
||||
ret = nvm_init_sysblock(dev, &info);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
memcpy(&dev->sb, &info, sizeof(struct nvm_sb_info));
|
||||
|
||||
@ -1117,7 +1121,10 @@ static long nvm_ioctl_dev_factory(struct file *file, void __user *arg)
|
||||
dev->mt = NULL;
|
||||
}
|
||||
|
||||
return nvm_dev_factory(dev, fact.flags);
|
||||
if (dev->identity.cap & NVM_ID_DCAP_BBLKMGMT)
|
||||
return nvm_dev_factory(dev, fact.flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long nvm_ctl_ioctl(struct file *file, uint cmd, unsigned long arg)
|
||||
|
@ -135,6 +135,10 @@ enum {
|
||||
/* Memory types */
|
||||
NVM_ID_FMTYPE_SLC = 0,
|
||||
NVM_ID_FMTYPE_MLC = 1,
|
||||
|
||||
/* Device capabilities */
|
||||
NVM_ID_DCAP_BBLKMGMT = 0x1,
|
||||
NVM_UD_DCAP_ECC = 0x2,
|
||||
};
|
||||
|
||||
struct nvm_id_lp_mlc {
|
||||
|
Loading…
Reference in New Issue
Block a user