Commit 6339b7ed authored by Kanchan Joshi's avatar Kanchan Joshi Committed by Keith Busch

nvme: remove a field from nvme_ns_head

pi_offset field is not required to be present in nvme_ns_head.
Signed-off-by: default avatarKanchan Joshi <joshi.k@samsung.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent 7ec5bd24
...@@ -36,6 +36,7 @@ struct nvme_ns_info { ...@@ -36,6 +36,7 @@ struct nvme_ns_info {
struct nvme_ns_ids ids; struct nvme_ns_ids ids;
u32 nsid; u32 nsid;
__le32 anagrpid; __le32 anagrpid;
u8 pi_offset;
bool is_shared; bool is_shared;
bool is_readonly; bool is_readonly;
bool is_ready; bool is_ready;
...@@ -1758,7 +1759,7 @@ int nvme_getgeo(struct block_device *bdev, struct hd_geometry *geo) ...@@ -1758,7 +1759,7 @@ int nvme_getgeo(struct block_device *bdev, struct hd_geometry *geo)
} }
static bool nvme_init_integrity(struct nvme_ns_head *head, static bool nvme_init_integrity(struct nvme_ns_head *head,
struct queue_limits *lim) struct queue_limits *lim, struct nvme_ns_info *info)
{ {
struct blk_integrity *bi = &lim->integrity; struct blk_integrity *bi = &lim->integrity;
...@@ -1816,7 +1817,7 @@ static bool nvme_init_integrity(struct nvme_ns_head *head, ...@@ -1816,7 +1817,7 @@ static bool nvme_init_integrity(struct nvme_ns_head *head,
} }
bi->tuple_size = head->ms; bi->tuple_size = head->ms;
bi->pi_offset = head->pi_offset; bi->pi_offset = info->pi_offset;
return true; return true;
} }
...@@ -1902,12 +1903,11 @@ static void nvme_configure_pi_elbas(struct nvme_ns_head *head, ...@@ -1902,12 +1903,11 @@ static void nvme_configure_pi_elbas(struct nvme_ns_head *head,
static void nvme_configure_metadata(struct nvme_ctrl *ctrl, static void nvme_configure_metadata(struct nvme_ctrl *ctrl,
struct nvme_ns_head *head, struct nvme_id_ns *id, struct nvme_ns_head *head, struct nvme_id_ns *id,
struct nvme_id_ns_nvm *nvm) struct nvme_id_ns_nvm *nvm, struct nvme_ns_info *info)
{ {
head->features &= ~(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS); head->features &= ~(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS);
head->pi_type = 0; head->pi_type = 0;
head->pi_size = 0; head->pi_size = 0;
head->pi_offset = 0;
head->ms = le16_to_cpu(id->lbaf[nvme_lbaf_index(id->flbas)].ms); head->ms = le16_to_cpu(id->lbaf[nvme_lbaf_index(id->flbas)].ms);
if (!head->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED)) if (!head->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED))
return; return;
...@@ -1922,7 +1922,7 @@ static void nvme_configure_metadata(struct nvme_ctrl *ctrl, ...@@ -1922,7 +1922,7 @@ static void nvme_configure_metadata(struct nvme_ctrl *ctrl,
if (head->pi_size && head->ms >= head->pi_size) if (head->pi_size && head->ms >= head->pi_size)
head->pi_type = id->dps & NVME_NS_DPS_PI_MASK; head->pi_type = id->dps & NVME_NS_DPS_PI_MASK;
if (!(id->dps & NVME_NS_DPS_PI_FIRST)) if (!(id->dps & NVME_NS_DPS_PI_FIRST))
head->pi_offset = head->ms - head->pi_size; info->pi_offset = head->ms - head->pi_size;
if (ctrl->ops->flags & NVME_F_FABRICS) { if (ctrl->ops->flags & NVME_F_FABRICS) {
/* /*
...@@ -2156,7 +2156,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns, ...@@ -2156,7 +2156,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
lim = queue_limits_start_update(ns->disk->queue); lim = queue_limits_start_update(ns->disk->queue);
nvme_set_ctrl_limits(ns->ctrl, &lim); nvme_set_ctrl_limits(ns->ctrl, &lim);
nvme_configure_metadata(ns->ctrl, ns->head, id, nvm); nvme_configure_metadata(ns->ctrl, ns->head, id, nvm, info);
nvme_set_chunk_sectors(ns, id, &lim); nvme_set_chunk_sectors(ns, id, &lim);
if (!nvme_update_disk_info(ns, id, &lim)) if (!nvme_update_disk_info(ns, id, &lim))
capacity = 0; capacity = 0;
...@@ -2176,7 +2176,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns, ...@@ -2176,7 +2176,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
* I/O to namespaces with metadata except when the namespace supports * I/O to namespaces with metadata except when the namespace supports
* PI, as it can strip/insert in that case. * PI, as it can strip/insert in that case.
*/ */
if (!nvme_init_integrity(ns->head, &lim)) if (!nvme_init_integrity(ns->head, &lim, info))
capacity = 0; capacity = 0;
ret = queue_limits_commit_update(ns->disk->queue, &lim); ret = queue_limits_commit_update(ns->disk->queue, &lim);
...@@ -2280,7 +2280,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info) ...@@ -2280,7 +2280,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info)
if (unsupported) if (unsupported)
ns->head->disk->flags |= GENHD_FL_HIDDEN; ns->head->disk->flags |= GENHD_FL_HIDDEN;
else else
nvme_init_integrity(ns->head, &lim); nvme_init_integrity(ns->head, &lim, info);
ret = queue_limits_commit_update(ns->head->disk->queue, &lim); ret = queue_limits_commit_update(ns->head->disk->queue, &lim);
set_capacity_and_notify(ns->head->disk, get_capacity(ns->disk)); set_capacity_and_notify(ns->head->disk, get_capacity(ns->disk));
......
...@@ -474,7 +474,6 @@ struct nvme_ns_head { ...@@ -474,7 +474,6 @@ struct nvme_ns_head {
u16 ms; u16 ms;
u16 pi_size; u16 pi_size;
u8 pi_type; u8 pi_type;
u8 pi_offset;
u8 guard_type; u8 guard_type;
#ifdef CONFIG_BLK_DEV_ZONED #ifdef CONFIG_BLK_DEV_ZONED
u64 zsze; u64 zsze;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment