summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-07-23 21:29:27 -0500
committerVictor Lowther <victor.lowther@gmail.com>2010-06-05 13:38:38 -0500
commitded3b131f51ba3aa64536019c4bfb0cb7a0df58b (patch)
treeb928f15ec05469a6f93c50c7d69f82ea05c98d40
parenta262ed4c23199e6c42c19dd6fea423d72b78a15a (diff)
Added powersave hook to change journal commit interval
-rw-r--r--pm/power.d/Makefile.am3
-rw-r--r--pm/power.d/journal-commit38
2 files changed, 40 insertions, 1 deletions
diff --git a/pm/power.d/Makefile.am b/pm/power.d/Makefile.am
index 8d39ed9..a3850e3 100644
--- a/pm/power.d/Makefile.am
+++ b/pm/power.d/Makefile.am
@@ -7,7 +7,8 @@ power_SCRIPTS = \
xfs_buffer \
readahead \
intel-audio-powersave \
- wireless
+ wireless \
+ journal-commit
EXTRA_DIST=$(power_SCRIPTS)
diff --git a/pm/power.d/journal-commit b/pm/power.d/journal-commit
new file mode 100644
index 0000000..be68fed
--- /dev/null
+++ b/pm/power.d/journal-commit
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+. ${PM_FUNCTIONS}
+
+# actually remount the file system
+remount_fs()
+{
+ # $1 = filesystem to remount
+ # $2 = mount option to change
+ mount -o remount,$2 $1
+}
+
+# invoked on an ext3 file system
+handle_ext3()
+{
+ # $1 = filesystem to remount
+ # $2 = commit time
+ remount_fs $1 "commit=${2}"
+}
+
+handle_filesystems()
+{
+ # $1 = new journal commit time in seconds
+ while read DEV MOUNT FSTYPE REST;
+ do
+ command_exists "handle_${FSTYPE}" || continue
+ "handle_${FSTYPE}" $MOUNT $1
+ done < /proc/mounts
+}
+
+case $1 in
+ true) handle_filesystems 600 ;;
+ false) handle_filesystems 5 ;;
+ *) exit $NA ;;
+esac
+
+exit 0
+