All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] nvme-core: increamental cleanup
@ 2020-09-30 23:24 Chaitanya Kulkarni
  2020-09-30 23:24 ` [PATCH 1/2] nvme-core: remove extra variable Chaitanya Kulkarni
  2020-09-30 23:24 ` [PATCH 2/2] nvme-core: remove extra condition for vwc Chaitanya Kulkarni
  0 siblings, 2 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2020-09-30 23:24 UTC (permalink / raw)
  To: linux-nvme; +Cc: hch, Chaitanya Kulkarni, sagi

Hi,

This is an increamental cleanup which was discussed during review of
"refactor the nvme scanning and validation code " [1]. This fixes minor
nits in nvme_validate_ns() and nvme_set_queue_limits().

Regards,
Chaitanya

[1] http://lists.infradead.org/pipermail/linux-nvme/2020-September/019886.html

Chaitanya Kulkarni (2):
  nvme-core: remove extra variable
  nvme-core: remove extra condition for vwc

 drivers/nvme/host/core.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

-- 
2.22.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [PATCH 1/2] nvme-core: remove extra variable
  2020-09-30 23:24 [PATCH 0/2] nvme-core: increamental cleanup Chaitanya Kulkarni
@ 2020-09-30 23:24 ` Chaitanya Kulkarni
  2020-09-30 23:24 ` [PATCH 2/2] nvme-core: remove extra condition for vwc Chaitanya Kulkarni
  1 sibling, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2020-09-30 23:24 UTC (permalink / raw)
  To: linux-nvme; +Cc: hch, Chaitanya Kulkarni, sagi

In nvme_validate_ns() the exra variable ctrl is used only twice.
Using ns->ctrl directly still maintains the redability and original
length of the lines in the code. Get rid of the extra variable ctrl &
use ns->ctrl directly.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/nvme/host/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 96dc87ea07b3..9a565096e072 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3931,20 +3931,19 @@ static void nvme_ns_remove_by_nsid(struct nvme_ctrl *ctrl, u32 nsid)
 
 static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_ids *ids)
 {
-	struct nvme_ctrl *ctrl = ns->ctrl;
 	struct nvme_id_ns *id;
 	int ret = -ENODEV;
 
 	if (test_bit(NVME_NS_DEAD, &ns->flags))
 		goto out;
 
-	ret = nvme_identify_ns(ctrl, ns->head->ns_id, ids, &id);
+	ret = nvme_identify_ns(ns->ctrl, ns->head->ns_id, ids, &id);
 	if (ret)
 		goto out;
 
 	ret = -ENODEV;
 	if (!nvme_ns_ids_equal(&ns->head->ids, ids)) {
-		dev_err(ctrl->device,
+		dev_err(ns->ctrl->device,
 			"identifiers changed for nsid %d\n", ns->head->ns_id);
 		goto out_free_id;
 	}
-- 
2.22.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [PATCH 2/2] nvme-core: remove extra condition for vwc
  2020-09-30 23:24 [PATCH 0/2] nvme-core: increamental cleanup Chaitanya Kulkarni
  2020-09-30 23:24 ` [PATCH 1/2] nvme-core: remove extra variable Chaitanya Kulkarni
@ 2020-09-30 23:24 ` Chaitanya Kulkarni
  2020-10-01 18:06   ` Keith Busch
  1 sibling, 1 reply; 4+ messages in thread
From: Chaitanya Kulkarni @ 2020-09-30 23:24 UTC (permalink / raw)
  To: linux-nvme; +Cc: hch, Chaitanya Kulkarni, sagi

In nvme_set_queue_limits() we initialize vwc to false and later add
a condition to set vwc true. The value of the vwc can be declare
initialized which makes all the blk_queue_XXX() calls uniform.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/nvme/host/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 9a565096e072..611bd43c454c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1970,7 +1970,7 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)
 static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
 		struct request_queue *q)
 {
-	bool vwc = false;
+	bool vwc = ctrl->vwc & NVME_CTRL_VWC_PRESENT ? true : false;
 
 	if (ctrl->max_hw_sectors) {
 		u32 max_segments =
@@ -1982,8 +1982,6 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
 	}
 	blk_queue_virt_boundary(q, NVME_CTRL_PAGE_SIZE - 1);
 	blk_queue_dma_alignment(q, 7);
-	if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
-		vwc = true;
 	blk_queue_write_cache(q, vwc, vwc);
 }
 
-- 
2.22.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH 2/2] nvme-core: remove extra condition for vwc
  2020-09-30 23:24 ` [PATCH 2/2] nvme-core: remove extra condition for vwc Chaitanya Kulkarni
@ 2020-10-01 18:06   ` Keith Busch
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2020-10-01 18:06 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: hch, linux-nvme, sagi

On Wed, Sep 30, 2020 at 04:24:47PM -0700, Chaitanya Kulkarni wrote:
> @@ -1970,7 +1970,7 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)
>  static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
>  		struct request_queue *q)
>  {
> -	bool vwc = false;
> +	bool vwc = ctrl->vwc & NVME_CTRL_VWC_PRESENT ? true : false;

No need for a ternary here. It can just be:

	bool vwc = ctrl->vwc & NVME_CTRL_VWC_PRESENT;

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

end of thread, other threads:[~2020-10-01 18:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30 23:24 [PATCH 0/2] nvme-core: increamental cleanup Chaitanya Kulkarni
2020-09-30 23:24 ` [PATCH 1/2] nvme-core: remove extra variable Chaitanya Kulkarni
2020-09-30 23:24 ` [PATCH 2/2] nvme-core: remove extra condition for vwc Chaitanya Kulkarni
2020-10-01 18:06   ` Keith Busch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.