~ubuntu-branches/ubuntu/trusty/pm-utils/trusty-updates

« back to all changes in this revision

Viewing changes to .pc/91-xfs-buffer.patch/pm/power.d/xfs_buffer

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2012-01-11 15:26:02 UTC
  • Revision ID: package-import@ubuntu.com-20120111152602-zpohz0e26h65vbv8
Tags: 1.4.1-8+git1
Upload current Debian packaging GIT head (patches still need to be discussed
with Debian/upstream before doing a Debian upload).

* Add 26-inhibit-on-right-status.patch: Do not use the exit status of log
  rather the exit status of the hook thereby allowing inhibit to work.
  Thanks to Ariel Cornejo for the patch! (LP: #665651)
* Add 01_xfs_buffer_arguments.patch: pm/power.d/xfs_buffer: Fix wrong
  argument ordering. Thanks to Andre Draszik for the patch!
  (LP: #645974)
* debian/rules: Remove the journal-commit and readahead scripts. Recent
  measurements have shown that they do not save any power in different
  workloads on rotary disks, and in fact increase power usage on SSD.
  (fd.o #44627, LP: #900923)
* Add debian/power.d/{pci_devices,usb_bluetooth}: Set USB bluetooth to
  autosuspend and a safe subclass of PCI devices to low-power mode during
  powersafe mode. (fd.o #44672, LP: #911325)

Show diffs side-by-side

added added

removed removed

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