[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220227234258.24619-1-ematsumiya@suse.de>
Date: Sun, 27 Feb 2022 20:42:58 -0300
From: Enzo Matsumiya <ematsumiya@...e.de>
To: linux-nvme@...ts.infradead.org
Cc: Enzo Matsumiya <ematsumiya@...e.de>,
Keith Busch <kbusch@...nel.org>, Jens Axboe <axboe@...com>,
Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>, linux-kernel@...r.kernel.org
Subject: [PATCH] nvme-pci: trigger disk activity LED
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 <ematsumiya@...e.de>
---
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
Powered by blists - more mailing lists