summaryrefslogtreecommitdiff
path: root/pm/power.d/readahead
blob: 36369092c282f4bf2add71f5a3409c76d10c2150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

[ -x /sbin/blockdev ] || exit $NA

# more readahead = (hopefully) less hard drive activity.
# less readahead = less trashing the page cache.

readahead() {
    # the intent here is to iterate through all filesystems
    # mounted on a local block device. It Works For The Maintainer(tm).
    # More sophistication in figuring out what exactly is a local block device
    # would be welcome.
    for dev in $(awk '/^\/dev\// {print $1}'</etc/mtab); do
	/sbin/blockdev --setfra $1 "$dev"
    done
}

case $1 in
    true) readahead 3072 ;;
    false) readahead 256 ;;
    *) exit $NA ;;
esac

exit 0