diff mbox series

[v2,4/5] lightnvm: Disable interleaved metadata

Message ID 20181022103611.39271-5-igor.j.konopko@intel.com (mailing list archive)
State New, archived
Headers show
Series lightnvm: Flexible metadata | expand

Commit Message

Igor Konopko Oct. 22, 2018, 10:36 a.m. UTC
Currently pblk and lightnvm does only check for size
of OOB metadata and does not care wheather this meta
is located in separate buffer or is interleaved with
data in single buffer.

In reality only the first scenario is supported, where
second mode will break pblk functionality during any
IO operation.

The goal of this patch is to block creation of pblk
devices in case of interleaved metadata

Signed-off-by: Igor Konopko <igor.j.konopko@intel.com>
---
 drivers/lightnvm/pblk-init.c | 6 ++++++
 drivers/nvme/host/lightnvm.c | 1 +
 include/linux/lightnvm.h     | 1 +
 3 files changed, 8 insertions(+)

Comments

Javier Gonzalez Oct. 29, 2018, 12:17 p.m. UTC | #1
> On 22 Oct 2018, at 12.36, Igor Konopko <igor.j.konopko@intel.com> wrote:
> 
> Currently pblk and lightnvm does only check for size
> of OOB metadata and does not care wheather this meta
> is located in separate buffer or is interleaved with
> data in single buffer.
> 
> In reality only the first scenario is supported, where
> second mode will break pblk functionality during any
> IO operation.
> 
> The goal of this patch is to block creation of pblk
> devices in case of interleaved metadata
> 
> Signed-off-by: Igor Konopko <igor.j.konopko@intel.com>
> ---
> drivers/lightnvm/pblk-init.c | 6 ++++++
> drivers/nvme/host/lightnvm.c | 1 +
> include/linux/lightnvm.h     | 1 +
> 3 files changed, 8 insertions(+)
> 
> diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
> index 13822594647c..ded0618f6cda 100644
> --- a/drivers/lightnvm/pblk-init.c
> +++ b/drivers/lightnvm/pblk-init.c
> @@ -1154,6 +1154,12 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk,
> 		return ERR_PTR(-EINVAL);
> 	}
> 
> +	if (geo->ext) {
> +		pblk_err(pblk, "extended metadata not supported\n");
> +		kfree(pblk);
> +		return ERR_PTR(-EINVAL);
> +	}
> +
> 	spin_lock_init(&pblk->resubmit_lock);
> 	spin_lock_init(&pblk->trans_lock);
> 	spin_lock_init(&pblk->lock);
> diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
> index d1e47a93bcfd..b71c730a6e32 100644
> --- a/drivers/nvme/host/lightnvm.c
> +++ b/drivers/nvme/host/lightnvm.c
> @@ -983,6 +983,7 @@ void nvme_nvm_update_nvm_info(struct nvme_ns *ns)
> 
> 	geo->csecs = 1 << ns->lba_shift;
> 	geo->sos = ns->ms;
> +	geo->ext = ns->ext;
> 
> 	if (nvm_realloc_dma_pool(ndev))
> 		nvm_unregister(ndev);
> diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
> index 9d3b7c627cac..4870022ebff1 100644
> --- a/include/linux/lightnvm.h
> +++ b/include/linux/lightnvm.h
> @@ -357,6 +357,7 @@ struct nvm_geo {
> 	u32	clba;		/* sectors per chunk */
> 	u16	csecs;		/* sector size */
> 	u16	sos;		/* out-of-band area size */
> +	bool	ext;		/* metadata in extended data buffer */
> 
> 	/* device write constrains */
> 	u32	ws_min;		/* minimum write size */
> --
> 2.14.4

Looks good to me.

Reviewed-by: Javier González <javier@cnexlabs.com>
diff mbox series

Patch

diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 13822594647c..ded0618f6cda 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -1154,6 +1154,12 @@  static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk,
 		return ERR_PTR(-EINVAL);
 	}
 
+	if (geo->ext) {
+		pblk_err(pblk, "extended metadata not supported\n");
+		kfree(pblk);
+		return ERR_PTR(-EINVAL);
+	}
+
 	spin_lock_init(&pblk->resubmit_lock);
 	spin_lock_init(&pblk->trans_lock);
 	spin_lock_init(&pblk->lock);
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index d1e47a93bcfd..b71c730a6e32 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -983,6 +983,7 @@  void nvme_nvm_update_nvm_info(struct nvme_ns *ns)
 
 	geo->csecs = 1 << ns->lba_shift;
 	geo->sos = ns->ms;
+	geo->ext = ns->ext;
 
 	if (nvm_realloc_dma_pool(ndev))
 		nvm_unregister(ndev);
diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
index 9d3b7c627cac..4870022ebff1 100644
--- a/include/linux/lightnvm.h
+++ b/include/linux/lightnvm.h
@@ -357,6 +357,7 @@  struct nvm_geo {
 	u32	clba;		/* sectors per chunk */
 	u16	csecs;		/* sector size */
 	u16	sos;		/* out-of-band area size */
+	bool	ext;		/* metadata in extended data buffer */
 
 	/* device write constrains */
 	u32	ws_min;		/* minimum write size */