Package: laptop-mode-tools
Version: 1.05-1
Severity: normal
laptop_mode implements the READAHEAD setting by running blockdev with
the --setra option for each block-device underlying a mounted
file-system. This in turn appears to use the BLKRASET ioctl. In
Linux 2.6 this ioctl this has the desired effect. In Linux 2.4 it
appears to set the number of blocks to read-ahead on the *device* as
opposed to within a *file*, and the maximum value of this number is
255. As a result the invocation of blockdev will fail on Linux 2.4
for any usefully large value of READAHEAD, and will not in any case
have the desired affect for fragmented files. Unhelpfully,
laptop_mode redirects its error message to /dev/null so this is not
reported anywhere.
laptop_mode should instead use the BLKFRASET ioctl, which is the same
as BLKRASET on 2.6 and also works properly on 2.4 for IDE devices (but
unfortunately no others). If there is no command that exposes this
ioctl, laptop_mode could instead write this setting through the /proc
filesystem:
# Find the major device name and test whether it's IDE.
read major minor < <(stat -c "0x%t 0x%T" "$DEV")
major_name="$(awk "BEGIN { block=0 }; /^Block / { block=1 }; /^ *$(($major))/ {
if (block) print \$2 }" /proc/devices)"
if [ "x${major_name#ide}" != "x$major_name" ]; then
# Find the device's settings file.
if [ $(($minor)) -lt 64 ]; then
drive_letters=acegikmoqsuwy
else
drive_letters=bdfhjlnprtvxz
fi
drive_settings=$(echo /proc/ide/$major_name/hd[$drive_letters]/settings)
if [ -f "$drive_settings" ]; then
echo file_readahead:$READAHEAD >$drive_settings
else
: # TODO: log error
fi
else
: # TODO: log error
fi
(This obviously only works for IDE devices, so should be used only
under 2.4 where there is no better alternative.)
-- System Information:
Debian Release: 3.1
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.27-2-686
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Versions of packages laptop-mode-tools depends on:
ii powermgmt-base 1.22 Common utils and configs for power
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]