public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: trigger disk activity LED
@ 2022-02-27 23:42 Enzo Matsumiya
  2022-02-28  9:22 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Enzo Matsumiya @ 2022-02-27 23:42 UTC (permalink / raw)
  To: linux-nvme
  Cc: Enzo Matsumiya, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, linux-kernel, GNU/Weeb Mailing List

Users can enable an LED to indicate I/O activity on NVMe PCIe devices:

  # echo "disk-activity" > /sys/class/leds/<led>/trigger

for the composite activity, or disk-{read,write} for individual
activities/LEDs.

Signed-off-by: Enzo Matsumiya <[email protected]>
---
 drivers/nvme/host/pci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 6a99ed680915..3e49d5980beb 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/leds.h>
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
@@ -1037,6 +1038,8 @@ static __always_inline void nvme_pci_unmap_rq(struct request *req)
 			       rq_integrity_vec(req)->bv_len, rq_data_dir(req));
 	if (blk_rq_nr_phys_segments(req))
 		nvme_unmap_data(dev, req);
+
+	ledtrig_disk_activity(req_op(req) == REQ_OP_WRITE);
 }
 
 static void nvme_pci_complete_rq(struct request *req)
-- 
2.34.1



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

* Re: [PATCH] nvme-pci: trigger disk activity LED
  2022-02-27 23:42 [PATCH] nvme-pci: trigger disk activity LED Enzo Matsumiya
@ 2022-02-28  9:22 ` Christoph Hellwig
  2022-02-28 13:58   ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2022-02-28  9:22 UTC (permalink / raw)
  To: Enzo Matsumiya
  Cc: linux-nvme, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, linux-kernel, GNU/Weeb Mailing List

I don't think we should add code to the absolutel fast path for
blinkenlights.


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

* Re: [PATCH] nvme-pci: trigger disk activity LED
  2022-02-28  9:22 ` Christoph Hellwig
@ 2022-02-28 13:58   ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-02-28 13:58 UTC (permalink / raw)
  To: Christoph Hellwig, Enzo Matsumiya
  Cc: linux-nvme, Keith Busch, Jens Axboe, Sagi Grimberg, linux-kernel,
	GNU/Weeb Mailing List

On 2/28/22 2:22 AM, Christoph Hellwig wrote:
> I don't think we should add code to the absolutel fast path for
> blinkenlights.

Agree. It'd be a lot better to put the cost on the led trigger
side, and not need anything in the fast path for block devices.
Monitor disk stats, or something like that.

-- 
Jens Axboe



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

end of thread, other threads:[~2022-02-28 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-27 23:42 [PATCH] nvme-pci: trigger disk activity LED Enzo Matsumiya
2022-02-28  9:22 ` Christoph Hellwig
2022-02-28 13:58   ` Jens Axboe

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