Skip to contentSkip to conversation

GFS2: Add LED support to GFS2

PATCH Steven Whitehouse 4 participants 12 messages Jul 22, 2009 – Jul 31, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Quoted 1 line

From e1fac35b9c2af276473db50fae581ef56626240c Mon Sep 17 00:00:00 2001

From: Steven Whitehouse <[email protected]>
Date: Wed, 22 Jul 2009 11:40:16 +0100
Subject: [PATCH] GFS2: Add LED support to GFS2

This adds a standalone module which uses the GFS2 tracepoints as a hook to provide LED trigger events. Events can be sent when glocks change state, when glock demote requests are received (both local and remote events are included) and also when the log is flushed.

The log flush event lights the LED during the duration of the log flush event. The other two triggers light the LED for 1/10th second after the event has occurred.

I've tested this by using GFS2 in "nolock" mode on my laptop by getting it to flash the thinkpad battery LED on the various events and verified that it occurs when expected.

One possible future development is to introduce an event for filesystem errors, but that is not included in the current patch.

There is currently no way to filter events per-filesystem so events will be reported for all GFS2 filesystems which are mounted.

drivers/leds/Kconfig +3 -0
index 7c8e712..5dc598e 100644
@@ -297,4 +297,7 @@ config LEDS_TRIGGER_DEFAULT_ON
 comment "iptables trigger is under Netfilter config (LED target)"
 	depends on LEDS_TRIGGERS
 
+comment "The gfs2 events trigger is under the File systems config"
+	depends on LEDS_TRIGGERS
+
 endif # NEW_LEDS
fs/gfs2/Kconfig +11 -0
index 5971359..d6ad86f 100644
@@ -36,3 +36,14 @@ config GFS2_FS_LOCKING_DLM
 	  Most users of GFS2 will require this. It provides the locking
 	  interface between GFS2 and the DLM, which is required to use GFS2
 	  in a cluster environment.
