mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Enzo Matsumiya <ematsumiya@suse.de>
To: linux-nvme@lists.infradead.org
Cc: Enzo Matsumiya <ematsumiya@suse.de>,
	Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] nvme-pci: trigger disk activity LED
Date: Sun, 27 Feb 2022 20:42:58 -0300	[thread overview]
Message-ID: <20220227234258.24619-1-ematsumiya@suse.de> (raw)

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@suse.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


             reply	other threads:[~2022-02-27 23:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-27 23:42 Enzo Matsumiya [this message]
2022-02-28  9:22 ` Christoph Hellwig
2022-02-28 13:58   ` Jens Axboe
2022-03-01  3:30     ` Enzo Matsumiya
2022-03-01  3:36       ` Jens Axboe
2025-11-10  9:44       ` Ming Lei
2025-11-10  8:27     ` Scar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220227234258.24619-1-ematsumiya@suse.de \
    --to=ematsumiya@suse.de \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®