[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 09/11] hw/nvme: enable namespace rescap function
From: |
Changqi Lu |
Subject: |
[PATCH v2 09/11] hw/nvme: enable namespace rescap function |
Date: |
Mon, 13 May 2024 11:52:28 +0800 |
This commit enables the rescap function in the
namespace by detecting the supported reservation
function in the backend driver.
Signed-off-by: Changqi Lu <luchangqi.123@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
hw/nvme/ns.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c
index ea8db175db..68a18636fb 100644
--- a/hw/nvme/ns.c
+++ b/hw/nvme/ns.c
@@ -20,6 +20,7 @@
#include "qemu/bitops.h"
#include "sysemu/sysemu.h"
#include "sysemu/block-backend.h"
+#include "block/block_int.h"
#include "nvme.h"
#include "trace.h"
@@ -55,6 +56,12 @@ void nvme_ns_init_format(NvmeNamespace *ns)
}
id_ns->npda = id_ns->npdg = npdg - 1;
+
+ /* The persistent reservation capacities of block
+ * and nvme are currently defined the same.
+ * If there are subsequent changes, this part needs to be changed.
+ */
+ id_ns->rescap = blk_bs(ns->blkconf.blk)->file->bs->bl.pr_cap;
}
static int nvme_ns_init(NvmeNamespace *ns, Error **errp)
--
2.20.1
- [PATCH v2 00/11] Support persistent reservation operations, Changqi Lu, 2024/05/12
- [PATCH v2 02/11] block/raw: add persistent reservation in/out driver, Changqi Lu, 2024/05/12
- [PATCH v2 01/11] block: add persistent reservation in/out api, Changqi Lu, 2024/05/12
- [PATCH v2 04/11] scsi/util: add helper functions for persistent reservation types conversion, Changqi Lu, 2024/05/12
- [PATCH v2 03/11] scsi/constant: add persistent reservation in/out protocol constants, Changqi Lu, 2024/05/12
- [PATCH v2 05/11] hw/scsi: add persistent reservation in/out api for scsi device, Changqi Lu, 2024/05/12
- [PATCH v2 06/11] block/nvme: add reservation command protocol constants, Changqi Lu, 2024/05/12
- [PATCH v2 07/11] hw/nvme: add helper functions for converting reservation types, Changqi Lu, 2024/05/12
- [PATCH v2 08/11] hw/nvme: enable ONCS reservations, Changqi Lu, 2024/05/12
- [PATCH v2 09/11] hw/nvme: enable namespace rescap function,
Changqi Lu <=
- [PATCH v2 10/11] hw/nvme: add reservation protocal command, Changqi Lu, 2024/05/12
- [PATCH v2 11/11] block/iscsi: add persistent reservation in/out driver, Changqi Lu, 2024/05/12