diff options
author | Klaus Jensen <k.jensen@samsung.com> | 2021-03-23 22:42:56 +0100 |
---|---|---|
committer | Klaus Jensen <k.jensen@samsung.com> | 2021-04-07 10:47:43 +0200 |
commit | 9b8671ed43eed95e43ea97528e761810177d09a3 (patch) | |
tree | 7bb35b6b739b17093ef54c478f336bb0fec826fc /hw | |
parent | f447f92c886576ebc7e2354e3af443760966e514 (diff) |
hw/block/nvme: update dmsrl limit on namespace detachment
The Non-MDTS DMSRL limit must be recomputed when namespaces are
detached.
Fixes: 645ce1a70cb6 ("hw/block/nvme: support namespace attachment command")
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/block/nvme.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 5911adcf57..0e5ba27c46 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -4868,6 +4868,21 @@ static uint16_t nvme_aer(NvmeCtrl *n, NvmeRequest *req) return NVME_NO_COMPLETE; } +static void nvme_update_dmrsl(NvmeCtrl *n) +{ + int nsid; + + for (nsid = 1; nsid <= NVME_MAX_NAMESPACES; nsid++) { + NvmeNamespace *ns = nvme_ns(n, nsid); + if (!ns) { + continue; + } + + n->dmrsl = MIN_NON_ZERO(n->dmrsl, + BDRV_REQUEST_MAX_BYTES / nvme_l2b(ns, 1)); + } +} + static void __nvme_select_ns_iocs(NvmeCtrl *n, NvmeNamespace *ns); static uint16_t nvme_ns_attachment(NvmeCtrl *n, NvmeRequest *req) { @@ -4917,6 +4932,8 @@ static uint16_t nvme_ns_attachment(NvmeCtrl *n, NvmeRequest *req) } nvme_ns_detach(ctrl, ns); + + nvme_update_dmrsl(ctrl); } /* |