]> www.infradead.org Git - users/hch/misc.git/commitdiff
nvme: store the endurance group id in struct nvme_ns_head
authorChristoph Hellwig <hch@lst.de>
Tue, 19 Nov 2024 10:25:11 +0000 (11:25 +0100)
committerChristoph Hellwig <hch@lst.de>
Tue, 19 Nov 2024 11:18:00 +0000 (12:18 +0100)
The FDP code needs this.

Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c
drivers/nvme/host/nvme.h

index 1a8d32a4a5c31b5ddef1ae38cb22f8eb803a2745..d194b36b08ac6401aec7c4534e0836b990250943 100644 (file)
@@ -38,6 +38,7 @@ struct nvme_ns_info {
        u32 nsid;
        __le32 anagrpid;
        u8 pi_offset;
+       u16 endgid;
        bool is_shared;
        bool is_readonly;
        bool is_ready;
@@ -1600,6 +1601,7 @@ static int nvme_ns_info_from_identify(struct nvme_ctrl *ctrl,
        }
 
        info->anagrpid = id->anagrpid;
+       info->endgid = le16_to_cpu(id->endgid);
        info->is_shared = id->nmic & NVME_NS_NMIC_SHARED;
        info->is_readonly = id->nsattr & NVME_NS_ATTR_RO;
        info->is_ready = true;
@@ -1638,6 +1640,7 @@ static int nvme_ns_info_from_id_cs_indep(struct nvme_ctrl *ctrl,
        ret = nvme_submit_sync_cmd(ctrl->admin_q, &c, id, sizeof(*id));
        if (!ret) {
                info->anagrpid = id->anagrpid;
+               info->endgid = le16_to_cpu(id->endgid);
                info->is_shared = id->nmic & NVME_NS_NMIC_SHARED;
                info->is_readonly = id->nsattr & NVME_NS_ATTR_RO;
                info->is_ready = id->nstat & NVME_NSTAT_NRDY;
@@ -3644,6 +3647,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
        head->ids = info->ids;
        head->shared = info->is_shared;
        head->rotational = info->is_rotational;
+       head->endgid = info->endgid;
        ratelimit_state_init(&head->rs_nuse, 5 * HZ, 1);
        ratelimit_set_flags(&head->rs_nuse, RATELIMIT_MSG_ON_RELEASE);
        kref_init(&head->ref);
index 900719c4c70c15af480d13bb08bf7119ae5f0e69..9b916a904f001b1265f3b854d0e24ffaee3b2b1e 100644 (file)
@@ -491,6 +491,8 @@ struct nvme_ns_head {
        struct device           cdev_device;
 
        struct gendisk          *disk;
+
+       u16                     endgid;
 #ifdef CONFIG_NVME_MULTIPATH
        struct bio_list         requeue_list;
        spinlock_t              requeue_lock;