All of lore.kernel.org
 help / color / mirror / Atom feed
* stop poking into the request queue in nvmet
@ 2022-09-27 12:09 Christoph Hellwig
  2022-09-27 12:09 ` [PATCH 1/2] nvmet: don't look at the request_queue in nvmet_bdev_zone_mgmt_emulate_all Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christoph Hellwig @ 2022-09-27 12:09 UTC (permalink / raw)
  To: Sagi Grimberg, Chaitanya Kulkarni; +Cc: linux-nvme

Just some minor cleanups for now.

Diffstat:
 io-cmd-bdev.c |   11 +++++------
 zns.c         |    3 +--
 2 files changed, 6 insertions(+), 8 deletions(-)


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

* [PATCH 1/2] nvmet: don't look at the request_queue in nvmet_bdev_zone_mgmt_emulate_all
  2022-09-27 12:09 stop poking into the request queue in nvmet Christoph Hellwig
@ 2022-09-27 12:09 ` Christoph Hellwig
  2022-09-28  6:45   ` Sagi Grimberg
  2022-09-27 12:09 ` [PATCH 2/2] nvmet: don't look at the request_queue in nvmet_bdev_set_limits Christoph Hellwig
  2022-09-27 16:03 ` stop poking into the request queue in nvmet Keith Busch
  2 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2022-09-27 12:09 UTC (permalink / raw)
  To: Sagi Grimberg, Chaitanya Kulkarni; +Cc: linux-nvme

nvmet is a consumer of the block layer and should not directly look at
the request_queue.  Just use the NUMA node ID from the gendisk instead of
the request_queue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/target/zns.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c
index c7ef69f29fe4e..7e89056cc4116 100644
--- a/drivers/nvme/target/zns.c
+++ b/drivers/nvme/target/zns.c
@@ -387,7 +387,6 @@ static u16 nvmet_bdev_zone_mgmt_emulate_all(struct nvmet_req *req)
 {
 	struct block_device *bdev = req->ns->bdev;
 	unsigned int nr_zones = bdev_nr_zones(bdev);
-	struct request_queue *q = bdev_get_queue(bdev);
 	struct bio *bio = NULL;
 	sector_t sector = 0;
 	int ret;
@@ -396,7 +395,7 @@ static u16 nvmet_bdev_zone_mgmt_emulate_all(struct nvmet_req *req)
 	};
 
 	d.zbitmap = kcalloc_node(BITS_TO_LONGS(nr_zones), sizeof(*(d.zbitmap)),
-				 GFP_NOIO, q->node);
+				 GFP_NOIO, bdev->bd_disk->node_id);
 	if (!d.zbitmap) {
 		ret = -ENOMEM;
 		goto out;
-- 
2.30.2



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

* [PATCH 2/2] nvmet: don't look at the request_queue in nvmet_bdev_set_limits
  2022-09-27 12:09 stop poking into the request queue in nvmet Christoph Hellwig
  2022-09-27 12:09 ` [PATCH 1/2] nvmet: don't look at the request_queue in nvmet_bdev_zone_mgmt_emulate_all Christoph Hellwig
