Skip to content

Commit 6339b7e

Browse files
Kanchan Joshikeithbusch
authored andcommitted
nvme: remove a field from nvme_ns_head
pi_offset field is not required to be present in nvme_ns_head. Signed-off-by: Kanchan Joshi <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 7ec5bd2 commit 6339b7e

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

drivers/nvme/host/core.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct nvme_ns_info {
3636
struct nvme_ns_ids ids;
3737
u32 nsid;
3838
__le32 anagrpid;
39+
u8 pi_offset;
3940
bool is_shared;
4041
bool is_readonly;
4142
bool is_ready;
@@ -1758,7 +1759,7 @@ int nvme_getgeo(struct block_device *bdev, struct hd_geometry *geo)
17581759
}
17591760

17601761
static bool nvme_init_integrity(struct nvme_ns_head *head,
1761-
struct queue_limits *lim)
1762+
struct queue_limits *lim, struct nvme_ns_info *info)
17621763
{
17631764
struct blk_integrity *bi = &lim->integrity;
17641765

@@ -1816,7 +1817,7 @@ static bool nvme_init_integrity(struct nvme_ns_head *head,
18161817
}
18171818

18181819
bi->tuple_size = head->ms;
1819-
bi->pi_offset = head->pi_offset;
1820+
bi->pi_offset = info->pi_offset;
18201821
return true;
18211822
}
18221823

@@ -1902,12 +1903,11 @@ static void nvme_configure_pi_elbas(struct nvme_ns_head *head,
19021903

19031904
static void nvme_configure_metadata(struct nvme_ctrl *ctrl,
19041905
struct nvme_ns_head *head, struct nvme_id_ns *id,
1905-
struct nvme_id_ns_nvm *nvm)
1906+
struct nvme_id_ns_nvm *nvm, struct nvme_ns_info *info)
19061907
{
19071908
head->features &= ~(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS);
19081909
head->pi_type = 0;
19091910
head->pi_size = 0;
1910-
head->pi_offset = 0;
19111911
head->ms = le16_to_cpu(id->lbaf[nvme_lbaf_index(id->flbas)].ms);
19121912
if (!head->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED))
19131913
return;
@@ -1922,7 +1922,7 @@ static void nvme_configure_metadata(struct nvme_ctrl *ctrl,
19221922
if (head->pi_size && head->ms >= head->pi_size)
19231923
head->pi_type = id->dps & NVME_NS_DPS_PI_MASK;
19241924
if (!(id->dps & NVME_NS_DPS_PI_FIRST))
1925-
head->pi_offset = head->ms - head->pi_size;
1925+
info->pi_offset = head->ms - head->pi_size;
19261926

19271927
if (ctrl->ops->flags & NVME_F_FABRICS) {
19281928
/*
@@ -2156,7 +2156,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
21562156

21572157
lim = queue_limits_start_update(ns->disk->queue);
21582158
nvme_set_ctrl_limits(ns->ctrl, &lim);
2159-
nvme_configure_metadata(ns->ctrl, ns->head, id, nvm);
2159+
nvme_configure_metadata(ns->ctrl, ns->head, id, nvm, info);
21602160
nvme_set_chunk_sectors(ns, id, &lim);
21612161
if (!nvme_update_disk_info(ns, id, &lim))
21622162
capacity = 0;
@@ -2176,7 +2176,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
21762176
* I/O to namespaces with metadata except when the namespace supports
21772177
* PI, as it can strip/insert in that case.
21782178
*/
2179-
if (!nvme_init_integrity(ns->head, &lim))
2179+
if (!nvme_init_integrity(ns->head, &lim, info))
21802180
capacity = 0;
21812181

21822182
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)
22802280
if (unsupported)
22812281
ns->head->disk->flags |= GENHD_FL_HIDDEN;
22822282
else
2283-
nvme_init_integrity(ns->head, &lim);
2283+
nvme_init_integrity(ns->head, &lim, info);
22842284
ret = queue_limits_commit_update(ns->head->disk->queue, &lim);
22852285

22862286
set_capacity_and_notify(ns->head->disk, get_capacity(ns->disk));

drivers/nvme/host/nvme.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@ struct nvme_ns_head {
474474
u16 ms;
475475
u16 pi_size;
476476
u8 pi_type;
477-
u8 pi_offset;
478477
u8 guard_type;
479478
#ifdef CONFIG_BLK_DEV_ZONED
480479
u64 zsze;

0 commit comments

Comments
 (0)