[PATCH 0/4] nvme: nidt and ns-desc related clanup

Chaitanya Kulkarni chaitanya.kulkarni at wdc.com
Mon May 17 22:05:53 PDT 2021


Hi,

This is a small patch-series tries to minimize the number of the macro
identifiers. 

In the current code we maintain NVME_NIDT_XXX identifire values and the
their length NVME_NIDT_XXX_LEN separately which has 1:1 mapping. This
adds founr extra macros and open coding of such macros in the host and
the target.

With this open coding in future we will have to maintain one extra macro
representing length for each new NIDT identifire that we will add.

I did the light testing on this with nvme-loop [1].

-ck

Chaitanya Kulkarni (4):
  nvme: calculate data offset once for ns-desc
  nvme-core: add a helper to get the len from nid
  nvmet: use nvme_nidt_len() helper for id-desc
  nvme-core: remove the NVME_NIDT_XXX_LEN macros

 drivers/nvme/host/core.c        | 25 +++++++++++++------------
 drivers/nvme/target/admin-cmd.c |  8 +++++---
 include/linux/nvme.h            | 21 ++++++++++++++++-----
 3 files changed, 34 insertions(+), 20 deletions(-)

# nvme list  | tr -s ' ' ' ' | grep -v '-'
Node SN Model Namespace Usage Format FW Rev 
/dev/nvme0n1 foo QEMU NVMe Ctrl 1 1.07 GB / 1.07 GB 512 B + 0 B 1.0 
/dev/nvme1n1 e3a9ed423c786510 Linux 1 2.15 GB / 2.15 GB 4 KiB + 0 B 5.12.0nv
# cat /sys/kernel/config/nvmet/subsystems/z/namespaces/1/device_nguid 
11111111-2222-3333-4444-000000000000
# cat /sys/kernel/config/nvmet/subsystems/z/namespaces/1/device_uuid 
aeed37e9-39b3-48cc-bc9d-1c799fa56df7
# nvme ns-descs /dev/nvme1n1 
NVME Namespace Identification Descriptors NS 1:
uuid    : aeed37e9-39b3-48cc-bc9d-1c799fa56df7
nguid   : 11111111222233334444000000000000

-- 
2.22.1




More information about the Linux-nvme mailing list