+
+config GFS2_FS_LEDS
+	tristate "GFS2 Event LED Driver"
+	depends on GFS2_FS && LEDS_TRIGGERS
+	help
+	 A driver which allows various interesting GFS2 filesystem events
+	 to trigger LEDs via the LED subsystem. Currently available events
+	 are glock activity, glock demote requests and log flushing. The
+	 LEDs are configured the /sys/class/leds/*/trigger files.
+
+
fs/gfs2/Makefile +1 -1
index 3da2f1f..b3f1117 100644
@@ -7,4 +7,4 @@ gfs2-y := acl.o bmap.o dir.o eaops.o eattr.o glock.o \
 	recovery.o rgrp.o super.o sys.o trans.o util.o
 
 gfs2-$(CONFIG_GFS2_FS_LOCKING_DLM) += lock_dlm.o
-
+obj-$(CONFIG_GFS2_FS_LEDS) += ledtrig-gfs2.o
fs/gfs2/ledtrig-gfs2.c new file +124 -0

124 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 4 lines · Steven Whitehouse

One possible future development is to introduce an event for filesystem errors, but that is not included in the current patch.

I like the idea, but it would be nicer if this was a generic interface into which all file systems can hook into.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#2 lore raw

Hi,

Quoted 11 lines · Andi Kleen
Quoted 4 lines · Steven Whitehouse

One possible future development is to introduce an event for filesystem errors, but that is not included in the current patch.

I like the idea, but it would be nicer if this was a generic interface into which all file systems can hook into.

-Andi

It would be difficult to make that generic since the errors and the resulting actions which can be taken vary from fs to fs. The main reason that I didn't do it at this point in time is that the GFS2 error handling needs revising anyway, and once that is done (probably with an errors= option similar to ext2/3/4) it might be possible to think about LED support for that,

Steve.

#3 lore raw
Quoted 6 lines

It would be difficult to make that generic since the errors and the resulting actions which can be taken vary from fs to fs. The main reason that I didn't do it at this point in time is that the GFS2 error handling needs revising anyway, and once that is done (probably with an errors= option similar to ext2/3/4) it might be possible to think about LED support for that,

I was thinking to have a couple of generic functions like:

log_activity()
error_happened()

...

that everyone could call.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#4 lore raw

Hi,

Quoted 9 lines · Andi Kleen
Quoted 6 lines

It would be difficult to make that generic since the errors and the resulting actions which can be taken vary from fs to fs. The main reason that I didn't do it at this point in time is that the GFS2 error handling needs revising anyway, and once that is done (probably with an errors= option similar to ext2/3/4) it might be possible to think about LED support for that,

I was thinking to have a couple of generic functions like:

Quoted 10 lines

log_activity()
error_happened()

...

that everyone could call.

-Andi

Indeed, but we'd need to allow for different classes of activity or errors, and then filtering them per-LED. With my proposed patch that is avoided due to having a small number of triggers on the different events, so selecting the trigger acts as a filter on the event type.

So I guess what I'm really getting at, is what would the user interface be for this scheme to set up the LEDs?

I did consider adding a feature to filter events on a per superblock basis, but I decided against it in the end, as it seemed to be making things too complicated (how should we specify the superblock? what should the user interface be?).

Maybe there is an easy way to do that which I've not spotted...

Steve.

#5 lore raw
Quoted 4 lines

I did consider adding a feature to filter events on a per superblock basis, but I decided against it in the end, as it seemed to be making things too complicated (how should we specify the superblock? what should the user interface be?).

Maybe key on mount points? (so passing vfsmnts)

So have some sysfs file where you echo mount points into to enable LED activity.

Ok that would be a little clumpsy for a "10 million bind mounts" case, but presumably that's very rare and they can still make it work.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#6 lore raw

Hi,

Quoted 7 lines · Andi Kleen
Quoted 4 lines

I did consider adding a feature to filter events on a per superblock basis, but I decided against it in the end, as it seemed to be making things too complicated (how should we specify the superblock? what should the user interface be?).

Maybe key on mount points? (so passing vfsmnts)

That might be an issue though... there might be multiple super blocks for a single mount point I think. We could try specifying devices instead, but there might be multiple devices for one fs.

We can't hold refs to the vfsmnts since that would prevent umount, so we'd need to get notified at umount time so that we can clear old entries from the list. Matching on devices might just resolve this, but its no good when device numbers are not stable, which would make configuration a pain across a cluster.

What was a simple patch is rapidly becoming rather complicated :(

Quoted 3 lines

So have some sysfs file where you echo mount points into to enable LED activity.

Yes, the real issue is where to put them. I'm not sure if we can add them into the LED sysfs files which where they probably ought to live. Richard, what do you think?

Quoted 5 lines

Ok that would be a little clumpsy for a "10 million bind mounts" case, but presumably that's very rare and they can still make it work.

-Andi

I suspect that it will become less rare as time goes on.

So whilst I'd also like a more generic feature, I'm still not entirely convinced that it would be a better solution yet,

Steve.

#7 lore raw
Quoted 3 lines · Steven Whitehouse

That might be an issue though... there might be multiple super blocks for a single mount point I think. We could try specifying devices instead, but there might be multiple devices for one fs.

Yes also e.g. for log activity or error it will be probably hard to always get back to the vfsmnt. Perhaps wasn't that hot an idea. Probably would need to key on sbs internally. As a user interface it still has some promise I think though.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#8 lore raw
In reply to Andi Kleen
Quoted 5 lines · Andi Kleen

So have some sysfs file where you echo mount points into to enable LED activity.

Ok that would be a little clumpsy for a "10 million bind mounts" case, but presumably that's very rare and they can still make it work.

Might be interesting for a file server, allow for a Connection-Machine style front panel... ;)

#9 lore raw
In reply to Steven Whitehouse
Quoted 11 lines · Steven Whitehouse
Quoted 1 line

From e1fac35b9c2af276473db50fae581ef56626240c Mon Sep 17 00:00:00 2001

From: Steven Whitehouse <[email protected]>
Date: Wed, 22 Jul 2009 11:40:16 +0100
Subject: [PATCH] GFS2: Add LED support to GFS2

This adds a standalone module which uses the GFS2 tracepoints as a hook to provide LED trigger events. Events can be sent when glocks change state, when glock demote requests are received (both local and remote events are included) and also when the log is flushed.

Quoted 7 lines

The log flush event lights the LED during the duration of the log flush event. The other two triggers light the LED for 1/10th second after the event has occurred.

I've tested this by using GFS2 in "nolock" mode on my laptop by getting it to flash the thinkpad battery LED on the various events and verified that it occurs when expected.

This looks way too specialized to me. Yes, it will be pretty, but... there's about 100000 possible triggers. Where do we draw a line? Or do we merge all of them?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#10 lore raw

Hi,

Quoted 16 lines · Pavel Machek
Quoted 15 lines · Steven Whitehouse
Quoted 1 line

From e1fac35b9c2af276473db50fae581ef56626240c Mon Sep 17 00:00:00 2001

From: Steven Whitehouse <[email protected]>
Date: Wed, 22 Jul 2009 11:40:16 +0100
Subject: [PATCH] GFS2: Add LED support to GFS2

This adds a standalone module which uses the GFS2 tracepoints as a hook to provide LED trigger events. Events can be sent when glocks change state, when glock demote requests are received (both local and remote events are included) and also when the log is flushed.

The log flush event lights the LED during the duration of the log flush event. The other two triggers light the LED for 1/10th second after the event has occurred.

Quoted 8 lines
Quoted 3 lines

I've tested this by using GFS2 in "nolock" mode on my laptop by getting it to flash the thinkpad battery LED on the various events and verified that it occurs when expected.

This looks way too specialized to me. Yes, it will be pretty, but... there's about 100000 possible triggers. Where do we draw a line? Or do we merge all of them?
Pavel

There might be a lot of possible triggers, but that doesn't mean there are actually a lot of actual triggers. Surely what makes the LED subsystem useful is that is can show a wide variety of events?

If there is an issue, then it seems to me, its the way in which we enumerate the events, not that there are "too many" per se. If you have a rack of machines in a data center it might be very useful to be able to instantly check the visual status of an important parameter using the LEDs. Likewise it would be similarly useful if someone was to use GFS2 in an embedded environment where LEDs are often the sum total of the user interface.

Whether or not it is merged ought to be down to whether it affects anything else (which is doesn't as it is self-contained) whether the code is maintainable, and whether it makes sense as a feature I think.

Steve.

#11 lore raw
Quoted 23 lines · Steven Whitehouse

Hi,

Quoted 20 lines · Pavel Machek
Quoted 18 lines · Steven Whitehouse
Quoted 1 line

From e1fac35b9c2af276473db50fae581ef56626240c Mon Sep 17 00:00:00 2001

From: Steven Whitehouse <[email protected]>
Date: Wed, 22 Jul 2009 11:40:16 +0100
Subject: [PATCH] GFS2: Add LED support to GFS2

This adds a standalone module which uses the GFS2 tracepoints as a hook to provide LED trigger events. Events can be sent when glocks change state, when glock demote requests are received (both local and remote events are included) and also when the log is flushed.

The log flush event lights the LED during the duration of the log flush event. The other two triggers light the LED for 1/10th second after the event has occurred.

I've tested this by using GFS2 in "nolock" mode on my laptop by getting it to flash the thinkpad battery LED on the various events and verified that it occurs when expected.

Quoted 7 lines
Quoted 3 lines

This looks way too specialized to me. Yes, it will be pretty, but... there's about 100000 possible triggers. Where do we draw a line? Or do we merge all of them?

There might be a lot of possible triggers, but that doesn't mean there are actually a lot of actual triggers. Surely what makes the LED subsystem useful is that is can show a wide variety of events?

Well... OTOH if someone wants his led to trigger to the beat of music, will we add such triggers? And another trigger for "ext2 is full" event? And another for "ext3 is full"?

Quoted 3 lines

Whether or not it is merged ought to be down to whether it affects anything else (which is doesn't as it is self-contained) whether the code is maintainable, and whether it makes sense as a feature I think.

Perhaps GFS should get and interface where it passes the events to the userland, and userland should toggle the LEDs? That way, you can select which exact events you are interested in, and how long after the event occured the LED should be lit...
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html