Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nvme: define constants for identification values

Improve code readability by defining the specification's constants that
the driver is using when decoding identification payloads.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Bart van Assche <bvanassche@acm.org>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Acked-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Keith Busch and committed by
Jens Axboe
92decf11 d02abd19

+14 -7
+5 -5
drivers/nvme/host/core.c
··· 1859 1859 * and whether it should be used instead of AWUPF. If NAWUPF == 1860 1860 * 0 then AWUPF must be used instead. 1861 1861 */ 1862 - if (id->nsfeat & (1 << 1) && id->nawupf) 1862 + if (id->nsfeat & NVME_NS_FEAT_ATOMICS && id->nawupf) 1863 1863 atomic_bs = (1 + le16_to_cpu(id->nawupf)) * bs; 1864 1864 else 1865 1865 atomic_bs = (1 + ns->ctrl->subsys->awupf) * bs; 1866 1866 } 1867 1867 1868 - if (id->nsfeat & (1 << 4)) { 1868 + if (id->nsfeat & NVME_NS_FEAT_IO_OPT) { 1869 1869 /* NPWG = Namespace Preferred Write Granularity */ 1870 1870 phys_bs = bs * (1 + le16_to_cpu(id->npwg)); 1871 1871 /* NOWS = Namespace Optimal Write Size */ ··· 1894 1894 nvme_config_discard(disk, ns); 1895 1895 nvme_config_write_zeroes(disk, ns); 1896 1896 1897 - if (id->nsattr & (1 << 0)) 1897 + if (id->nsattr & NVME_NS_ATTR_RO) 1898 1898 set_disk_ro(disk, true); 1899 1899 else 1900 1900 set_disk_ro(disk, false); ··· 2685 2685 return false; 2686 2686 } 2687 2687 2688 - if ((id->cmic & (1 << 1)) || 2688 + if ((id->cmic & NVME_CTRL_CMIC_MULTI_CTRL) || 2689 2689 (ctrl->opts && ctrl->opts->discovery_nqn)) 2690 2690 continue; 2691 2691 ··· 3497 3497 struct nvme_id_ns *id) 3498 3498 { 3499 3499 struct nvme_ctrl *ctrl = ns->ctrl; 3500 - bool is_shared = id->nmic & (1 << 0); 3500 + bool is_shared = id->nmic & NVME_NS_NMIC_SHARED; 3501 3501 struct nvme_ns_head *head = NULL; 3502 3502 struct nvme_ns_ids ids; 3503 3503 int ret = 0;
+3 -2
drivers/nvme/host/multipath.c
··· 372 372 * We also do this for private namespaces as the namespace sharing data could 373 373 * change after a rescan. 374 374 */ 375 - if (!(ctrl->subsys->cmic & (1 << 1)) || !multipath) 375 + if (!(ctrl->subsys->cmic & NVME_CTRL_CMIC_MULTI_CTRL) || !multipath) 376 376 return 0; 377 377 378 378 q = blk_alloc_queue(nvme_ns_head_make_request, ctrl->numa_node); ··· 694 694 int error; 695 695 696 696 /* check if multipath is enabled and we have the capability */ 697 - if (!multipath || !ctrl->subsys || !(ctrl->subsys->cmic & (1 << 3))) 697 + if (!multipath || !ctrl->subsys || 698 + !(ctrl->subsys->cmic & NVME_CTRL_CMIC_ANA)) 698 699 return 0; 699 700 700 701 ctrl->anacap = id->anacap;
+6
include/linux/nvme.h
··· 301 301 }; 302 302 303 303 enum { 304 + NVME_CTRL_CMIC_MULTI_CTRL = 1 << 1, 305 + NVME_CTRL_CMIC_ANA = 1 << 3, 304 306 NVME_CTRL_ONCS_COMPARE = 1 << 0, 305 307 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1, 306 308 NVME_CTRL_ONCS_DSM = 1 << 2, ··· 398 396 399 397 enum { 400 398 NVME_NS_FEAT_THIN = 1 << 0, 399 + NVME_NS_FEAT_ATOMICS = 1 << 1, 400 + NVME_NS_FEAT_IO_OPT = 1 << 4, 401 + NVME_NS_ATTR_RO = 1 << 0, 401 402 NVME_NS_FLBAS_LBA_MASK = 0xf, 402 403 NVME_NS_FLBAS_META_EXT = 0x10, 404 + NVME_NS_NMIC_SHARED = 1 << 0, 403 405 NVME_LBAF_RP_BEST = 0, 404 406 NVME_LBAF_RP_BETTER = 1, 405 407 NVME_LBAF_RP_GOOD = 2,