bdev/nvme: Set bdev phys_blocklen
Set nvme bdev physical block size based value of NPWG and NAWUPF namespace field. The logic to set bdev phys_blocklen is based on how Linux nvme block driver sets it. If the underlying nvme namespace supports NPWG/NAWUPF then bdev phys_blocklen is set to min(npwg, nawupf) Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Change-Id: I6d254a9e730dccc230b9db4d1217bf7ab2f39b6c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8224 Community-CI: Mellanox Build Bot Tested-by: 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: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
a119799b26
commit
2dd2d19768
@ -1357,6 +1357,7 @@ nvme_disk_create(struct spdk_bdev *disk, const char *base_name,
|
||||
const struct spdk_nvme_ns_data *nsdata;
|
||||
int rc;
|
||||
enum spdk_nvme_csi csi;
|
||||
uint32_t atomic_bs, phys_bs, bs;
|
||||
|
||||
cdata = spdk_nvme_ctrlr_get_data(ctrlr);
|
||||
csi = spdk_nvme_ns_get_csi(ns);
|
||||
@ -1399,6 +1400,20 @@ nvme_disk_create(struct spdk_bdev *disk, const char *base_name,
|
||||
}
|
||||
|
||||
nsdata = spdk_nvme_ns_get_data(ns);
|
||||
bs = spdk_nvme_ns_get_sector_size(ns);
|
||||
atomic_bs = bs;
|
||||
phys_bs = bs;
|
||||
if (nsdata->nabo == 0) {
|
||||
if (nsdata->nsfeat.ns_atomic_write_unit && nsdata->nawupf) {
|
||||
atomic_bs = bs * (1 + nsdata->nawupf);
|
||||
} else {
|
||||
atomic_bs = bs * (1 + cdata->awupf);
|
||||
}
|
||||
}
|
||||
if (nsdata->nsfeat.optperf) {
|
||||
phys_bs = bs * (1 + nsdata->npwg);
|
||||
}
|
||||
disk->phys_blocklen = spdk_min(phys_bs, atomic_bs);
|
||||
|
||||
disk->md_len = spdk_nvme_ns_get_md_size(ns);
|
||||
if (disk->md_len != 0) {
|
||||
|
@ -116,6 +116,8 @@ DEFINE_STUB(spdk_nvme_ns_get_max_io_xfer_size, uint32_t, (struct spdk_nvme_ns *n
|
||||
|
||||
DEFINE_STUB(spdk_nvme_ns_get_extended_sector_size, uint32_t, (struct spdk_nvme_ns *ns), 0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_ns_get_sector_size, uint32_t, (struct spdk_nvme_ns *ns), 0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_ns_get_pi_type, enum spdk_nvme_pi_type, (struct spdk_nvme_ns *ns), 0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_ns_supports_compare, bool, (struct spdk_nvme_ns *ns), false);
|
||||
|
Loading…
Reference in New Issue
Block a user