Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] cleanup
       [not found] <CGME20240502064149epcas5p4be127b8e22874b76bb41ce25c29263f9@epcas5p4.samsung.com>
@ 2024-05-02  6:34 ` Kanchan Joshi
  2024-05-02  6:34   ` [PATCH 1/2] nvme: remove sgs and sws Kanchan Joshi
  2024-05-02  6:34   ` [PATCH 2/2] nvme: reduce a repeated ZNS check Kanchan Joshi
  0 siblings, 2 replies; 8+ messages in thread
From: Kanchan Joshi @ 2024-05-02  6:34 UTC (permalink / raw)
  To: kbusch, hch, sagi; +Cc: linux-nvme, Kanchan Joshi

First patch removes two unused variables.
Second one reduces repeated checking.

Kanchan Joshi (2):
  nvme: remove sgs and sws
  nvme: reduce a repeated ZNS check

 drivers/nvme/host/core.c | 9 +++++----
 drivers/nvme/host/nvme.h | 2 --
 2 files changed, 5 insertions(+), 6 deletions(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] nvme: remove sgs and sws
  2024-05-02  6:34 ` [PATCH 0/2] cleanup Kanchan Joshi
@ 2024-05-02  6:34   ` Kanchan Joshi
  2024-05-02  7:12     ` Christoph Hellwig
  2024-05-03  7:36     ` Sagi Grimberg
  2024-05-02  6:34   ` [PATCH 2/2] nvme: reduce a repeated ZNS check Kanchan Joshi
  1 sibling, 2 replies; 8+ messages in thread
From: Kanchan Joshi @ 2024-05-02  6:34 UTC (permalink / raw)
  To: kbusch, hch, sagi; +Cc: linux-nvme, Kanchan Joshi

sgs/sws are unused, so remove these from nvme_ns_head structure.

Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
---
 drivers/nvme/host/nvme.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index d0ed64dc7380..22a9992a4525 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -466,8 +466,6 @@ struct nvme_ns_head {
 	u8			pi_type;
 	u8			pi_offset;
 	u8			guard_type;
-	u16			sgs;
-	u32			sws;
 #ifdef CONFIG_BLK_DEV_ZONED
 	u64			zsze;
 #endif
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] nvme: reduce a repeated ZNS check
  2024-05-02  6:34 ` [PATCH 0/2] cleanup Kanchan Joshi
  2024-05-02  6:34   ` [PATCH 1/2] nvme: remove sgs and sws Kanchan Joshi
@ 2024-05-02  6:34   ` Kanchan Joshi
  2024-05-02  7:13     ` Christoph Hellwig
  1 sibling, 1 reply; 8+ messages in thread
From: Kanchan Joshi @ 2024-05-02  6:34 UTC (permalink / raw)
  To: kbusch, hch, sagi; +Cc: linux-nvme, Kanchan Joshi

Modify nvme_update_ns_info_block() to eliminate the repeated check for
ZNS.

Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
---
 drivers/nvme/host/core.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 8ae0a2dc5eda..7f4df3932ca4 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2081,6 +2081,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 	sector_t capacity;
 	unsigned lbaf;
 	int ret;
+	bool is_zns;
 
 	ret = nvme_identify_ns(ns->ctrl, info->nsid, &id);
 	if (ret)
@@ -2100,8 +2101,9 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 			goto out;
 	}
 
