* [PATCH 0/3] nvme_ns_head cleanup [not found] <CGME20240730103941epcas5p37930edd18b9649d4df2083151ed21022@epcas5p3.samsung.com> @ 2024-07-30 10:31 ` Kanchan Joshi 2024-07-30 10:31 ` [PATCH 1/3] nvme: remove a field from nvme_ns_head Kanchan Joshi ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: Kanchan Joshi @ 2024-07-30 10:31 UTC (permalink / raw) To: kbusch, hch, sagi; +Cc: linux-nvme, Kanchan Joshi Remove/change/reorganize fields inside nvme_ns_head. Kanchan Joshi (3): nvme: remove a field from nvme_ns_head nvme: change data type of lba_shift nvme: reorganize nvme_ns_head fields drivers/nvme/host/core.c | 16 ++++++++-------- drivers/nvme/host/nvme.h | 13 ++++++------- 2 files changed, 14 insertions(+), 15 deletions(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] nvme: remove a field from nvme_ns_head 2024-07-30 10:31 ` [PATCH 0/3] nvme_ns_head cleanup Kanchan Joshi @ 2024-07-30 10:31 ` Kanchan Joshi 2024-07-30 15:02 ` Christoph Hellwig ` (2 more replies) 2024-07-30 10:31 ` [PATCH 2/3] nvme: change data type of lba_shift Kanchan Joshi 2024-07-30 10:31 ` [PATCH 3/3] nvme: reorganize nvme_ns_head fields Kanchan Joshi 2 siblings, 3 replies; 11+ messages in thread From: Kanchan Joshi @ 2024-07-30 10:31 UTC (permalink / raw) To: kbusch, hch, sagi; +Cc: linux-nvme, Kanchan Joshi pi_offset field is not required to be present in nvme_ns_head. Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> --- drivers/nvme/host/core.c | 16 ++++++++-------- drivers/nvme/host/nvme.h | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index d7f5b24ce003..4a00f400bd8f 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -36,6 +36,7 @@ struct nvme_ns_info { struct nvme_ns_ids ids; u32 nsid; __le32 anagrpid; + u8 pi_offset; bool is_shared; bool is_readonly; bool is_ready; @@ -1757,7 +1758,7 @@ int nvme_getgeo(struct block_device *bdev, struct hd_geometry *geo) } 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; @@ -1815,7 +1816,7 @@ static bool nvme_init_integrity(struct nvme_ns_head *head, } bi->tuple_size = head->ms; - bi->pi_offset = head->pi_offset; + bi->pi_offset = info->pi_offset; return true; } @@ -1901,12 +1902,11 @@ static void nvme_configure_pi_elbas(struct nvme_ns_head *head, static void nvme_configure_metadata(struct nvme_ctrl *ctrl, 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->pi_type = 0; head->pi_size = 0; - head->pi_offset = 0; head->ms = le16_to_cpu(id->lbaf[nvme_lbaf_index(id->flbas)].ms); if (!head->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED)) return; @@ -1921,7 +1921,7 @@ static void nvme_configure_metadata(struct nvme_ctrl *ctrl, if (head->pi_size && head->ms >= head->pi_size) head->pi_type = id->dps & NVME_NS_DPS_PI_MASK; 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) { /* @@ -2155,7 +2155,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns, lim = queue_limits_start_update(ns->disk->queue); 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); if (!nvme_update_disk_info(ns, id, &lim)) capacity = 0; @@ -2175,7 +2175,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns, * I/O to namespaces with metadata except when the namespace supports * 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; ret = queue_limits_commit_update(ns->disk->queue, &lim); @@ -2279,7 +2279,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info) if (unsupported) ns->head->disk->flags |= GENHD_FL_HIDDEN; else - nvme_init_integrity(ns->head, &lim); + nvme_init_integrity(ns->head, &lim, info); ret = queue_limits_commit_update(ns->head->disk->queue, &lim); set_capacity_and_notify(ns->head->disk, get_capacity(ns->disk)); diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 9ac587e64166..09303454bb24 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -474,7 +474,6 @@ struct nvme_ns_head { u16 ms; u16 pi_size; u8 pi_type; - u8 pi_offset; u8 guard_type; #ifdef CONFIG_BLK_DEV_ZONED u64 zsze; -- 2.25.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] nvme: remove a field from nvme_ns_head 2024-07-30 10:31 ` [PATCH 1/3] nvme: remove a field from nvme_ns_head Kanchan Joshi @ 2024-07-30 15:02 ` Christoph Hellwig 2024-07-31 9:45 ` Sagi Grimberg 2024-07-31 15:36 ` Keith Busch 2 siblings, 0 replies; 11+ messages in thread From: Christoph Hellwig @ 2024-07-30 15:02 UTC (permalink / raw) To: Kanchan Joshi; +Cc: kbusch, hch, sagi, linux-nvme On Tue, Jul 30, 2024 at 04:01:36PM +0530, Kanchan Joshi wrote: > pi_offset field is not required to be present in nvme_ns_head. Maybe spell the field name out in the subject? Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] nvme: remove a field from nvme_ns_head 2024-07-30 10:31 ` [PATCH 1/3] nvme: remove a field from nvme_ns_head Kanchan Joshi 2024-07-30 15:02 ` Christoph Hellwig @ 2024-07-31 9:45 ` Sagi Grimberg 2024-07-31 15:36 ` Keith Busch 2 siblings, 0 replies; 11+ messages in thread From: Sagi Grimberg @ 2024-07-31 9:45 UTC (permalink / raw) To: Kanchan Joshi, kbusch, hch; +Cc: linux-nvme Reviewed-by: Sagi Grimberg <sagi@grimberg.me> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] nvme: remove a field from nvme_ns_head 2024-07-30 10:31 ` [PATCH 1/3] nvme: remove a field from nvme_ns_head Kanchan Joshi 2024-07-30 15:02 ` Christoph Hellwig 2024-07-31 9:45 ` Sagi Grimberg @ 2024-07-31 15:36 ` Keith Busch 2 siblings, 0 replies; 11+ messages in thread From: Keith Busch @ 2024-07-31 15:36 UTC (permalink / raw) To: Kanchan Joshi; +Cc: hch, sagi, linux-nvme Thanks, series applied to nvme-6.11. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/3] nvme: change data type of lba_shift 2024-07-30 10:31 ` [PATCH 0/3] nvme_ns_head cleanup Kanchan Joshi 2024-07-30 10:31 ` [PATCH 1/3] nvme: remove a field from nvme_ns_head Kanchan Joshi @ 2024-07-30 10:31 ` Kanchan Joshi 2024-07-30 15:03 ` Christoph Hellwig 2024-07-31 9:46 ` Sagi Grimberg 2024-07-30 10:31 ` [PATCH 3/3] nvme: reorganize nvme_ns_head fields Kanchan Joshi 2 siblings, 2 replies; 11+ messages in thread From: Kanchan Joshi @ 2024-07-30 10:31 UTC (permalink / raw) To: kbusch, hch, sagi; +Cc: linux-nvme, Kanchan Joshi u8 fits the need, so stop using int for it. Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> --- drivers/nvme/host/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 09303454bb24..7bfa410d055e 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -470,7 +470,7 @@ struct nvme_ns_head { struct nvme_effects_log *effects; u64 nuse; unsigned ns_id; - int lba_shift; + u8 lba_shift; u16 ms; u16 pi_size; u8 pi_type; -- 2.25.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] nvme: change data type of lba_shift 2024-07-30 10:31 ` [PATCH 2/3] nvme: change data type of lba_shift Kanchan Joshi @ 2024-07-30 15:03 ` Christoph Hellwig 2024-07-31 9:46 ` Sagi Grimberg 1 sibling, 0 replies; 11+ messages in thread From: Christoph Hellwig @ 2024-07-30 15:03 UTC (permalink / raw) To: Kanchan Joshi; +Cc: kbusch, hch, sagi, linux-nvme Looks good: Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] nvme: change data type of lba_shift 2024-07-30 10:31 ` [PATCH 2/3] nvme: change data type of lba_shift Kanchan Joshi 2024-07-30 15:03 ` Christoph Hellwig @ 2024-07-31 9:46 ` Sagi Grimberg 1 sibling, 0 replies; 11+ messages in thread From: Sagi Grimberg @ 2024-07-31 9:46 UTC (permalink / raw) To: Kanchan Joshi, kbusch, hch; +Cc: linux-nvme Reviewed-by: Sagi Grimberg <sagi@grimberg.me>** ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/3] nvme: reorganize nvme_ns_head fields 2024-07-30 10:31 ` [PATCH 0/3] nvme_ns_head cleanup Kanchan Joshi 2024-07-30 10:31 ` [PATCH 1/3] nvme: remove a field from nvme_ns_head Kanchan Joshi 2024-07-30 10:31 ` [PATCH 2/3] nvme: change data type of lba_shift Kanchan Joshi @ 2024-07-30 10:31 ` Kanchan Joshi 2024-07-30 15:04 ` Christoph Hellwig 2024-07-31 9:46 ` Sagi Grimberg 2 siblings, 2 replies; 11+ messages in thread From: Kanchan Joshi @ 2024-07-30 10:31 UTC (permalink / raw) To: kbusch, hch, sagi; +Cc: linux-nvme, Kanchan Joshi shuffle few fields to reduce the holes within nvme_ns_head. On x86_64, the size is reduced to 1104 bytes from 1120 bytes. Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> --- drivers/nvme/host/nvme.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 7bfa410d055e..67ab626861d3 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -462,19 +462,19 @@ struct nvme_ns_head { struct srcu_struct srcu; struct nvme_subsystem *subsys; struct nvme_ns_ids ids; + u8 lba_shift; + u16 ms; + u16 pi_size; + u8 pi_type; + u8 guard_type; struct list_head entry; struct kref ref; bool shared; bool passthru_err_log_enabled; - int instance; struct nvme_effects_log *effects; u64 nuse; unsigned ns_id; - u8 lba_shift; - u16 ms; - u16 pi_size; - u8 pi_type; - u8 guard_type; + int instance; #ifdef CONFIG_BLK_DEV_ZONED u64 zsze; #endif -- 2.25.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3] nvme: reorganize nvme_ns_head fields 2024-07-30 10:31 ` [PATCH 3/3] nvme: reorganize nvme_ns_head fields Kanchan Joshi @ 2024-07-30 15:04 ` Christoph Hellwig 2024-07-31 9:46 ` Sagi Grimberg 1 sibling, 0 replies; 11+ messages in thread From: Christoph Hellwig @ 2024-07-30 15:04 UTC (permalink / raw) To: Kanchan Joshi; +Cc: kbusch, hch, sagi, linux-nvme Looks good: Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3] nvme: reorganize nvme_ns_head fields 2024-07-30 10:31 ` [PATCH 3/3] nvme: reorganize nvme_ns_head fields Kanchan Joshi 2024-07-30 15:04 ` Christoph Hellwig @ 2024-07-31 9:46 ` Sagi Grimberg 1 sibling, 0 replies; 11+ messages in thread From: Sagi Grimberg @ 2024-07-31 9:46 UTC (permalink / raw) To: Kanchan Joshi, kbusch, hch; +Cc: linux-nvme Reviewed-by: Sagi Grimberg <sagi@grimberg.me> ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-07-31 15:37 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20240730103941epcas5p37930edd18b9649d4df2083151ed21022@epcas5p3.samsung.com>
2024-07-30 10:31 ` [PATCH 0/3] nvme_ns_head cleanup Kanchan Joshi
2024-07-30 10:31 ` [PATCH 1/3] nvme: remove a field from nvme_ns_head Kanchan Joshi
2024-07-30 15:02 ` Christoph Hellwig
2024-07-31 9:45 ` Sagi Grimberg
2024-07-31 15:36 ` Keith Busch
2024-07-30 10:31 ` [PATCH 2/3] nvme: change data type of lba_shift Kanchan Joshi
2024-07-30 15:03 ` Christoph Hellwig
2024-07-31 9:46 ` Sagi Grimberg
2024-07-30 10:31 ` [PATCH 3/3] nvme: reorganize nvme_ns_head fields Kanchan Joshi
2024-07-30 15:04 ` Christoph Hellwig
2024-07-31 9:46 ` Sagi Grimberg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox