/usr/lib/pm-utils/power.d/xfs_buffer is in pm-utils 1.4.1-13.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #!/bin/sh
. "${PM_FUNCTIONS}"
XFS="/proc/sys/fs/xfs"
xfsfiles="age_buffer_centisecs xfssyncd_centisecs xfsbufd_centisecs"
XFS_AGE_BUFFER=${XFS_AGE_BUFFER:-60000}
XFS_BUFD=${XFS_BUFD:-3000}
XFS_SYNCD=${XFS_SYNCD:-60000}
help() {
cat <<EOF
--------
$0: XFS filesystem buffer control hook.
This hook tries to save power by tuning any XFS filesystems to delay writing
dirty metadata. It only takes effect on battery, when the system switches
to AC power it will restore the kernel defaults.
This hook has 3 parameters:
XFS_AGE_BUFFER = How old an XFS filesystem buffer can be before it is flushed.
Defaults to 60000, or 10 minutes (600 seconds)
XFS_BUFD = How often XFS will scan for dirty metadata to flush it.
Defaults to 3000, or 30 seconds.
XFS_SYNCD = How often an XFS filesystem will perform other filesystem
Defaults to 60000, or 10 minutes.
EOF
}
[ -f $XFS/age_buffer_centisecs ] || exit $NA
read_values() {
for f in $xfsfiles; do
[ -r "$XFS/$f" ] && cat "$XFS/$f" || echo 0
done
}
write_values() {
for f in $xfsfiles; do
[ -w "$XFS/$f" ] && echo $1 > "$XFS/$f"
shift
done
}
# Why does XFS have its own parameters instead of just using the
# VM subsystem ones? Only SGI knows...
xfs_ac() {
if state_exists xfs_buffer_default; then
write_values $(restorestate xfs_buffer_default)
else
write_values 1500 3000 100
fi
}
xfs_battery() {
state_exists xfs_buffer_default || \
read_values |savestate xfs_buffer_default
write_values "$XFS_AGE_BUFFER" "$XFS_SYNCD" "$XFS_BUFD"
}
case $1 in
true) xfs_battery ;;
false) xfs_ac ;;
help) help;;
*) exit $NA ;;
esac
exit 0
|