[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 26/26] nvme: make lba data size configurable
From: |
Keith Busch |
Subject: |
Re: [PATCH v5 26/26] nvme: make lba data size configurable |
Date: |
Wed, 5 Feb 2020 01:43:58 +0900 |
User-agent: |
Mutt/1.12.1 (2019-06-15) |
On Tue, Feb 04, 2020 at 10:52:08AM +0100, Klaus Jensen wrote:
> Signed-off-by: Klaus Jensen <address@hidden>
> ---
> hw/block/nvme-ns.c | 2 +-
> hw/block/nvme-ns.h | 4 +++-
> hw/block/nvme.c | 1 +
> 3 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c
> index 0e5be44486f4..981d7101b8f2 100644
> --- a/hw/block/nvme-ns.c
> +++ b/hw/block/nvme-ns.c
> @@ -18,7 +18,7 @@ static int nvme_ns_init(NvmeNamespace *ns)
> {
> NvmeIdNs *id_ns = &ns->id_ns;
>
> - id_ns->lbaf[0].ds = BDRV_SECTOR_BITS;
> + id_ns->lbaf[0].ds = ns->params.lbads;
> id_ns->nuse = id_ns->ncap = id_ns->nsze =
> cpu_to_le64(nvme_ns_nlbas(ns));
>
> diff --git a/hw/block/nvme-ns.h b/hw/block/nvme-ns.h
> index b564bac25f6d..f1fe4db78b41 100644
> --- a/hw/block/nvme-ns.h
> +++ b/hw/block/nvme-ns.h
> @@ -7,10 +7,12 @@
>
> #define DEFINE_NVME_NS_PROPERTIES(_state, _props) \
> DEFINE_PROP_DRIVE("drive", _state, blk), \
> - DEFINE_PROP_UINT32("nsid", _state, _props.nsid, 0)
> + DEFINE_PROP_UINT32("nsid", _state, _props.nsid, 0), \
> + DEFINE_PROP_UINT8("lbads", _state, _props.lbads, BDRV_SECTOR_BITS)
I think we need to validate the parameter is between 9 and 12 before
trusting it can be used safely.
Alternatively, add supported formats to the lbaf array and let the host
decide on a live system with the 'format' command.
- Re: [PATCH v5 20/26] nvme: handle dma errors, (continued)
- Message not available
- Message not available
- Message not available
Message not available
Re: [PATCH v5 22/26] nvme: support multiple namespaces, Maxim Levitsky, 2020/02/12
Re: [PATCH v5 00/26] nvme: support NVMe v1.3d, SGLs and multiple namespaces, no-reply, 2020/02/04
Re: [PATCH v5 00/26] nvme: support NVMe v1.3d, SGLs and multiple namespaces, Keith Busch, 2020/02/04