nvme: Add spdk_nvme_ns_supports_compare function

This function returns information if compare
operation is supported by device.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I321e9bf6d146ac8d14ea4549cb4380735b30be6f

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477925
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Maciej Szwed 2019-12-13 12:43:44 +01:00 committed by Tomasz Zawadzki
parent b95de9a3ca
commit f76713837e
2 changed files with 18 additions and 0 deletions

View File

@ -1889,6 +1889,18 @@ uint32_t spdk_nvme_ns_get_md_size(struct spdk_nvme_ns *ns);
*/ */
bool spdk_nvme_ns_supports_extended_lba(struct spdk_nvme_ns *ns); bool spdk_nvme_ns_supports_extended_lba(struct spdk_nvme_ns *ns);
/**
* Check whether if the namespace supports compare operation
*
* This function is thread safe and can be called at any point while the controller
* is attached to the SPDK NVMe driver.
*
* \param ns Namespace to query.
*
* \return true if the namespace supports compare operation, or false otherwise.
*/
bool spdk_nvme_ns_supports_compare(struct spdk_nvme_ns *ns);
/** /**
* Determine the value returned when reading deallocated blocks. * Determine the value returned when reading deallocated blocks.
* *

View File

@ -250,6 +250,12 @@ spdk_nvme_ns_supports_extended_lba(struct spdk_nvme_ns *ns)
return (ns->flags & SPDK_NVME_NS_EXTENDED_LBA_SUPPORTED) ? true : false; return (ns->flags & SPDK_NVME_NS_EXTENDED_LBA_SUPPORTED) ? true : false;
} }
bool
spdk_nvme_ns_supports_compare(struct spdk_nvme_ns *ns)
{
return (ns->flags & SPDK_NVME_NS_COMPARE_SUPPORTED) ? true : false;
}
uint32_t uint32_t
spdk_nvme_ns_get_md_size(struct spdk_nvme_ns *ns) spdk_nvme_ns_get_md_size(struct spdk_nvme_ns *ns)
{ {