-	if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
-	    ns->head->ids.csi == NVME_CSI_ZNS) {
+	is_zns = IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
+		 ns->head->ids.csi == NVME_CSI_ZNS;
+	if (is_zns) {
 		ret = nvme_query_zone_info(ns, lbaf, &zi);
 		if (ret < 0)
 			goto out;
@@ -2119,8 +2121,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 	if (!nvme_update_disk_info(ns, id, &lim))
 		capacity = 0;
 	nvme_config_discard(ns, &lim);
-	if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
-	    ns->head->ids.csi == NVME_CSI_ZNS)
+	if (is_zns)
 		nvme_update_zone_info(ns, &lim, &zi);
 	ret = queue_limits_commit_update(ns->disk->queue, &lim);
 	if (ret) {
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] nvme: remove sgs and sws
  2024-05-02  6:34   ` [PATCH 1/2] nvme: remove sgs and sws Kanchan Joshi
@ 2024-05-02  7:12     ` Christoph Hellwig
  2024-05-03  7:36     ` Sagi Grimberg
  1 sibling, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2024-05-02  7:12 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] 8+ messages in thread

* Re: [PATCH 2/2] nvme: reduce a repeated ZNS check
  2024-05-02  6:34   ` [PATCH 2/2] nvme: reduce a repeated ZNS check Kanchan Joshi
@ 2024-05-02  7:13     ` Christoph Hellwig
  2024-05-02  8:44       ` Kanchan Joshi
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2024-05-02  7:13 UTC (permalink / raw)
  To: Kanchan Joshi; +Cc: kbusch, hch, sagi, linux-nvme

On Thu, May 02, 2024 at 12:04:38PM +0530, Kanchan Joshi wrote:
> Modify nvme_update_ns_info_block() to eliminate the repeated check for
> ZNS.

Not sure there is much of a point do de-duplicate two instances of
compile time condition + trivial const comparison?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] nvme: reduce a repeated ZNS check
  2024-05-02  7:13     ` Christoph Hellwig
@ 2024-05-02  8:44       ` Kanchan Joshi
  2024-05-03  7:38         ` Sagi Grimberg
  0 siblings, 1 reply; 8+ messages in thread
From: Kanchan Joshi @ 2024-05-02  8:44 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: kbusch, sagi, linux-nvme

On 5/2/2024 12:43 PM, Christoph Hellwig wrote:
> Not sure there is much of a point do de-duplicate two instances of
> compile time condition + trivial const comparison?
> 

I also don't see it as a [micro] optimization. But this if condition 
seemed too long to be present twice.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] nvme: remove sgs and sws
  2024-05-02  6:34   ` [PATCH 1/2] nvme: remove sgs and sws Kanchan Joshi
  2024-05-02  7:12     ` Christoph Hellwig
@ 2024-05-03  7:36     ` Sagi Grimberg
  1 sibling, 0 replies; 8+ messages in thread
From: Sagi Grimberg @ 2024-05-03  7:36 UTC (permalink / raw)
  To: Kanchan Joshi, kbusch, hch; +Cc: linux-nvme

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] nvme: reduce a repeated ZNS check
  2024-05-02  8:44       ` Kanchan Joshi
@ 2024-05-03  7:38         ` Sagi Grimberg
  0 siblings, 0 replies; 8+ messages in thread
From: Sagi Grimberg @ 2024-05-03  7:38 UTC (permalink / raw)
  To: Kanchan Joshi, Christoph Hellwig; +Cc: kbusch, linux-nvme



On 5/2/24 11:44, Kanchan Joshi wrote:
> On 5/2/2024 12:43 PM, Christoph Hellwig wrote:
>> Not sure there is much of a point do de-duplicate two instances of
>> compile time condition + trivial const comparison?
>>
> I also don't see it as a [micro] optimization. But this if condition
> seemed too long to be present twice.

Seems a bit redundant to me.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-05-03  7:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20240502064149epcas5p4be127b8e22874b76bb41ce25c29263f9@epcas5p4.samsung.com>
2024-05-02  6:34 ` [PATCH 0/2] cleanup Kanchan Joshi
2024-05-02  6:34   ` [PATCH 1/2] nvme: remove sgs and sws Kanchan Joshi
2024-05-02  7:12     ` Christoph Hellwig
2024-05-03  7:36     ` Sagi Grimberg
2024-05-02  6:34   ` [PATCH 2/2] nvme: reduce a repeated ZNS check Kanchan Joshi
2024-05-02  7:13     ` Christoph Hellwig
2024-05-02  8:44       ` Kanchan Joshi
2024-05-03  7:38         ` Sagi Grimberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox