spdk: add reservation support flag to NVMe namespace
A namespace indicates support for reservations by reporting a non-zero value in the Reservation Capabilities field in the Identify Namespace data structure, and controller indicates support for reservation in the Identify Controller data structure, Here we used namespace field as the support flag. Change-Id: I0e1e29548aa3fc8b6d3bbeb4149ec4864316f092 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
81f4046402
commit
82db40dbd5
@ -342,6 +342,8 @@ print_namespace(struct nvme_namespace *ns)
|
||||
(flags & NVME_NS_DEALLOCATE_SUPPORTED) ? "Supported" : "Not Supported");
|
||||
printf("Flush: %s\n",
|
||||
(flags & NVME_NS_FLUSH_SUPPORTED) ? "Supported" : "Not Supported");
|
||||
printf("Reservation: %s\n",
|
||||
(flags & NVME_NS_RESERVATION_SUPPORTED) ? "Supported" : "Not Supported");
|
||||
printf("Size (in LBAs): %lld (%lldM)\n",
|
||||
(long long)nsdata->nsze,
|
||||
(long long)nsdata->nsze / 1024 / 1024);
|
||||
|
@ -355,6 +355,7 @@ uint64_t nvme_ns_get_size(struct nvme_namespace *ns);
|
||||
enum nvme_namespace_flags {
|
||||
NVME_NS_DEALLOCATE_SUPPORTED = 0x1, /**< The deallocate command is supported */
|
||||
NVME_NS_FLUSH_SUPPORTED = 0x2, /**< The flush command is supported */
|
||||
NVME_NS_RESERVATION_SUPPORTED = 0x4, /**< The reservation command is supported */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -794,6 +794,7 @@ struct nvme_namespace_data {
|
||||
} nmic;
|
||||
|
||||
/** reservation capabilities */
|
||||
union {
|
||||
struct {
|
||||
/** supports persist through power loss */
|
||||
uint8_t persist : 1;
|
||||
@ -818,7 +819,8 @@ struct nvme_namespace_data {
|
||||
|
||||
uint8_t reserved : 1;
|
||||
} rescap;
|
||||
|
||||
uint8_t raw;
|
||||
} nsrescap;
|
||||
/** format progress indicator */
|
||||
uint8_t fpi;
|
||||
|
||||
|
@ -126,6 +126,10 @@ nvme_ns_construct(struct nvme_namespace *ns, uint16_t id,
|
||||
ns->flags |= NVME_NS_FLUSH_SUPPORTED;
|
||||
}
|
||||
|
||||
if (nsdata->nsrescap.raw) {
|
||||
ns->flags |= NVME_NS_RESERVATION_SUPPORTED;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user