> On 22 Oct 2018, at 12.36, Igor Konopko <[email protected]> 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 <[email protected]>
> ---
> 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 <[email protected]>

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to