summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
+