* [PATCH V2 0/2] nvme-core: increamental cleanup
@ 2020-10-01 18:54 Chaitanya Kulkarni
2020-10-01 18:54 ` [PATCH V2 1/2] nvme-core: remove extra variable Chaitanya Kulkarni
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Chaitanya Kulkarni @ 2020-10-01 18:54 UTC (permalink / raw)
To: linux-nvme; +Cc: kbusch, 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
* Changes from V1 :-
1. Remove the use of ternery operator in the second patch.
[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] 5+ messages in thread
* [PATCH V2 1/2] nvme-core: remove extra variable
2020-10-01 18:54 [PATCH V2 0/2] nvme-core: increamental cleanup Chaitanya Kulkarni
@ 2020-10-01 18:54 ` Chaitanya Kulkarni
2020-10-01 18:54 ` [PATCH V2 2/2] nvme-core: remove extra condition for vwc Chaitanya Kulkarni
2020-10-05 12:48 ` [PATCH V2 0/2] nvme-core: increamental cleanup Christoph Hellwig
2 siblings, 0 replies; 5+ messages in thread
From: Chaitanya Kulkarni @ 2020-10-01 18:54 UTC (permalink / raw)
To: linux-nvme; +Cc: kbusch, 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] 5+ messages in thread
* [PATCH V2 2/2] nvme-core: remove extra condition for vwc
2020-10-01 18:54 [PATCH V2 0/2] nvme-core: increamental cleanup Chaitanya Kulkarni
2020-10-01 18:54 ` [PATCH V2 1/2] nvme-core: remove extra variable Chaitanya Kulkarni
@ 2020-10-01 18:54 ` Chaitanya Kulkarni
2020-10-01 20:51 ` Keith Busch
2020-10-05 12:48 ` [PATCH V2 0/2] nvme-core: increamental cleanup Christoph Hellwig
2 siblings, 1 reply; 5+ messages in thread
From: Chaitanya Kulkarni @ 2020-10-01 18:54 UTC (permalink / raw)
To: linux-nvme; +Cc: kbusch, 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..c20ce8eabe82 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;
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] 5+ messages in thread
* Re: [PATCH V2 2/2] nvme-core: remove extra condition for vwc
2020-10-01 18:54 ` [PATCH V2 2/2] nvme-core: remove extra condition for vwc Chaitanya Kulkarni
@ 2020-10-01 20:51 ` Keith Busch
0 siblings, 0 replies; 5+ messages in thread
From: Keith Busch @ 2020-10-01 20:51 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: hch, linux-nvme, sagi
On Thu, Oct 01, 2020 at 11:54:32AM -0700, Chaitanya Kulkarni wrote:
> 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.
Looks fine.
Reviewed-by: Keith Busch <kbusch@kernel.org>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 0/2] nvme-core: increamental cleanup
2020-10-01 18:54 [PATCH V2 0/2] nvme-core: increamental cleanup Chaitanya Kulkarni
2020-10-01 18:54 ` [PATCH V2 1/2] nvme-core: remove extra variable Chaitanya Kulkarni
2020-10-01 18:54 ` [PATCH V2 2/2] nvme-core: remove extra condition for vwc Chaitanya Kulkarni
@ 2020-10-05 12:48 ` Christoph Hellwig
2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-10-05 12:48 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: kbusch, hch, linux-nvme, sagi
Thanks,
applied to nvme-5.10.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-05 12:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01 18:54 [PATCH V2 0/2] nvme-core: increamental cleanup Chaitanya Kulkarni
2020-10-01 18:54 ` [PATCH V2 1/2] nvme-core: remove extra variable Chaitanya Kulkarni
2020-10-01 18:54 ` [PATCH V2 2/2] nvme-core: remove extra condition for vwc Chaitanya Kulkarni
2020-10-01 20:51 ` Keith Busch
2020-10-05 12:48 ` [PATCH V2 0/2] nvme-core: increamental cleanup Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).