From ded3b131f51ba3aa64536019c4bfb0cb7a0df58b Mon Sep 17 00:00:00 2001 From: Victor Lowther Date: Wed, 23 Jul 2008 21:29:27 -0500 Subject: Added powersave hook to change journal commit interval --- pm/power.d/Makefile.am | 3 ++- pm/power.d/journal-commit | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 pm/power.d/journal-commit 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 + -- cgit v1.2.3