@ 2022-09-27 12:09 ` Christoph Hellwig
  2022-09-28  6:45   ` Sagi Grimberg
  2022-09-27 16:03 ` stop poking into the request queue in nvmet Keith Busch
  2 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2022-09-27 12:09 UTC (permalink / raw)
  To: Sagi Grimberg, Chaitanya Kulkarni; +Cc: linux-nvme

nvmet is a consumer of the block layer and should not directly look at
the request_queue.  Use the bdev_ helpers to retrieve the device limits
instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/target/io-cmd-bdev.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index 8d527a8c0f542..c2d6cea0236b0 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -12,11 +12,9 @@
 
 void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id)
 {
-	const struct queue_limits *ql = &bdev_get_queue(bdev)->limits;
-	/* Number of logical blocks per physical block. */
-	const u32 lpp = ql->physical_block_size / ql->logical_block_size;
 	/* Logical blocks per physical block, 0's based. */
-	const __le16 lpp0b = to0based(lpp);
+	const __le16 lpp0b = to0based(bdev_physical_block_size(bdev) /
+				      bdev_logical_block_size(bdev));
 
 	/*
 	 * For NVMe 1.2 and later, bit 1 indicates that the fields NAWUN,
@@ -42,11 +40,12 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id)
 	/* NPWA = Namespace Preferred Write Alignment. 0's based */
 	id->npwa = id->npwg;
 	/* NPDG = Namespace Preferred Deallocate Granularity. 0's based */
-	id->npdg = to0based(ql->discard_granularity / ql->logical_block_size);
+	id->npdg = to0based(bdev_discard_granularity(bdev) /
+			    bdev_logical_block_size(bdev));
 	/* NPDG = Namespace Preferred Deallocate Alignment */
 	id->npda = id->npdg;
 	/* NOWS = Namespace Optimal Write Size */
-	id->nows = to0based(ql->io_opt / ql->logical_block_size);
+	id->nows = to0based(bdev_io_opt(bdev) / bdev_logical_block_size(bdev));
 }
 
 void nvmet_bdev_ns_disable(struct nvmet_ns *ns)
-- 
2.30.2



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

* Re: stop poking into the request queue in nvmet
  2022-09-27 12:09 stop poking into the request queue in nvmet Christoph Hellwig
  2022-09-27 12:09 ` [PATCH 1/2] nvmet: don't look at the request_queue in nvmet_bdev_zone_mgmt_emulate_all Christoph Hellwig
  2022-09-27 12:09 ` [PATCH 2/2] nvmet: don't look at the request_queue in nvmet_bdev_set_limits Christoph Hellwig
@ 2022-09-27 16:03 ` Keith Busch
  2 siblings, 0 replies; 6+ messages in thread
From: Keith Busch @ 2022-09-27 16:03 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Sagi Grimberg, Chaitanya Kulkarni, linux-nvme

Looks good.

Reviewed-by: Keith Busch <kbusch@kernel.org>


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

* Re: [PATCH 1/2] nvmet: don't look at the request_queue in nvmet_bdev_zone_mgmt_emulate_all
  2022-09-27 12:09 ` [PATCH 1/2] nvmet: don't look at the request_queue in nvmet_bdev_zone_mgmt_emulate_all Christoph Hellwig
@ 2022-09-28  6:45   ` Sagi Grimberg
  0 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2022-09-28  6:45 UTC (permalink / raw)
  To: Christoph Hellwig, Chaitanya Kulkarni; +Cc: linux-nvme

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


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

* Re: [PATCH 2/2] nvmet: don't look at the request_queue in nvmet_bdev_set_limits
  2022-09-27 12:09 ` [PATCH 2/2] nvmet: don't look at the request_queue in nvmet_bdev_set_limits Christoph Hellwig
@ 2022-09-28  6:45   ` Sagi Grimberg
  0 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2022-09-28  6:45 UTC (permalink / raw)
  To: Christoph Hellwig, Chaitanya Kulkarni; +Cc: linux-nvme

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


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

end of thread, other threads:[~2022-09-28  6:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27 12:09 stop poking into the request queue in nvmet Christoph Hellwig
2022-09-27 12:09 ` [PATCH 1/2] nvmet: don't look at the request_queue in nvmet_bdev_zone_mgmt_emulate_all Christoph Hellwig
2022-09-28  6:45   ` Sagi Grimberg
2022-09-27 12:09 ` [PATCH 2/2] nvmet: don't look at the request_queue in nvmet_bdev_set_limits Christoph Hellwig
2022-09-28  6:45   ` Sagi Grimberg
2022-09-27 16:03 ` stop poking into the request queue in nvmet 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.