--- readahead-fedora-1.5.6.orig/debian/README.bootchart +++ readahead-fedora-1.5.6/debian/README.bootchart @@ -0,0 +1,12 @@ +Fair comparison of bootcharts +----------------------------- + +When comparing bootcharts of different readahead implementations an +extra consideration should be taken. readahead-fedora also preloads +files that are used after the end of the rc2, which might affect the +results of a bootchart if the bootcharting program is stopped at the +end of rc2. + +In order to fairly compare bootcharts the READAHEAD_EXTRA_COLLECT +option available at /etc/default/readahead-fedora should be set to 0, +and the system re-profiled. --- readahead-fedora-1.5.6.orig/debian/changelog +++ readahead-fedora-1.5.6/debian/changelog @@ -0,0 +1,224 @@ +readahead-fedora (2:1.5.6-5.2) unstable; urgency=low + + * Non-maintainer upload. + * Switch trigger directives to noawait variants, to avoid trigger cycles. + (Closes: #768600) + + -- Guillem Jover Thu, 20 Nov 2014 00:10:05 +0100 + +readahead-fedora (2:1.5.6-5.1) unstable; urgency=low + + * Non-maintainer upload. + * Fix build problem caused by new automake (Closes: #750270). + + -- Petter Reinholdtsen Wed, 02 Jul 2014 20:50:57 +0200 + +readahead-fedora (2:1.5.6-5) unstable; urgency=low + + * Build-depend on libauparse-dev (closes: #698603) + * Drop no-longer-needed versioned build-depends and depends + * Drop some upgrade code from the postinst + * Use debian/maintscript to rm the old conffile (Closes: #659884) + Thanks to Colin Watson for the patch. + + -- Raphael Geissert Thu, 29 Aug 2013 23:30:36 +0200 + +readahead-fedora (2:1.5.6-4) unstable; urgency=low + + The "valgrind cleanup" release + + * Accurately describe the /run/readahead file + * Drop rac_dont_list_rewritten_files.patch (Closes: #654678) + * Fix multiple memory-related errors in the collector + + -- Raphael Geissert Mon, 09 Jan 2012 12:14:34 -0600 + +readahead-fedora (2:1.5.6-3) unstable; urgency=low + + * Upload to unstable + * Drop support for the splash API (Closes: #652144) + + -- Raphael Geissert Sat, 17 Dec 2011 13:20:38 -0600 + +readahead-fedora (2:1.5.6-2) experimental; urgency=low + + * Update upstream's repo URL to fix watch file + * Fix error in background-mode logic (Closes: #600494) + * Warn when auditd is installed (Closes: #575537) + * Move cron.daily script to /usr/share for reuse + * Drop support for fadvise + * Start the collector with nice priority 5 + * Remove minimum memory bit from /etc/default/readahead + * Switch to clock_gettime MONOTONIC from gettimeofday + * Sort file lists at shutdown + * Drop transitional 'readahead' package, add Conflicts + * Update standards version, no change needed + * No longer install a daily cronjob + * Add an example of how to sort the lists after dpkg is called + * Ignore files in /var/lib/exim4 + * Also exclude preload's and ifupdown's status files + * Only build the lists after profiling if not building at shutdown + * Don't audit creat(2) and truncate(2), for now + * Double the backlog size of audit events + * Do update the file size even in -d mode + * Misc optimisations to the collector + * Open files only once in readahead(8), if possible + * Update documentation + * Make build-lists script more efficient + * Transition from /dev and /lib/init/rw to /run (Closes: #633056) + + -- Raphael Geissert Thu, 14 Jul 2011 18:07:09 -0500 + +readahead-fedora (2:1.5.6-1) unstable; urgency=low + + * Build-depend on autopoint, but ease backporting (Closes: #572477) + * Update standards version, no change needed + * Wording changes/corrections on the temp file generated by the init + scripts + * Delete patches merged upstream and refresh the others + * Fix watch file + * Change the wording of the package description + * Fix a possible installation error related to dbus' directories + (Closes: 586079) + * Init scripts cleanup + * bugfixes.patch: removed, we use our own init scripts + * Don't even ship the translations in the package + * Properly remove old files from readahead-list + * Add missing dependency on misc:Depends to readahead + * Add debian/source/format, stick to 1.0 for now + * Override init.d-script-missing-dependency-on-remote_fs + * debian/rules cleanup + + -- Raphael Geissert Sat, 26 Jun 2010 13:26:48 -0500 + +readahead-fedora (2:1.5.4-5) unstable; urgency=low + + * Fix error when rc{S,2}.d exist but are empty (Closes: #564082) + * Properly escape minus sign in readahead(8) + + -- Raphael Geissert Thu, 07 Jan 2010 17:14:38 -0600 + +readahead-fedora (2:1.5.4-4) unstable; urgency=medium + + The "now I see why it takes so long to boot" release + + * Do read the file group when updating the lists + + -- Raphael Geissert Fri, 04 Dec 2009 18:37:37 -0600 + +readahead-fedora (2:1.5.4-3) unstable; urgency=medium + + * Don't preload the inodes when building the sorted files list + * Use real-time as the default I/O priority + * Move the use_fadvise patch after unsorted_custom_lists + * Allow building "optimised" lists without changing the sort order + * Refresh use_fadvise patch + * Sort by usage order when the storage device is not rotational + * Don't conflict with readahead to avoid installability issues + (Closes: #556799) + + -- Raphael Geissert Mon, 23 Nov 2009 10:06:46 -0600 + +readahead-fedora (2:1.5.4-2) unstable; urgency=low + + * Allow the user to use file-rc, don't fail at postinst (Closes: #555851) + * Assume the audit subsys is enabled if /proc/1/loginuid exists + - (Closes: #552375) + * Show a warning if couldn't make sure the audit subsys is enabled + * Add versioned dependency on dpkg for s-s-d's IO scheduling support + * Add a dummy readahead package to help users transition + * Add a hack to avoid requiring all the debian/* files to be renamed + * Set priority back to optional + + -- Raphael Geissert Fri, 13 Nov 2009 10:10:16 -0600 + +readahead-fedora (1.5.4-1) unstable; urgency=low + + * New upstream release + - Replace another filter on entry with one at exit + * Workaround bogus or weird changes made to rc*.d (Closes: #550322) + * Plug another fd and one memory leaks + + -- Raphael Geissert Thu, 15 Oct 2009 15:43:05 -0500 + +readahead-fedora (1.5.3+09100608-2) unstable; urgency=low + + * Run autogen on post-patches target, should fix the random build failures + * Move files lists from /var/lib to /etc (Closes: #548040) + + -- Raphael Geissert Fri, 09 Oct 2009 00:07:36 -0500 + +readahead-fedora (1.5.3+09100608-1) unstable; urgency=low + + * New upstream version + + Filter syscalls at their exit + + Also audit openat(2) calls + * Rename sysconfsysconfdir to sysconfdefaultdir and declare it before + * Non-Debian changes of ignore-large-files.patch merged upstream + * no_fd_leaks.patch: merged upstream, removing it + * proper-blkid-null-handling.patch: merged upstream, removing it + * Avoid leaving temp files around + * Schedule the collector when upgrading from older versions + - The openat change may add some more files to the lists + + -- Raphael Geissert Wed, 07 Oct 2009 20:36:34 -0500 + +readahead-fedora (1.5.0-6) unstable; urgency=low + + The "before major changes" release. + + * Fix segfault when blkid fails to resolve device id (Closes: #547159) + * Change priority to extra, as libaudit0 is extra + * Add some notes regarding bootcharts + * Disable i18n on readahead as it consumes more time than real gain + * Bootstrap the files lists without rebooting + * Automatically trigger the collector on next boot after installation + + -- Raphael Geissert Mon, 05 Oct 2009 00:49:23 -0500 + +readahead-fedora (1.5.0-5) unstable; urgency=low + + * Add a workaround for init script when no list exists (Closes: #546255) + * Document that CONFIG_AUDITSYSCALL is also required (Closes: #546250) + + -- Raphael Geissert Fri, 11 Sep 2009 18:34:27 -0500 + +readahead-fedora (1.5.0-4) unstable; urgency=low + + * Move early-readahead to position 03 (Closes: #544557) + * Use a subshell in the stop script to avoid delaying boot (Closes: #545526) + * Don't use heredocs during early boot to workaround bash's bug + - (Closes: #545534) + * Fix a leftover "process." word in -collector's man page + * Readahead files before starting the collector (except when + RUN_IN_BACKGROUND) + * "Stop" the stop- script on runlevel 1 instead of "start"ing it + * Conflict, Replace, and Provide readahead to ensure that only one is + installed + + -- Raphael Geissert Thu, 10 Sep 2009 12:38:26 -0500 + +readahead-fedora (1.5.0-3) unstable; urgency=low + + * Add missing dot to dh_installinit call (Closes: #543872) + + -- Raphael Geissert Thu, 27 Aug 2009 09:55:55 -0500 + +readahead-fedora (1.5.0-2) unstable; urgency=low + + * Use system limits on file paths length instead of hardcoding them + * Don't sort the custom.* lists when writing them, this allows further + analysis + * Fixed a bug where the collector enabling flag is removed on normal + shutdown + * debian/copyright: Include the instructions to download the original + upstream source code + * Bump standards version, no change needed + + -- Raphael Geissert Tue, 25 Aug 2009 20:11:29 -0500 + +readahead-fedora (1.5.0-1) unstable; urgency=low + + * Initial release. (Closes: #535025) + + -- Raphael Geissert Sat, 15 Aug 2009 12:59:22 -0500 --- readahead-fedora-1.5.6.orig/debian/compat +++ readahead-fedora-1.5.6/debian/compat @@ -0,0 +1 @@ +6 --- readahead-fedora-1.5.6.orig/debian/control +++ readahead-fedora-1.5.6/debian/control @@ -0,0 +1,26 @@ +Source: readahead-fedora +Section: admin +Priority: optional +Maintainer: Raphael Geissert +Build-Depends: debhelper (>= 8.1.0~), cdbs, quilt, e2fslibs-dev, libaudit-dev, libauparse-dev, libblkid-dev, autopoint, autoconf, automake +Standards-Version: 3.9.2 +Homepage: https://fedorahosted.org/readahead/ + +Package: readahead-fedora +Architecture: any +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, initscripts (>= 2.88dsf-13.3) +Conflicts: ureadahead, sreadahead, readahead +Provides: readahead +Replaces: readahead +Description: Fedora's implementation of readahead to preload boot process files + "readahead" is the term used to refer to a tool that preloads files in + this case used during the boot process to make the system boot faster. + . + This implementation of the tool provides the following features: + * It can take multiple lists of files to be preloaded, and sort them + according to their position on the disk. + * It preloads the inode tables on ext2-based file systems. + * It opens the files without making the system update their access + time, therefore avoiding extra disk writes. + * It uses a lightweight monitoring daemon. --- readahead-fedora-1.5.6.orig/debian/copyright +++ readahead-fedora-1.5.6/debian/copyright @@ -0,0 +1,29 @@ + +The original source code of this program can be obtained by issuing the +following command: +git clone git://git.fedorahosted.org/readahead + +Portions of this package are subject to: + + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2006, 2007, 2009 Karel Zak + Copyright (C) 2005 Ziga Mahkovec + +The portions constituting the Debian package are: + + Copyright (C) 2009 by Raphael Geissert + +The content of this package is subject to the following licence: + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +On Debian systems, the full text of the GNU GPL version 2 can be found +at /usr/share/common-licenses/GPL-2. --- readahead-fedora-1.5.6.orig/debian/dirs +++ readahead-fedora-1.5.6/debian/dirs @@ -0,0 +1,2 @@ +etc/readahead.d +usr/share/readahead-fedora --- readahead-fedora-1.5.6.orig/debian/dpkg.cfg +++ readahead-fedora-1.5.6/debian/dpkg.cfg @@ -0,0 +1,17 @@ +# Example of how to re-sort the lists used by readahead-fedora after +# dpkg is executed (either directly or via a wrapper, such as apt) +# Copy it to /etc/dpkg/dpkg.cfg.d/ with a name you recognise + +# ONLY NEEDED if you set SORT_AT_SHUTDOWN=no in /etc/default/readahead-fedora +# Otherwise, the lists will be uselessly sorted multiple times + +# deferred-run(1) is used to minimise the number of times the script is +# called. At some point it might be shipped by a package, but until +# then you can get it from: +# http://anonscm.debian.org/gitweb/?p=users/atomo64-guest/misc-devscripts.git;a=blob_plain;f=deferred-run;hb=HEAD + +# Alternatively, you can call build-lists directly, but beware it will +# be called multiple times during a normal apt upgrade operation. + +# Waiting 35 seconds is just a guess; adjust if needed +post-invoke path/to/deferred-run -w 35 -l /run/readahead-deferred -- /usr/share/readahead-fedora/build-lists --- readahead-fedora-1.5.6.orig/debian/examples +++ readahead-fedora-1.5.6/debian/examples @@ -0,0 +1 @@ +debian/dpkg.cfg --- readahead-fedora-1.5.6.orig/debian/init.d/readahead +++ readahead-fedora-1.5.6/debian/init.d/readahead @@ -0,0 +1,115 @@ +#!/bin/sh +set -e +### BEGIN INIT INFO +# Provides: @STEP@-readahead +# Required-Start: $remote_fs +# Required-Stop: +# Should-Start: mountkernfs +# X-Start-Before: udev mountdevsubfs +# Default-Start: S +# Default-Stop: +# Short-Description: init script for readahead-fedora +### END INIT INFO + +READAHEAD_CMD="/sbin/readahead" +READAHEAD_COLLECT_CMD="/sbin/readahead-collector" + +[ -x $READAHEAD_CMD ] || exit 0 + +. /lib/lsb/init-functions + +RUN_IN_BACKGROUND= +IO_PRIORITY= +MAX_FILE_SIZE= +READAHEAD_BASE=/etc/readahead.d +[ ! -f /etc/default/readahead-fedora ] || . /etc/default/readahead-fedora + +[ "${READAHEAD:-yes}" = yes ] || exit 0 + +# Exit if the collector is already running +pidof readahead-collector > /dev/null && exit + +LTYPE=@STEP@ + +if [ "$MAX_FILE_SIZE" ]; then + MAX_FILE_SIZE="-m $MAX_FILE_SIZE" +fi + +NICE_COLLECTOR="-N ${NICE_COLLECTOR:-5}" + +get_lists() { + if [ -f "$READAHEAD_BASE/$LTYPE.sorted" ]; then + printf -- "--dont-sort %s" "$READAHEAD_BASE/$LTYPE.sorted" + elif [ -s "$READAHEAD_BASE/custom.$LTYPE" ]; then + printf "%s" "$READAHEAD_BASE/custom.$LTYPE" + else + ls "$READAHEAD_BASE"/*."$LTYPE" 2>/dev/null || echo /dev/null + fi +} + +SHOULD_COLLECT=false +if test -f /.readahead_collect || grep -qw profile /proc/cmdline; then + SHOULD_COLLECT=true +fi + +case "$1" in + start|restart|force-reload) + [ -f /run/readahead ] || { + [ "$LTYPE" = early ] || { + log_warning_msg "Early readahead flag not found" + } + echo " +# This file was automatically generated by $0 +# The following lines should indicate whether the /usr and /var file systems +# were available during the early boot process. Note that these flags do not +# directly modify the behaviour of the init scripts; they are used by the +# script that sorts the files lists +MOUNTED_USR=$([ -d /usr/bin ] && echo true || echo false) +MOUNTED_VAR=$([ -d /var/lib ] && echo true || echo false) + " > /run/readahead + } + + if [ "$RUN_IN_BACKGROUND" = yes ] && ! $SHOULD_COLLECT; then + log_begin_msg "Reading $LTYPE boot files (in background)..." + if /sbin/start-stop-daemon --background --start --quiet \ + -I ${IO_PRIORITY:-idle} --exec $READAHEAD_CMD \ + -- $MAX_FILE_SIZE $(get_lists) > /dev/null; then + log_end_msg 0 + else + log_end_msg $? + fi + else + log_begin_msg "Reading $LTYPE boot files..." + if /sbin/start-stop-daemon --start --quiet \ + -I ${IO_PRIORITY:-real-time} --exec $READAHEAD_CMD \ + -- $MAX_FILE_SIZE $(get_lists) > /dev/null; then + log_end_msg 0 + else + log_end_msg $? + fi + fi + + if $SHOULD_COLLECT; then + if [ -d /proc/1 ] && [ ! -e /proc/1/loginuid ]; then + log_failure_msg "Profiling on a kernel without audit subsystem..." + exit 1 + fi + log_begin_msg "Preparing to profile boot sequence..." + if /sbin/start-stop-daemon --start --quiet $NICE_COLLECTOR \ + --exec $READAHEAD_COLLECT_CMD; then + log_end_msg 0 + else + log_end_msg $? + fi + if [ -f /etc/init.d/auditd ]; then + log_warning_msg "Auditd installed, read readahead's README" + fi + fi + ;; + stop) + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 + ;; +esac --- readahead-fedora-1.5.6.orig/debian/init.d/stop-readahead-fedora +++ readahead-fedora-1.5.6/debian/init.d/stop-readahead-fedora @@ -0,0 +1,73 @@ +#!/bin/sh +set -e +### BEGIN INIT INFO +# Provides: stop-readahead-fedora +# Required-Start: $all +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: init script for stopping readahead profiling +### END INIT INFO + +READAHEAD_COLLECT_CMD="/sbin/readahead-collector" + +[ -x $READAHEAD_COLLECT_CMD ] || exit 0 + +running=false +if test -f /.readahead_collect || grep -qw "profile" /proc/cmdline; then + if pidof readahead-collector >/dev/null; then + running=true + fi +fi + +# U: unknown +RUNLEVEL="${RUNLEVEL:-U}" + +if [ "$RUNLEVEL" != 6 ] && [ "$RUNLEVEL" != 0 ]; then + $running || exit 0 +fi + +[ ! -f /etc/default/readahead-fedora ] || . /etc/default/readahead-fedora + +if [ "$SORT_AT_SHUTDOWN" = no ]; then + SORT_AT_SHUTDOWN=false + $running || exit 0 +else + SORT_AT_SHUTDOWN=true +fi + +case "$1" in + start|stop) + if $running; then + ( + rm -f /.readahead_collect + sleep ${READAHEAD_EXTRA_COLLECT:-0} + /sbin/start-stop-daemon --stop --quiet --oknodo \ + --exec "$READAHEAD_COLLECT_CMD" + + if ! $SORT_AT_SHUTDOWN; then + # wait until the collector exits before sorting the lists + while pidof readahead-collector >/dev/null; do + sleep 3 + done + exec /usr/share/readahead-fedora/build-lists + fi + ) & + fi + if $SORT_AT_SHUTDOWN && [ "$RUNLEVEL" = 6 -o "$RUNLEVEL" = 0 ]; then + . /lib/lsb/init-functions + log_begin_msg "Sorting readahead lists..." + if RENICED=yes /usr/share/readahead-fedora/build-lists; then + log_end_msg 0 + else + log_end_msg $? + fi + fi + ;; + restart|force-reload) + ;; + *) + echo "Usage: /etc/init.d/stop-readahead {start|stop|restart|force-reload}" + exit 1 + ;; +esac --- readahead-fedora-1.5.6.orig/debian/lintian-overrides +++ readahead-fedora-1.5.6/debian/lintian-overrides @@ -0,0 +1,2 @@ +# Triggered by a test for the presence of /var and /usr +init.d-script-missing-dependency-on-remote_fs --- readahead-fedora-1.5.6.orig/debian/maintscript +++ readahead-fedora-1.5.6/debian/maintscript @@ -0,0 +1 @@ +rm_conffile /etc/cron.daily/readahead 2:1.5.6-1 --- readahead-fedora-1.5.6.orig/debian/man/readahead-collector.8 +++ readahead-fedora-1.5.6/debian/man/readahead-collector.8 @@ -0,0 +1,53 @@ +.\" Copyright (C) 2009 Raphael Geissert +.\" +.\" This is free software; you may redistribute it and/or modify +.\" it under the terms of the GNU General Public License as +.\" published by the Free Software Foundation; either version 2, +.\" or (at your option) any later version. +.\" +.\" This is distributed in the hope that it will be useful, but +.\" WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with the Debian GNU/Linux system; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +.\" 02111-1307 USA +.TH readahead-collector "8" "August 2009" +.SH NAME +readahead-collector \- collect list of files used during the boot process +.SH SYNOPSIS +readahead-collector [options] +.SH DESCRIPTION +.B readahead-collector +is a files list generator for use in readahead(8) based on the files +used during the boot process. +.TP +\fBNote:\fP readahead-collector uses the audit subsystem of the kernel +to gather the list of accessed files; for this reason, it is necessary +that the kernel is built with the \fICONFIG_AUDIT\fP and +\fICONFIG_AUDITSYSCAL\fP options enabled. +Stock Debian kernels \fIare\fP built with these options. +.SH OPTIONS +.TP +.B -d +enable debug mode. +.TP +.B -f +leave the daemon in the foreground for debugging, output goes to stdout. +.TP +.B -h +print the usage information. +.SH FILES +.TP +.I /etc/readahead.conf +.SH "SEE ALSO" +.BR readahead (8) +.SH AUTHORS +.TP +Karel Zak , +.PP +This manual page was written by Raphael Geissert +.nh + --- readahead-fedora-1.5.6.orig/debian/man/readahead.8 +++ readahead-fedora-1.5.6/debian/man/readahead.8 @@ -0,0 +1,70 @@ +.\" Copyright (C) 2009 Raphael Geissert +.\" +.\" This is free software; you may redistribute it and/or modify +.\" it under the terms of the GNU General Public License as +.\" published by the Free Software Foundation; either version 2, +.\" or (at your option) any later version. +.\" +.\" This is distributed in the hope that it will be useful, but +.\" WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with the Debian GNU/Linux system; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +.\" 02111-1307 USA +.TH readahead "8" "July 2011" +.SH NAME +readahead \- file preloader for boot process optimization +.SH SYNOPSIS +readahead [options] [another-file-list [...]] +.SH DESCRIPTION +.B readahead +is a files preloader designed to optimize the disk I/O during the boot +process. +.SH OPTIONS +.TP +.B -b, --build +build optimised files list only, without sorting. +.TP +.B -s, --sort +build and sort list of files only (implies \-b). +.TP +.B -o, --output +write sorted list of files to \fIfile\fP. +.TP +.B -d, --dont-sort +preload files described by an already sorted files list. +.TP +.B -h, --help +print the usage information. +.TP +.B -v, --verbose +enable the verbose mode. +.TP +.B -t, --timing +report time spent on each operation. +.TP +.B -m, --maxsize +maximum size in KiB a file can be in order to be preloaded, default is +\fI10240\fP. +.TP +.B [another-file-list [...]] +One or more files containing the list of files to be preloaded or +sorted. The files list can be generated by readahead-collector(8). +.SH FILES +.TP +.I /etc/default/readahead-fedora +.SH "SEE ALSO" +.BR readahead-collector (8), +.BR readahead (2), +.SH AUTHORS +.TP +Arjan van de Ven , +Ziga Mahkovec , +Karel Zak , +.PP +This manual page was written by Raphael Geissert +.nh + --- readahead-fedora-1.5.6.orig/debian/patches/better-cron.patch +++ readahead-fedora-1.5.6/debian/patches/better-cron.patch @@ -0,0 +1,18 @@ +Index: readahead/scripts/readahead.cron +=================================================================== +--- readahead.orig/scripts/readahead.cron ++++ readahead/scripts/readahead.cron +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # + # Generates sorted readahead files +@@ -22,6 +22,6 @@ for LTYPE in $TYPES; do + fi + + if [ -n "$FLS" ]; then +- $READAHEAD_CMD --sort --output=$READAHEAD_BASE/$LTYPE.sorted $FLS &>/dev/null ++ $READAHEAD_CMD --sort --output=$READAHEAD_BASE/$LTYPE.sorted $FLS >/dev/null 2>&1 + fi + done --- readahead-fedora-1.5.6.orig/debian/patches/debianise.patch +++ readahead-fedora-1.5.6/debian/patches/debianise.patch @@ -0,0 +1,296 @@ +Index: readahead/src/readahead.conf +=================================================================== +--- readahead.orig/src/readahead.conf ++++ readahead/src/readahead.conf +@@ -15,22 +15,22 @@ RAC_INITPATH="/sbin/init" + + # Template of path where RAC will store final lists + # -- %s will be replaced by "early" or "later" +-RAC_LISTSPATH="/var/lib/readahead/custom.%s" ++RAC_LISTSPATH="/etc/readahead.d/custom.%s" + + # Ignore syscalls from: + RAC_EXECIGN="/sbin/readahead" + + # Exclude dirs +-RAC_EXCLUDE="/proc /sys /dev /var /home /tmp /media /selinux /mnt /usr/src /usr/include /lib/modules /usr/lib/gcc /usr/lib64/gcc /usr/lib/locale /usr/libexec/gcc" ++RAC_EXCLUDE="/proc /sys /dev /var/log /var/run /var/lock /home /tmp /var/tmp /media /selinux /mnt /var/lib/exim4 /var/lib/preload /etc/network/run" + + # A first filename in the list +-# RAC_LISTBEGIN="/etc/rc.d/init.d/readahead_early" ++# RAC_LISTBEGIN="/etc/init.d/readahead_early" + + # A filename which is a separator between early and later readahead +-# RAC_LISTSEP="/etc/rc.d/init.d/readahead_later" ++RAC_LISTSEP="/etc/init.d/later-readahead" + + # On/Off debug mode (see also "-d" option) + RAC_DEBUG="off" + + # On debug mode all debug messages goes to this file +-RAC_DEBUGLOG="/dev/.readahead-rac.debug" ++RAC_DEBUGLOG="/run/readahead-rac.debug" +Index: readahead/README +=================================================================== +--- readahead.orig/README ++++ readahead/README +@@ -4,13 +4,14 @@ INTRODUCTION + + readahead reads a list of files in advance and adds the pages to the page + cache. The files are accessed and read in an efficient manner to minimize +-disk seeks. Best performance is achieved on an ext2 or ext3 file system. ++disk seeks. Best performance is achieved on ext2-based file systems ++(e.g. ext3.) + + The program works in three modes: + + 1) full mode + +- readahead /var/lib/readahead/*.early ++ readahead /etc/readahead.d/*.early + + The program will read a new-line separated list of files from a text file. + The files need not be in any special order. The following algorithm is used: +@@ -26,18 +27,16 @@ The program works in three modes: + + 2) sort mode + +- readahead --sort --output=/var/lib/readahead/early.sorted /var/lib/readahead/*.early ++ readahead --sort --output=/etc/readahead.d/early.sorted /etc/readahead.d/*.early + + The program will read a new-line separated list of files from a text file. + The files need not be in any special order. The same algorithm as for the "full + mode" is used, but the sorted file list is written to stdout (or to --output=). + The program doesn't call readahead(2) in this mode. + +- Hint: use this mode in your cron.d scripts (but be careful with things like prelink). +- + 3) fast mode + +- readahead --dont-sort /var/lib/readahead/early.sorted ++ readahead --dont-sort /etc/readahead.d/early.sorted + + The program will read a new-line separated list of files from a text file. + The files need be in special order which is generated by the "sort mode". The +@@ -52,36 +51,25 @@ during boot process. The goal is to gen + your machine. The collector is based on kernel audit system and collects + information about syscalls like open(), stat(), ... + +-For more information about settings see /etc/readahead.conf. The best way how +-use the collector is boot with +- +- init=/sbin/readahead-collector +- +-kernel option. Please, don't add this option to your grub.conf permanently (due +-to negative performance impact). +- +-A newly generated lists you will found in +- +- /var/lib/readahead/custom.{early,later} +- +-WARNING: you have to disable auditd by: +- +- # chkconfig auditd off +- +-It's because auditd deletes all audit rules during boot. That's +-contra-productive for the collector. ++For more information about settings see /etc/readahead.conf. Although ++upstream supports starting the collector via the init= boot parameter, ++the Debian package does recommend not using it as it doesn't provide ++any further advantage to the init script-started mode. + +-Update: +- readahead-collector is started by upstart, if /.readahead_collect is present, which +- is created by a monthly cron job. auditd and restorecond service startup is delayed. ++To manually trigger the collector on next boot use + ++ touch /.readahead_collect + +-BUILDING +--------- ++To manually trigger the collector on grub or any other boot loader that ++supports passing parameters add the word 'profile' (without the quotes). + +-The e2fsprogs and e2fsprogs-devel packages are required to build and run the +-program. ++Note: the Debian package uses triggers in addition to a monthly cronjob ++and a shutdown script that are designed to keep a good performance without ++user intervention. + ++WARNING: if you have auditd installed you have to disable it by removing its symlink ++ from rcS.d, at least when profiling. auditd deletes all audit rules ++ during boot, interfering with collector. + + CREDIT + ------ +Index: readahead/lists/README.lists +=================================================================== +--- readahead.orig/lists/README.lists ++++ readahead/lists/README.lists +@@ -10,39 +10,22 @@ + + readahead --sort --output=early.sorted foo.early + +- To keep your lists actual you can add this command to the crontab. +- + + custom.{early,later} + + This is customised version of "full mode" lists. These lists are + generated for your machine by readahead-collector during boot process. + +- To generate these lists you have to boot with: ++ To generate these lists you have to boot with the following parameter: + +- init=/sbin/readahead-collector ++ profile + +- Please, don't add this option to your grub.conf permanently (due to +- negative performance impact). ++ Please, don't add this option to your bootloader configuration ++ permanently (due to negative performance impact). + + + *.{early,later} + + These are lists with the lowest priority. + +- +- Arch independent lists +- ~~~~~~~~~~~~~~~~~~~~~~ +- +- If you want to distribute architecture independents lists (for example in +- src.rpm), use: +- +- readahead-check --template=arch_spec.list --output=arch_indep.list +- +- to convert back to arch-specific version use lists/Makefile and +- +- make rpm-lists-rebuild FILES="default.early default.later" \ +- RPM_ARCH=x86_64 RPM_LIB=lib64 +- +- + Karel Zak +Index: readahead/Makefile.am +=================================================================== +--- readahead.orig/Makefile.am ++++ readahead/Makefile.am +@@ -2,16 +2,15 @@ include $(top_srcdir)/config/include-Mak + + SUBDIRS = src \ + po \ +- scripts \ +- lists ++ scripts + + ACLOCAL_AMFLAGS = -I m4 + + EXTRA_DIST = README \ + po/update-potfiles + +-dist_sysconfsysconf_DATA = readahead +-sysconfsysconfdir = $(sysconfdir)/sysconfig ++sysconfdefaultdir = $(sysconfdir)/default ++dist_sysconfdefault_DATA = readahead + + distclean-local: + -find . -name \*~ -o -name \*.orig -o -name \*.rej | xargs rm -f +Index: readahead/scripts/readahead_early +=================================================================== +--- readahead.orig/scripts/readahead_early ++++ readahead/scripts/readahead_early +@@ -30,7 +30,7 @@ + free -m | gawk '/Mem:/ {exit ($2 >= 384)?0:1}' || exit 0 + + # Source function library. +-. /etc/rc.d/init.d/functions ++. /lib/lsb/init-functions + + RETVAL=0 + VAR_SUBSYS_READAHEAD="/var/lock/subsys/readahead_early" +Index: readahead/scripts/readahead_later +=================================================================== +--- readahead.orig/scripts/readahead_later ++++ readahead/scripts/readahead_later +@@ -28,7 +28,7 @@ + free -m | gawk '/Mem:/ {exit ($2 >= 384)?0:1}' || exit 0 + + # Source function library. +-. /etc/rc.d/init.d/functions ++. /lib/lsb/init-functions + + RETVAL=0 + VAR_SUBSYS_READAHEAD="/var/lock/subsys/readahead_later" +Index: readahead/scripts/readahead-monthly.cron +=================================================================== +--- readahead.orig/scripts/readahead-monthly.cron ++++ readahead/scripts/readahead-monthly.cron +@@ -1,6 +1,6 @@ + #!/bin/sh +-. /etc/sysconfig/readahead +-if [ "$READAHEAD_COLLECT" = "yes" ] ; then ++[ -x "/sbin/readahead-collector" ] || exit 0 ++[ ! -f /etc/default/readahead-fedora ] || . /etc/default/readahead-fedora ++if [ "${READAHEAD_COLLECT:-yes}" = "yes" ] ; then + touch /.readahead_collect + fi +- +Index: readahead/scripts/readahead.cron +=================================================================== +--- readahead.orig/scripts/readahead.cron ++++ readahead/scripts/readahead.cron +@@ -9,7 +9,9 @@ + + TYPES="early later" + READAHEAD_CMD="/sbin/readahead" +-READAHEAD_BASE="/var/lib/readahead" ++READAHEAD_BASE="/etc/readahead.d" ++ ++[ -x "$READAHEAD_CMD" ] || exit 0 + + if [ -z "$RENICED" ]; then + export RENICED=yes +Index: readahead/readahead +=================================================================== +--- readahead.orig/readahead ++++ readahead/readahead +@@ -4,17 +4,14 @@ READAHEAD="yes" + # enable (at least monthly) readahead list collection + READAHEAD_COLLECT="yes" + +-# collect x seconds more after prefdm started ++# collect x seconds more after everything has been started + READAHEAD_EXTRA_COLLECT="10" + +-# collect on rpm database change +-READAHEAD_COLLECT_ON_RPM="yes" ++# enable to run readahead in the background instead of blocking ++# useful for SSDs ++#RUN_IN_BACKGROUND="yes" + +-# Delay these services for the readahead-collector. +-# At least "auditd" has to be delayed, for the collector +-# to run, if it is enabled on the system. +-READAHEAD_DELAY_SERVICES="auditd" +- +-# Minimum memory the machine has to have (kB) +-# to run readahead. +-READAHEAD_MIN_MEM=393216 ++# Force the I/O priority of readahead. Leave commented to pick the best ++# priority based on the RUN_IN_BACKGROUND setting. ++# Possibilities: "idle", "best-effort", "real-time" ++#IO_PRIORITY="best-effort" +Index: readahead/scripts/Makefile.am +=================================================================== +--- readahead.orig/scripts/Makefile.am ++++ readahead/scripts/Makefile.am +@@ -1,7 +1,7 @@ + include $(top_srcdir)/config/include-Makefile.am + +-dnl sysconfrcdir = $(sysconfdir)/rc.d/init.d +-dnl dist_sysconfrc_SCRIPTS = readahead_early readahead_later ++# sysconfrcdir = $(sysconfdir)/rc.d/init.d ++# dist_sysconfrc_SCRIPTS = readahead_early readahead_later + + sysconfcrondir = $(sysconfdir)/cron.daily + dist_sysconfcron_SCRIPTS = readahead.cron --- readahead-fedora-1.5.6.orig/debian/patches/dontsort_also_preloads_inodes.patch +++ readahead-fedora-1.5.6/debian/patches/dontsort_also_preloads_inodes.patch @@ -0,0 +1,59 @@ +Index: readahead/src/readahead.c +=================================================================== +--- readahead.orig/src/readahead.c ++++ readahead/src/readahead.c +@@ -263,7 +263,7 @@ list_sort_by_paths(struct file *files, i + } + + static void +-list_read_blocks(struct file *files, int nfiles) ++list_read_blocks(struct file *files, int nfiles, int update) + { + int i; + struct file *file, *last = NULL; +@@ -311,13 +311,17 @@ list_read_blocks(struct file *files, int + + if (dev == NULL || dev->fs == NULL) + continue; /* no dev? */ +- group = ext2fs_group_of_ino(dev->fs, st.st_ino); + +- if (dev->group_hits[group] == GROUP_HIT_THRESH) +- preload_inodes(dev->fs, group); ++ /* only preload inodes when not updating the list */ ++ if (!update) { ++ group = ext2fs_group_of_ino(dev->fs, st.st_ino); + +- dev->group_hits[group]++; ++ if (dev->group_hits[group] == GROUP_HIT_THRESH) ++ preload_inodes(dev->fs, group); + ++ dev->group_hits[group]++; ++ ++ } + /* Store the first data block (for sorting later) */ + ext2fs_block_iterate2(dev->fs, st.st_ino, 0, NULL, + get_first_block, (void *)file); +@@ -521,8 +525,8 @@ main(int argc, char **argv) + if (mode == MODE_FULL || mode == MODE_SORT) + list_sort_by_paths(files, nfiles); + +- if (mode == MODE_FULL || mode == MODE_SORT) +- list_read_blocks(files, nfiles); ++ if (mode == MODE_FULL || mode == MODE_SORT || mode == MODE_FAST) ++ list_read_blocks(files, nfiles, mode != MODE_FAST); + + if (mode == MODE_FULL || mode == MODE_SORT) + list_sort_by_blocks(files, nfiles); +Index: readahead/README +=================================================================== +--- readahead.orig/README ++++ readahead/README +@@ -41,7 +41,7 @@ The program works in three modes: + + The program will read a new-line separated list of files from a text file. + The files need be in special order which is generated by the "sort mode". The +- program calls readahead(2) for each file. ++ program does the steps b) and d) described above. + + + READAHEAD-COLLECTOR --- readahead-fedora-1.5.6.orig/debian/patches/ignore-large-files.patch +++ readahead-fedora-1.5.6/debian/patches/ignore-large-files.patch @@ -0,0 +1,12 @@ +Index: readahead/readahead +=================================================================== +--- readahead.orig/readahead ++++ readahead/readahead +@@ -15,3 +15,7 @@ READAHEAD_EXTRA_COLLECT="10" + # priority based on the RUN_IN_BACKGROUND setting. + # Possibilities: "idle", "best-effort", "real-time" + #IO_PRIORITY="best-effort" ++ ++# Don't preload files bigger than x KiBs ++# leave commented to use readahead's built-in default ++#MAX_FILE_SIZE=10240 --- readahead-fedora-1.5.6.orig/debian/patches/ignore-reads-from-preload.patch +++ readahead-fedora-1.5.6/debian/patches/ignore-reads-from-preload.patch @@ -0,0 +1,13 @@ +Index: readahead/src/readahead.conf +=================================================================== +--- readahead.orig/src/readahead.conf ++++ readahead/src/readahead.conf +@@ -18,7 +18,7 @@ RAC_INITPATH="/sbin/init" + RAC_LISTSPATH="/etc/readahead.d/custom.%s" + + # Ignore syscalls from: +-RAC_EXECIGN="/sbin/readahead" ++RAC_EXECIGN="/sbin/readahead /usr/sbin/preload" + + # Exclude dirs + RAC_EXCLUDE="/proc /sys /dev /var/log /var/run /var/lock /home /tmp /var/tmp /media /selinux /mnt" --- readahead-fedora-1.5.6.orig/debian/patches/ignore_creat_and_truncate.patch +++ readahead-fedora-1.5.6/debian/patches/ignore_creat_and_truncate.patch @@ -0,0 +1,17 @@ +Index: readahead/src/readahead-collector.c +=================================================================== +--- readahead.orig/src/readahead-collector.c ++++ readahead/src/readahead-collector.c +@@ -715,8 +715,11 @@ insert_rule(RacStatus *rac) + + rc |= audit_rule_syscallbyname_data(audit_rule, "open"); + rc |= audit_rule_syscallbyname_data(audit_rule, "openat"); ++ /* Disable as we don't make any special use of them. ++ * They could be used to add them to a list of inodes that need ++ * to be preloaded, but excluding them from readahead(2) + rc |= audit_rule_syscallbyname_data(audit_rule, "creat"); +- rc |= audit_rule_syscallbyname_data(audit_rule, "truncate"); ++ rc |= audit_rule_syscallbyname_data(audit_rule, "truncate");*/ + rc |= audit_rule_syscallbyname_data(audit_rule, "execve"); + rc |= audit_rule_syscallbyname_data(audit_rule, "sendfile"); + --- readahead-fedora-1.5.6.orig/debian/patches/later_means_with_usr.patch +++ readahead-fedora-1.5.6/debian/patches/later_means_with_usr.patch @@ -0,0 +1,44 @@ +Index: readahead/scripts/readahead.cron +=================================================================== +--- readahead.orig/scripts/readahead.cron ++++ readahead/scripts/readahead.cron +@@ -10,6 +10,7 @@ + TYPES="early later" + READAHEAD_CMD="/sbin/readahead" + READAHEAD_BASE="/etc/readahead.d" ++MERGE_LISTS=false + + [ -x "$READAHEAD_CMD" ] || exit 0 + +@@ -19,6 +20,13 @@ if [ -z "$RENICED" ]; then + --exec $READAHEAD_CMD --startas $0 + fi + ++if [ -f /run/readahead ]; then ++ . /run/readahead ++ if $MOUNTED_USR && $MOUNTED_VAR; then ++ MERGE_LISTS=true ++ fi ++fi ++ + for LTYPE in $TYPES; do + if [ -s "$READAHEAD_BASE/custom.$LTYPE" ]; then + FLS="$READAHEAD_BASE/custom.$LTYPE" +@@ -30,3 +38,17 @@ for LTYPE in $TYPES; do + $READAHEAD_CMD --sort --output=$READAHEAD_BASE/$LTYPE.sorted $FLS >/dev/null 2>&1 + fi + done ++ ++if $MERGE_LISTS; then ++ tmpf="$(mktemp)" ++ for LTYPE in $TYPES; do ++ f="$READAHEAD_BASE/$LTYPE.sorted" ++ [ -f "$f" ] || continue ++ cut -d\ -f2- "$f" >> "$tmpf" ++ done ++ if [ -s "$tmpf" ]; then ++ $READAHEAD_CMD --sort --output="$READAHEAD_BASE/early.sorted" "$tmpf" >/dev/null 2>&1 ++ : > "$READAHEAD_BASE/later.sorted" ++ fi ++ rm -f "$tmpf" ++fi --- readahead-fedora-1.5.6.orig/debian/patches/monotonic_clock.patch +++ readahead-fedora-1.5.6/debian/patches/monotonic_clock.patch @@ -0,0 +1,45 @@ +Index: readahead/src/readahead.c +=================================================================== +--- readahead.orig/src/readahead.c ++++ readahead/src/readahead.c +@@ -34,7 +34,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -62,16 +61,16 @@ static inline int ioprio_set(int which, + #define IO_MGR unix_io_manager + + +-typedef struct timeval timer; ++typedef struct timespec timer; + +-#define TIMER_START(t) gettimeofday(&t, NULL) ++#define TIMER_START(t) clock_gettime(CLOCK_MONOTONIC, &t) + + #define TIMER_STOP(t) { timer _t_2; TIMER_START(_t_2); \ + t.tv_sec = _t_2.tv_sec-t.tv_sec; \ +- t.tv_usec = _t_2.tv_usec-t.tv_usec; } ++ t.tv_nsec = _t_2.tv_nsec-t.tv_nsec; } + + #define TIMER_DIFF(t) (t.tv_sec * 1000 + \ +- t.tv_usec / 1000) ++ t.tv_nsec / 1000000) + + static char *progname; + static int verbose; +Index: readahead/src/Makefile.am +=================================================================== +--- readahead.orig/src/Makefile.am ++++ readahead/src/Makefile.am +@@ -6,6 +6,6 @@ dist_sysconf_DATA = readahead.conf + + readahead_SOURCES = readahead.c nls.h + +-readahead_LDADD = -lext2fs -lblkid ++readahead_LDADD = -lext2fs -lblkid -lrt + readahead_collector_LDADD = -laudit -lauparse + --- readahead-fedora-1.5.6.orig/debian/patches/more_efficient_build-lists.patch +++ readahead-fedora-1.5.6/debian/patches/more_efficient_build-lists.patch @@ -0,0 +1,95 @@ +Index: readahead/scripts/readahead.cron +=================================================================== +--- readahead.orig/scripts/readahead.cron ++++ readahead/scripts/readahead.cron +@@ -3,6 +3,7 @@ + # + # Generates sorted readahead files + # ++# Copyright (C) 2009, 2011 by Raphael Geissert + # Copyright (C) 2007 Red Hat, Inc. + # Karel Zak + # +@@ -27,21 +28,27 @@ if [ -f /run/readahead ]; then + fi + fi + +-for LTYPE in $TYPES; do +- if [ -s "$READAHEAD_BASE/custom.$LTYPE" ]; then +- FLS="$READAHEAD_BASE/custom.$LTYPE" +- else +- FLS=$(ls $READAHEAD_BASE/*.$LTYPE 2>/dev/null ) +- fi +- +- if [ -n "$FLS" ]; then +- $READAHEAD_CMD --sort --output=$READAHEAD_BASE/$LTYPE.sorted $FLS >/dev/null 2>&1 ++get_lists() { ++ local type="$1" allow_null="${2:-true}" ++ ++ if [ -s "$READAHEAD_BASE/custom.$type" ]; then ++ echo "$READAHEAD_BASE/custom.$type" ++ else ++ local f found=false ++ for f in "$(ls $READAHEAD_BASE/*.$type 2>/dev/null)"; do ++ if [ -f "$f" ]; then ++ echo "$f" ++ found=true ++ fi ++ done ++ if ! $found && $allow_null; then ++ # otherwise readahead(8) would abort ++ echo /dev/null + fi +-done ++ fi ++} + + if $MERGE_LISTS; then +- tmpf="$(mktemp)" +- + extra_opts=--sort + + major=$(stat -c '%D' . | cut -b1) +@@ -52,14 +59,35 @@ if $MERGE_LISTS; then + fi + fi + +- for LTYPE in $TYPES; do +- f="$READAHEAD_BASE/$LTYPE.sorted" +- [ -f "$f" ] || continue +- cut -d\ -f2- "$f" >> "$tmpf" ++ lists= ++ for type in $TYPES; do ++ typel="$(get_lists $type false)" ++ ++ # We don't want lists=" /etc/..." because of the -n test below ++ # We need lists='' instead of lists=' ' when no list is found ++ if [ -n "$lists" ]; then ++ lists="$typel" ++ else ++ lists="$lists $typel" ++ fi + done +- if [ -s "$tmpf" ]; then +- $READAHEAD_CMD $extra_opts --output="$READAHEAD_BASE/early.sorted" "$tmpf" >/dev/null 2>&1 ++ ++ if [ -n "$lists" ]; then ++ $READAHEAD_CMD $extra_opts --output="$READAHEAD_BASE/early.sorted" $lists >/dev/null 2>&1 ++ # only write to later.sorted if needed ++ if [ ! -f "$READAHEAD_BASE/later.sorted" ] || [ -s "$READAHEAD_BASE/later.sorted" ]; then ++ : > "$READAHEAD_BASE/later.sorted" ++ fi ++ else ++ : > "$READAHEAD_BASE/early.sorted" + : > "$READAHEAD_BASE/later.sorted" + fi +- rm -f "$tmpf" ++else ++ for LTYPE in $TYPES; do ++ FLS="$(get_lists $LTYPE)" ++ ++ if [ -n "$FLS" ]; then ++ $READAHEAD_CMD --sort --output=$READAHEAD_BASE/$LTYPE.sorted $FLS >/dev/null 2>&1 ++ fi ++ done + fi --- readahead-fedora-1.5.6.orig/debian/patches/nice_collector.patch +++ readahead-fedora-1.5.6/debian/patches/nice_collector.patch @@ -0,0 +1,26 @@ +Index: readahead/readahead +=================================================================== +--- readahead.orig/readahead ++++ readahead/readahead +@@ -19,3 +19,8 @@ READAHEAD_EXTRA_COLLECT="10" + # Don't preload files bigger than x KiBs + # leave commented to use readahead's built-in default + #MAX_FILE_SIZE=10240 ++ ++# Nice priority for the collector. Default: 5 ++# The value is not validated, setting it incorrectly may prevent the ++# collector from running. Do NOT set it to a negative integer. ++NICE_COLLECTOR=5 +Index: readahead/src/readahead-collector.c +=================================================================== +--- readahead.orig/src/readahead-collector.c ++++ readahead/src/readahead-collector.c +@@ -310,7 +310,7 @@ main(int argc, char **argv) + die("cannot enable audit"); + + /* Set size of audit log in kernel */ +- if (audit_set_backlog_limit(rac->fd, 256) > 0) ++ if (audit_set_backlog_limit(rac->fd, 512) > 0) + audit_request_status(rac->fd); + else + die("cannot enlarge log limit"); --- readahead-fedora-1.5.6.orig/debian/patches/no_dependency_on_ionice.patch +++ readahead-fedora-1.5.6/debian/patches/no_dependency_on_ionice.patch @@ -0,0 +1,24 @@ +Index: readahead/scripts/readahead.cron +=================================================================== +--- readahead.orig/scripts/readahead.cron ++++ readahead/scripts/readahead.cron +@@ -7,13 +7,16 @@ + # Karel Zak + # + +-renice +19 -p $$ >/dev/null 2>&1 +-ionice -c3 -p $$ >/dev/null 2>&1 +- + TYPES="early later" + READAHEAD_CMD="/sbin/readahead" + READAHEAD_BASE="/var/lib/readahead" + ++if [ -z "$RENICED" ]; then ++ export RENICED=yes ++ exec /sbin/start-stop-daemon --start -N +19 -I idle \ ++ --exec $READAHEAD_CMD --startas $0 ++fi ++ + for LTYPE in $TYPES; do + if [ -s "$READAHEAD_BASE/custom.$LTYPE" ]; then + FLS="$READAHEAD_BASE/custom.$LTYPE" --- readahead-fedora-1.5.6.orig/debian/patches/no_i18n.patch +++ readahead-fedora-1.5.6/debian/patches/no_i18n.patch @@ -0,0 +1,23 @@ +Index: readahead/src/readahead.c +=================================================================== +--- readahead.orig/src/readahead.c ++++ readahead/src/readahead.c +@@ -37,7 +37,6 @@ + #include + #include + #include +-#include + #include + #include "nls.h" + +@@ -462,10 +461,6 @@ main(int argc, char **argv) + + maxsize = 10240; + +- setlocale(LC_MESSAGES, ""); +- bindtextdomain(PACKAGE, LOCALEDIR); +- textdomain(PACKAGE); +- + progname = argv[0]; + if ((p = strrchr(argv[0], '/'))) + progname = p+1; --- readahead-fedora-1.5.6.orig/debian/patches/no_io_priority_handling.patch +++ readahead-fedora-1.5.6/debian/patches/no_io_priority_handling.patch @@ -0,0 +1,40 @@ +Index: readahead/src/readahead.c +=================================================================== +--- readahead.orig/src/readahead.c ++++ readahead/src/readahead.c +@@ -34,7 +34,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -42,16 +41,6 @@ + #include + #include "nls.h" + +-static inline int ioprio_set(int which, int who, int ioprio) +-{ +- return syscall(SYS_ioprio_set, which, who, ioprio); +-} +- +-#define IOPRIO_WHO_PROCESS 1 +-#define IOPRIO_CLASS_IDLE 3 +-#define IOPRIO_CLASS_SHIFT 13 +-#define IOPRIO_IDLE_LOWEST (7 | (IOPRIO_CLASS_IDLE << IOPRIO_CLASS_SHIFT)) +- + #define MAXFILES 32768 + #define MAXDEVICES 32 + +@@ -519,10 +508,6 @@ main(int argc, char **argv) + } + + +- if (ioprio_set(IOPRIO_WHO_PROCESS, getpid(), +- IOPRIO_IDLE_LOWEST) == -1) +- perror("Can not set IO priority to idle class"); +- + if ((nfiles = list_new(files, argv, argc, mode == MODE_FAST)) < 0) { + free(output); + return EXIT_FAILURE; --- readahead-fedora-1.5.6.orig/debian/patches/only_open_files_once.patch +++ readahead-fedora-1.5.6/debian/patches/only_open_files_once.patch @@ -0,0 +1,122 @@ +Index: readahead/src/readahead.c +=================================================================== +--- readahead.orig/src/readahead.c ++++ readahead/src/readahead.c +@@ -64,6 +64,7 @@ static char *progname; + static int verbose; + static int timing; + static long int maxsize; ++static int leavefdopen; + + /* Modes */ + #define MODE_FULL 1 +@@ -82,6 +83,7 @@ struct file { + char* path; + off_t size; + blk_t block; ++ int fd; + }; + + /* Compare files by path. */ +@@ -225,6 +227,7 @@ list_new(struct file *files, char **list + file->path = (char *) malloc(sizeof(char) * (len + 1)); + strcpy(file->path, path); + files->block = -1; ++ files->fd = -1; + nfiles++; + if (nfiles == MAXFILES) { + fprintf(stderr, +@@ -291,15 +294,46 @@ list_read_blocks(struct file *files, int + if (last && strcmp(file->path, last->path)==0) + continue; /* duplicate file */ + last = file; ++ do { ++ errno = 0; + #ifdef O_NOATIME +- fd = open(file->path, O_RDONLY | O_NOATIME); +- if (fd < 0) +- fd = open(file->path, O_RDONLY); ++ fd = open(file->path, O_RDONLY | O_NOATIME); ++ if (fd < 0) ++ fd = open(file->path, O_RDONLY); + #else +- fd = open(file->path, O_RDONLY); ++ fd = open(file->path, O_RDONLY); + #endif +- if (fd < 0 || fstat(fd, &st) < 0) +- continue; /* open() or stat() failed */ ++ if (fd < 0) { ++ struct file *file_it; ++ int fds2close; ++ ++ if (errno != EMFILE) ++ break; ++ ++ /* We can't leave any other fd open ++ * anymore, close 'fds2close' fds. ++ * If the previous file required a new ++ * device to be opened it may have ++ * failed. We will have to live with ++ * that file that got ignored... ++ */ ++ file_it = file-1; ++ leavefdopen = 0; ++ fds2close = (MAXDEVICES - ndevices) +1; ++ ++ for (; fds2close && file_it != NULL; file_it--) { ++ if (file_it->fd == -1) ++ continue; ++ close(file_it->fd); ++ file_it->fd = -1; ++ fds2close--; ++ } ++ continue; /* re-try to open(2) */ ++ } else ++ break; ++ } while (1); ++ if (fd < 0 || fstat(fd, &st) < 0) /* open() or stat() failed */ ++ continue; + if (!S_ISREG(st.st_mode)) + continue; /* not regular file */ + if (!gnu_dev_major(st.st_dev)) +@@ -326,6 +360,11 @@ list_read_blocks(struct file *files, int + ext2fs_block_iterate2(dev->fs, st.st_ino, 0, NULL, + get_first_block, (void *)file); + ++ if (leavefdopen) { ++ file->fd = fd; ++ fd = -1; ++ } ++ + fcount++; /* number of really loaded files */ + total += file->size; + } +@@ -373,11 +412,13 @@ list_do_readahead(struct file *files, in + for (i = 0, file = files; i < nfiles; i++, file++) { + if (file == NULL || file->path == NULL || file->size == 0) + continue; ++ ++ fd = file->fd; + #ifdef O_NOATIME +- if ((fd = open(file->path, O_RDONLY | O_NOATIME)) != -1 ++ if (fd != -1 || (fd = open(file->path, O_RDONLY | O_NOATIME)) != -1 + || (fd = open(file->path, O_RDONLY)) != -1) { + #else +- if ((fd = open(file->path, O_RDONLY)) != -1) { ++ if (fd != -1 || (fd = open(file->path, O_RDONLY)) != -1) { + #endif + readahead(fd, 0, file->size); + close(fd); +@@ -523,6 +564,12 @@ main(int argc, char **argv) + free(output); + return EXIT_SUCCESS; /* empty list is not error */ + } ++ close(0); /* free stdin's fd */ ++ ++ if (mode == MODE_FULL || mode == MODE_FAST) ++ leavefdopen = 1; ++ else ++ leavefdopen = 0; + + if (mode == MODE_FULL || mode == MODE_SORT) + list_sort_by_paths(files, nfiles); --- readahead-fedora-1.5.6.orig/debian/patches/rac_alloc_enough_memory.patch +++ readahead-fedora-1.5.6/debian/patches/rac_alloc_enough_memory.patch @@ -0,0 +1,13 @@ +Index: readahead/src/readahead-collector.c +=================================================================== +--- readahead.orig/src/readahead-collector.c ++++ readahead/src/readahead-collector.c +@@ -500,7 +500,7 @@ string_to_array(char *data) + if (isspace((unsigned char) *l)) + items--; + if (items) +- res = (char **) malloc(sizeof(char *) * items + 1); ++ res = (char **) malloc(sizeof(char *) * (items + 1)); + if (!res) + return NULL; + p = data; --- readahead-fedora-1.5.6.orig/debian/patches/rac_array_read_oob.patch +++ readahead-fedora-1.5.6/debian/patches/rac_array_read_oob.patch @@ -0,0 +1,22 @@ +Index: readahead/src/readahead-collector.c +=================================================================== +--- readahead.orig/src/readahead-collector.c ++++ readahead/src/readahead-collector.c +@@ -1251,10 +1251,16 @@ exclude_file(char **list, const char *fi + { + char **p = list; + ++ if (*filename == '\0') ++ return 0; ++ + for (; p && *p; p++) { + const char *f = filename; + char *e = *p; +- while(*f++ == *e++); ++ for (; *f == *e; *f++, *e++) { ++ if (*e == '\0') ++ return 1; ++ } + if (*e == '\0') + return 1; + } --- readahead-fedora-1.5.6.orig/debian/patches/rac_break_on_unwanted_exe.patch +++ readahead-fedora-1.5.6/debian/patches/rac_break_on_unwanted_exe.patch @@ -0,0 +1,16 @@ +Index: readahead/src/readahead-collector.c +=================================================================== +--- readahead.orig/src/readahead-collector.c ++++ readahead/src/readahead-collector.c +@@ -1060,8 +1060,10 @@ parse_events(RacStatus *rac, char **ary, + + if (type == AUDIT_SYSCALL && + (p = auparse_find_field(au, "exe"))) { +- if (exclude_file(rac->execign, p+1)) ++ if (exclude_file(rac->execign, p+1)) { + wanted = 0; ++ break; ++ } + } + else if (type == AUDIT_CWD && + (p = auparse_find_field(au, "cwd"))) --- readahead-fedora-1.5.6.orig/debian/patches/rac_ignore_non_successful_calls.patch +++ readahead-fedora-1.5.6/debian/patches/rac_ignore_non_successful_calls.patch @@ -0,0 +1,22 @@ +Index: readahead/src/readahead-collector.c +=================================================================== +--- readahead.orig/src/readahead-collector.c ++++ readahead/src/readahead-collector.c +@@ -1058,9 +1058,14 @@ parse_events(RacStatus *rac, char **ary, + int type = auparse_get_type(au); + const char *p; + +- if (type == AUDIT_SYSCALL && +- (p = auparse_find_field(au, "exe"))) { +- if (exclude_file(rac->execign, p+1)) { ++ if (type == AUDIT_SYSCALL) { ++ if ((p = auparse_find_field(au, "success")) && ++ !strcmp("no", p)) { ++ wanted = 0; ++ break; ++ } ++ if ((p = auparse_find_field(au, "exe")) && ++ exclude_file(rac->execign, p+1)) { + wanted = 0; + break; + } --- readahead-fedora-1.5.6.orig/debian/patches/rac_ignore_open_wronly-trunc-excl.patch +++ readahead-fedora-1.5.6/debian/patches/rac_ignore_open_wronly-trunc-excl.patch @@ -0,0 +1,41 @@ +Index: readahead/src/readahead-collector.c +=================================================================== +--- readahead.orig/src/readahead-collector.c ++++ readahead/src/readahead-collector.c +@@ -38,6 +38,8 @@ + #include + #include + #include ++/* syscall numbers: */ ++#include + + + /* +@@ -1069,6 +1071,27 @@ parse_events(RacStatus *rac, char **ary, + wanted = 0; + break; + } ++ auparse_first_field(au); ++ if ((p = auparse_find_field(au, "syscall"))) { ++ long nr; ++ char *end; ++ nr = strtol(p, &end, 10); ++ if (*end != '\0') ++ debug("Failed to parse syscall: [%s]", p); ++ else if (nr == __NR_open && ++ (p = auparse_find_field(au, "a1"))) { ++ long flags; ++ flags = strtol(p, &end, 16); ++ if (*end != '\0') ++ debug("Failed to parse open(2) flags: [%s]", p); ++ else if (flags & O_WRONLY || ++ flags & O_EXCL || ++ flags & O_TRUNC) { ++ wanted = 0; ++ break; ++ } ++ } ++ } + } + else if (type == AUDIT_CWD && + (p = auparse_find_field(au, "cwd"))) --- readahead-fedora-1.5.6.orig/debian/patches/rac_memory_overlapping.patch +++ readahead-fedora-1.5.6/debian/patches/rac_memory_overlapping.patch @@ -0,0 +1,57 @@ +Index: readahead/src/readahead-collector.c +=================================================================== +--- readahead.orig/src/readahead-collector.c ++++ readahead/src/readahead-collector.c +@@ -1144,8 +1144,7 @@ myrealpath(const char *path, char *resol + char *npath; + char link_path[PATH_MAX+1]; + int n; +- char *buf = NULL; +- int bufsz = 0; ++ char *oldbuf = NULL; + + npath = resolved_path; + +@@ -1206,6 +1205,7 @@ myrealpath(const char *path, char *resol + goto err; + } else { + int m; ++ char *buf; + + /* Note: readlink doesn't add the null byte. */ + link_path[n] = '\0'; +@@ -1220,15 +1220,13 @@ myrealpath(const char *path, char *resol + /* Insert symlink contents into path. */ + m = strlen(path); + +- if (!buf) +- buf = malloc(m + n + 1); +- else if (m + n + 1 > bufsz) +- buf = realloc(buf, m + n + 1); +- bufsz = m + n + 1; ++ buf = malloc(m + n + 1); + + memcpy(buf, link_path, n); + memcpy(buf + n, path, m + 1); +- path = buf; ++ free(oldbuf); ++ /* keep a copy of buf in oldbuf to free it later */ ++ path = oldbuf = buf; + } + *npath++ = '/'; + } +@@ -1238,12 +1236,10 @@ myrealpath(const char *path, char *resol + /* Make sure it's null terminated. */ + *npath = '\0'; + +- if (buf) +- free(buf); ++ free(oldbuf); + return resolved_path; + err: +- if (buf) +- free(buf); ++ free(oldbuf); + return NULL; + } + --- readahead-fedora-1.5.6.orig/debian/patches/series +++ readahead-fedora-1.5.6/debian/patches/series @@ -0,0 +1,23 @@ +rac_memory_overlapping.patch +rac_array_read_oob.patch +rac_alloc_enough_memory.patch +timer_macro.patch +monotonic_clock.patch +better-cron.patch +no_dependency_on_ionice.patch +debianise.patch +no_io_priority_handling.patch +ignore-reads-from-preload.patch +ignore-large-files.patch +later_means_with_usr.patch +dontsort_also_preloads_inodes.patch +unsorted_custom_lists.patch +no_i18n.patch +nice_collector.patch +sort_at_shutdown.patch +ignore_creat_and_truncate.patch +rac_break_on_unwanted_exe.patch +rac_ignore_non_successful_calls.patch +rac_ignore_open_wronly-trunc-excl.patch +only_open_files_once.patch +more_efficient_build-lists.patch --- readahead-fedora-1.5.6.orig/debian/patches/sort_at_shutdown.patch +++ readahead-fedora-1.5.6/debian/patches/sort_at_shutdown.patch @@ -0,0 +1,12 @@ +Index: readahead/readahead +=================================================================== +--- readahead.orig/readahead ++++ readahead/readahead +@@ -24,3 +24,7 @@ READAHEAD_EXTRA_COLLECT="10" + # The value is not validated, setting it incorrectly may prevent the + # collector from running. Do NOT set it to a negative integer. + NICE_COLLECTOR=5 ++ ++# Sort the files lists at shutdown, to leave them in an optimum state ++# for next boot. Disable with "no". ++SORT_AT_SHUTDOWN="yes" --- readahead-fedora-1.5.6.orig/debian/patches/timer_macro.patch +++ readahead-fedora-1.5.6/debian/patches/timer_macro.patch @@ -0,0 +1,129 @@ +Index: readahead/src/readahead.c +=================================================================== +--- readahead.orig/src/readahead.c ++++ readahead/src/readahead.c +@@ -61,8 +61,17 @@ static inline int ioprio_set(int which, + + #define IO_MGR unix_io_manager + +-#define TIMEDIFF(t1, t2) ((t2.tv_sec-t1.tv_sec) * 1000 + \ +- (t2.tv_usec-t1.tv_usec) / 1000) ++ ++typedef struct timeval timer; ++ ++#define TIMER_START(t) gettimeofday(&t, NULL) ++ ++#define TIMER_STOP(t) { timer _t_2; TIMER_START(_t_2); \ ++ t.tv_sec = _t_2.tv_sec-t.tv_sec; \ ++ t.tv_usec = _t_2.tv_usec-t.tv_usec; } ++ ++#define TIMER_DIFF(t) (t.tv_sec * 1000 + \ ++ t.tv_usec / 1000) + + static char *progname; + static int verbose; +@@ -185,10 +194,10 @@ list_new(struct file *files, char **list + { + char buf[PATH_MAX]; + int nfiles = 0, i; +- struct timeval t1, t2; ++ timer t; + + if (timing && verbose) +- gettimeofday(&t1, NULL); ++ TIMER_START(t); + + for (i = 0; i < nlists; i++) { + FILE *fin = fopen(lists[i], "r"); +@@ -240,9 +249,9 @@ list_new(struct file *files, char **list + fclose(fin); + } + if (timing && verbose) { +- gettimeofday(&t2, NULL); ++ TIMER_STOP(t); + fprintf(stderr, _("Time (read lists): %ld ms\n"), +- TIMEDIFF(t1, t2)); ++ TIMER_DIFF(t)); + } + if (verbose) + fprintf(stderr, _("Create list with %d files\n"), nfiles); +@@ -276,10 +285,10 @@ list_read_blocks(struct file *files, int + struct stat st; + struct device devices[MAXDEVICES]; + int ndevices = 0; +- struct timeval t1, t2; ++ timer t; + + if (timing && verbose) +- gettimeofday(&t1, NULL); ++ TIMER_START(t); + + for (i = 0, file = files; i < nfiles; i++, file++) { + struct device *dev; +@@ -340,9 +349,9 @@ list_read_blocks(struct file *files, int + ext2fs_close(devices[i].fs); + } + if (timing && verbose) { +- gettimeofday(&t2, NULL); ++ TIMER_STOP(t); + fprintf(stderr, _("Time (read blocks): %ld ms\n"), +- TIMEDIFF(t1, t2)); ++ TIMER_DIFF(t)); + } + if (verbose) + fprintf(stderr, _("Read blocks for %d/%d files (%llu KB)\n"), +@@ -362,12 +371,12 @@ list_do_readahead(struct file *files, in + int i; + struct file *file; + int fd = -1; +- struct timeval t1, t2; ++ timer t; + off_t total = 0; + int fcount = 0; + + if (timing && verbose) +- gettimeofday(&t1, NULL); ++ TIMER_START(t); + + for (i = 0, file = files; i < nfiles; i++, file++) { + if (file == NULL || file->path == NULL || file->size == 0) +@@ -385,8 +394,8 @@ list_do_readahead(struct file *files, in + } + } + if (timing && verbose) { +- gettimeofday(&t2, NULL); +- fprintf(stderr, _("Time (readahead): %ld ms\n"), TIMEDIFF(t1, t2)); ++ TIMER_STOP(t); ++ fprintf(stderr, _("Time (readahead): %ld ms\n"), TIMER_DIFF(t)); + } + if (verbose) + fprintf(stderr, _("Preload %d/%d files (%llu KB)\n"), +@@ -451,7 +460,7 @@ main(int argc, char **argv) + { "maxsize", 1, 0, 'm' }, + { NULL, 0, 0, 0 } + }; +- struct timeval t1, t2; ++ timer t; + struct file files[MAXFILES]; + int nfiles = 0; + +@@ -492,7 +501,7 @@ main(int argc, char **argv) + } + + if (timing) +- gettimeofday(&t1, NULL); ++ TIMER_START(t); + + argc -= optind; + argv += optind; +@@ -543,8 +552,8 @@ main(int argc, char **argv) + list_destroy(files, nfiles); + + if (timing) { +- gettimeofday(&t2, NULL); +- fprintf(stderr, _("Time total: %ld ms\n"), TIMEDIFF(t1, t2)); ++ TIMER_STOP(t); ++ fprintf(stderr, _("Time total: %ld ms\n"), TIMER_DIFF(t)); + } + free(output); + exit( res == 0 ? EXIT_SUCCESS : EXIT_FAILURE ); --- readahead-fedora-1.5.6.orig/debian/patches/unsorted_custom_lists.patch +++ readahead-fedora-1.5.6/debian/patches/unsorted_custom_lists.patch @@ -0,0 +1,165 @@ +Index: readahead/src/readahead-collector.c +=================================================================== +--- readahead.orig/src/readahead-collector.c ++++ readahead/src/readahead-collector.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + + /* +@@ -961,13 +962,9 @@ blocks_dump_as_lists(RacStatus *rac, con + + if (nfiles) { + int e = sep ? : nfiles; +- debug("sorting early list (%d/%d items)", e, nfiles); +- qsort(all, e, sizeof(char *), pathcmp); + list_write(rac, all, e, filename_tpl, "early"); + } + if (sep) { +- debug("sorting later list (%d/%d items)", nfiles-sep, nfiles); +- qsort(all + sep, nfiles - sep, sizeof(char *), pathcmp); + list_write(rac, all + sep, nfiles - sep, filename_tpl, "later"); + } + +@@ -981,7 +978,7 @@ list_write(RacStatus *rac, char **list, + int i; + FILE *out; + char filename[ PATH_MAX ]; +- char *last = NULL; ++ ENTRY e, *re; + + snprintf(filename, sizeof(filename), filetpl, fileext); + if (!(out = fopen(filename, "w"))) +@@ -989,13 +986,26 @@ list_write(RacStatus *rac, char **list, + + debug("writing list to %s", filename); + ++ hcreate(size); ++ + for (i = 0; i < size; i++) { +- if (last && strcmp(last, list[i]) == 0) +- /* remove duplicates */ +- continue; +- fprintf(out, "%s\n", list[i]); +- last = list[i]; ++ e.key = list[i]; ++ e.data = (void *) 1; ++ re = hsearch(e, ENTER); ++ if (re == NULL) { ++ // error ++ hdestroy(); ++ fclose(out); ++ return -1; ++ } ++ // if data is 1 it is a new entry ++ // if it is 0, it is an old entry, and as such we skip it ++ if ((int)re->data) { ++ fprintf(out, "%s\n", list[i]); ++ re->data = (void *)0; ++ } + } ++ hdestroy(); + + fclose(out); + return 0; +Index: readahead/src/readahead.c +=================================================================== +--- readahead.orig/src/readahead.c ++++ readahead/src/readahead.c +@@ -70,6 +70,7 @@ static long int maxsize; + #define MODE_FULL 1 + #define MODE_SORT 2 + #define MODE_FAST 3 ++#define MODE_BUILD 4 + + struct device { + dev_t st_dev; +@@ -424,7 +425,8 @@ static void + usage(int excode) + { + fprintf(stdout, _("\n%s [options] [...]\n\n"), progname); +- fputs(_(" -s | --sort sort list of files only\n" ++ fputs(_(" -b | --build build optimised list of files only\n" ++ " -s | --sort sort list of files only (implies -b)\n" + " -o | --output output sorted list of files\n" + " -d | --dont-sort call readahead(2) for already sorted list\n" + " -h | --help this help\n" +@@ -444,6 +446,7 @@ main(int argc, char **argv) + char *p, *output = NULL; + struct option opts[] = + { ++ { "build", 0, 0, 'b' }, + { "sort", 0, 0, 's' }, + { "dont-sort", 0, 0, 'd' }, + { "help", 0, 0, 'h' }, +@@ -467,7 +470,7 @@ main(int argc, char **argv) + if ((p = strrchr(argv[0], '/'))) + progname = p+1; + +- while((i = getopt_long(argc, argv, "dho:stvm:", opts, NULL)) != -1) { ++ while((i = getopt_long(argc, argv, "dho:bstvm:", opts, NULL)) != -1) { + switch(i) { + case 'd': + mode = MODE_FAST; +@@ -477,6 +480,9 @@ main(int argc, char **argv) + break; + case 'h': + usage(EXIT_SUCCESS); ++ case 'b': ++ mode = (mode != MODE_SORT)? MODE_BUILD : mode; ++ break; + case 's': + mode = MODE_SORT; + break; +@@ -505,7 +511,8 @@ main(int argc, char **argv) + if (verbose) { + fprintf(stderr, _("Mode: %s\n"), + mode == MODE_FULL ? "full" : +- mode == MODE_FAST ? "fast" : "sort" ); ++ mode == MODE_FAST ? "fast" : ++ mode == MODE_BUILD ? "build" : "build sorted" ); + if (output) + fprintf(stderr, _("Output: %s\n"), output); + for (i = 0; i < argc; i++) +@@ -535,7 +542,7 @@ main(int argc, char **argv) + if (mode == MODE_FULL || mode == MODE_FAST) + list_do_readahead(files, nfiles); + +- else if (mode == MODE_SORT) ++ else if (mode == MODE_SORT || mode == MODE_BUILD) + res = list_write(files, nfiles, output); + + list_destroy(files, nfiles); +Index: readahead/scripts/readahead.cron +=================================================================== +--- readahead.orig/scripts/readahead.cron ++++ readahead/scripts/readahead.cron +@@ -41,13 +41,24 @@ done + + if $MERGE_LISTS; then + tmpf="$(mktemp)" ++ ++ extra_opts=--sort ++ ++ major=$(stat -c '%D' . | cut -b1) ++ if [ -f "/sys/dev/block/${major}:0/queue/rotational" ]; then ++ rotational="$(cat "/sys/dev/block/${major}:0/queue/rotational")" ++ if [ "$rotational" = "0" ]; then ++ extra_opts=--build ++ fi ++ fi ++ + for LTYPE in $TYPES; do + f="$READAHEAD_BASE/$LTYPE.sorted" + [ -f "$f" ] || continue + cut -d\ -f2- "$f" >> "$tmpf" + done + if [ -s "$tmpf" ]; then +- $READAHEAD_CMD --sort --output="$READAHEAD_BASE/early.sorted" "$tmpf" >/dev/null 2>&1 ++ $READAHEAD_CMD $extra_opts --output="$READAHEAD_BASE/early.sorted" "$tmpf" >/dev/null 2>&1 + : > "$READAHEAD_BASE/later.sorted" + fi + rm -f "$tmpf" --- readahead-fedora-1.5.6.orig/debian/postinst +++ readahead-fedora-1.5.6/debian/postinst @@ -0,0 +1,205 @@ +#!/bin/sh + +set -e + +if [ "$1" = triggered ]; then + touch /.readahead_collect + exit 0 +fi + +#DEBHELPER# + +# The rest of the code is only meant to be run the first time the +# package is installed +if [ "$1" != configure ] || [ "$2" ]; then + exit 0 +fi + +# Trigger the collector on next boot +touch /.readahead_collect + +# Bootstrap the files lists. +# It is intended to help reduce boot time even on +# the very next boot after the package is installed. + +tmpdir="$(mktemp -d)" + +# takes the name of a binary and writes to the misc-libs +# the libraries it uses +get_libs() { + ldd "$1" 2>/dev/null | sed -nr 's,^[^/]+((/usr)?/lib/[^ ]+).+$,\1,;T;p' \ + >> $tmpdir/${2:-misc-libs} +} + +# is a kernel installed at all? +if [ -d /lib/modules ]; then + kern="$(uname -r)" + # try to find the kernel modules dir + [ -d "/lib/modules/$kern" ] || { + # the running kernel is not the one on the fs + # try to find one: + kern="$(find /lib/modules -mindepth 1 -maxdepth 1 -type d)" + # if more than one was found, the next test will fail + } + if [ -d "/lib/modules/$kern/" ]; then + # try to determine what modules are going to be loaded: + for module in $(cut -d\ -f1 /proc/modules | tr "_" "-"); do + find /lib/modules/$kern/ -name "${module}.ko" -type f >> $tmpdir/mods + done + for t in alias dep; do + f="/lib/modules/$kern/modules.$t.bin" + [ -f "$f" ] || continue + echo "$f" >> $tmpdir/mods.bin + done + fi +fi + +if [ -d /etc/rcS.d ] && [ -d /etc/rc2.d ]; then + # init scripts, when using sysvrc: + for rc in S 2; do + find /etc/rc${rc}.d -maxdepth 1 -type l -name 'S*' | xargs -r -n1 readlink -m >> $tmpdir/rc${rc} + done + cat $tmpdir/rc? | sh -c 'while read init; do [ -f "$init" ] && echo "$init"; done' | sort -u > $tmpdir/rc + rm $tmpdir/rc? +else + touch $tmpdir/rc +fi + +# default files +find /etc/default -type f > $tmpdir/def + +if [ -d /etc/modprobe.d ]; then + # modprobe + find /etc/modprobe.d -name '*.conf' -type f > $tmpdir/modprobe +fi + +if [ -d /etc/udev/ ]; then + # udev rules + find /etc/udev/rules.d/ /lib/udev/rules.d/ -type f > $tmpdir/udev + find /etc/udev/ -maxdepth 1 -type f -name '*.conf' -o -name '*.rules' >> $tmpdir/udev + # even more udev stuff + find /lib/udev -maxdepth 1 -type f -perm /a+x >> $tmpdir/udev +fi + +# init files +find /lib/init/ -maxdepth 1 -type f > $tmpdir/init + +if [ -d /etc/acpi/events ]; then + # not all the events are used, but the files are usually small enough + # that it won't matter + find /etc/acpi/events/ -type f > $tmpdir/acpi +fi + +if [ -d /usr/share/dbus-1/services ] && [ -d /usr/share/dbus-1/system-services ]; then + # dbus services + find /usr/share/dbus-1/services/ /usr/share/dbus-1/system-services/ -type f > $tmpdir/dbus +fi + +if [ -d /etc/dbus-1/system.d ]; then + # other dbus stuff + find /etc/dbus-1/system.d/ -type f >> $tmpdir/dbus +fi + +if [ -d /etc/cron.d ]; then + # cron.d files + find /etc/cron.d ! -name '.*' -type f > $tmpdir/cron +fi + +if [ -d /etc/network ]; then + # network config files + find /etc/network/ -type f > $tmpdir/net +fi + +if [ -d /etc/exim4/ ]; then + #exim4 config + find /etc/exim4/conf.d/ -type f > $tmpdir/exim4 +fi + +# some config files +for cfg in hostname sysctl.conf group passwd shadow nsswitch.conf fstab \ +inetd.conf crontab anacrontab services issue host.conf fonts/fonts.conf \ +modules localtime ld.so.cache motd.tail resolv.conf hosts X11/xorg.conf; do + [ -f "/etc/$cfg" ] && echo "/etc/$cfg" >> $tmpdir/misc-etc +done + +if [ -f /proc/mounts ]; then + # mount.* and fsck.* commands + sed -nr 's,^([^ ]+ ){2}([^ ]+).+$,\2,;T;h;s/^/mount./;p;g;s/^/fsck./;p' \ + /proc/mounts | sort -u | + while read cmd; do + [ -x "/sbin/$cmd" ] || continue + echo "/sbin/$cmd" >> $tmpdir/fs-bin + done +fi + +# some binaries +# TODO: automate some of the gathering of these files +for bin in dash bash Xorg udevadm modprobe cut tail xargs find mv ln \ +basename grep egrep rm mkdir mknod sleep which dd sed gzip ls cat \ +rmdir logsave uname start-stop-daemon mount umount swapon touch tput \ +mountpoint readlink ifup chown chmod chgrp loadkeys gunzip run-parts \ +lsmod df tempfile date env stat head dirname tr id sysctl X hostname \ +getopt savelog ps fsck getty dmesg stty xkbcomp locale gawk mawk \ +ifconfig setupcon setterm dumpkeys; do + for p in /bin /sbin /usr/bin /usr/sbin; do + [ -x "$p/$bin" ] && { + echo "$p/$bin" >> $tmpdir/misc-bin + get_libs "$p/$bin" + continue 2 + } + done +done + +# binaries that match the name of the init scripts +for init in $(cat $tmpdir/rc); do + init="${init#/etc/init.d/}" + for p in /bin /sbin /usr/bin /usr/sbin; do + for suffix in '' d; do + bin="$p/${init}${suffix}" + [ -x "$bin" ] || continue + echo "$bin" >> $tmpdir/init-misc + get_libs "$bin" + done + done +done + +# config files that match the name of the init scripts +for init in $(cat $tmpdir/rc); do + init="${init#/etc/init.d/}" + for suffix in '' d .conf d.conf; do + f="/etc/${init}${suffix}" + [ -f "$f" ] && echo "$f" >> $tmpdir/init-misc + done +done + +# get the libs used by the libs +for lib in $(sort -u $tmpdir/misc-libs); do + get_libs "$lib" misc-libs.new +done + +sort -u $tmpdir/misc-libs $tmpdir/misc-libs.new | xargs -n1 readlink -f > $tmpdir/misc-libs.unique +rm $tmpdir/misc-libs.new $tmpdir/misc-libs + +tmpf_early=$(mktemp) +tmpf_later=$(mktemp) + +cat $tmpdir/* > $tmpf_early + +# simple way to check if /usr is in a separate partition/device/etc +if [ "$(stat -c "%d" /)" != "$(stat -c "%d" /usr/bin)" ]; then + sed -n '\,^/usr,p' $tmpf_early > $tmpf_later + sed -i '\,^/usr,d' $tmpf_early +fi + +rm -rf $tmpdir + +# install the files lists +[ -f /etc/readahead.d/custom.early ] && \ +rm -f $tmpf_early || \ +mv $tmpf_early /etc/readahead.d/custom.early +[ -f /etc/readahead.d/custom.later ] && \ +rm -f $tmpf_later || \ +mv $tmpf_later /etc/readahead.d/custom.later + +# now sort them +exec /usr/share/readahead-fedora/build-lists --- readahead-fedora-1.5.6.orig/debian/postrm +++ readahead-fedora-1.5.6/debian/postrm @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +if [ "$1" = "purge" ]; then + rm -f /.readahead_collect + rm -f /run/readahead + if [ -d /etc/readahead.d ]; then + for t in early later; do + rm -f /etc/readahead.d/$t.sorted + rm -f /etc/readahead.d/*.$t + done + rmdir --ignore-fail-on-non-empty /etc/readahead.d + fi +fi + +#DEBHELPER# --- readahead-fedora-1.5.6.orig/debian/preinst +++ readahead-fedora-1.5.6/debian/preinst @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +# If we are installing over a non-purged installation, or upgrading +# and the /var/lib directory is still around, move it to /etc +if [ "$1" = "upgrade" -o "$1" = "install" ] && [ "$2" ] \ + && [ -d /var/lib/readahead ]; then + # only move the directory if the new dir doesn't exist, just in case + if [ ! -d /etc/readahead.d ] && [ ! -e /etc/readahead.d ]; then + mv /var/lib/readahead /etc/readahead.d + fi +fi + +#DEBHELPER# --- readahead-fedora-1.5.6.orig/debian/rules +++ readahead-fedora-1.5.6/debian/rules @@ -0,0 +1,49 @@ +#!/usr/bin/make -f + +PKG=readahead-fedora +DEB_INSTALL_CHANGELOGS_ALL = NEWS +DEB_INSTALL_DOCS_$(PKG) = lists/README.lists debian/README.bootchart +DEB_INSTALL_MANPAGES_$(PKG) = $(wildcard debian/man/*) + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/autotools.mk +include /usr/share/cdbs/1/rules/patchsys-quilt.mk + +post-patches:: + [ -f configure ] || $(CURDIR)/autogen.sh + +binary-post-install/$(PKG):: + $(RM) debian/$(PKG)/usr/share/doc/$(PKG)/NEWS* + $(RM) -r debian/$(PKG)/usr/share/locale/ + for f in debian/$(PKG)/etc/cron.*/*; do \ + mv $$f $${f%.cron}; \ + done + mv debian/$(PKG)/etc/cron.daily/readahead debian/$(PKG)/usr/share/$(PKG)/build-lists + rmdir debian/$(PKG)/etc/cron.daily + chmod +x debian/$(PKG)/usr/share/$(PKG)/build-lists + mv debian/$(PKG)/etc/default/* debian/$(PKG)/etc/default/$(PKG) + +binary-install/$(PKG):: + # debhelper doesn't like more than one init script per package + # and cdbs doesn't help us with that either. + mkdir -p debian/$(PKG)/etc/init.d + for script in early later; do \ + cp debian/init.d/readahead debian/$(PKG)/etc/init.d/$$script-readahead; \ + sed -i "s/@STEP@/$$script/g" debian/$(PKG)/etc/init.d/$$script-readahead; \ + done + dh_installinit -p$(PKG) -o --no-start --name=early-readahead \ + -- start 03 S . + dh_installinit -p$(PKG) -o --no-start --name=later-readahead \ + -- start 50 S . + sed -i "s/\$$remote_fs//" debian/$(PKG)/etc/init.d/early-readahead + sed -ri '/Start-Before:/ s/:.+$$/:/' debian/$(PKG)/etc/init.d/later-readahead + cp debian/init.d/stop-readahead-fedora debian/$(PKG)/etc/init.d + dh_installinit -p$(PKG) -o --no-start --name=stop-readahead-fedora \ + -- start 99 2 3 4 5 . stop 20 0 1 6 . + +clean:: + find $(CURDIR) -name '*Makefile.in' -delete + $(RM) config/*[!.][!a][!m] *.m4 config.h.in configure ABOUT-NLS \ + po/*.gmo po/Makefile.in.in po/*.sin po/*.sed po/*.header \ + po/*.template po/*quot* po/*stamp* lists/Makefile + $(RM) -r m4 --- readahead-fedora-1.5.6.orig/debian/source/format +++ readahead-fedora-1.5.6/debian/source/format @@ -0,0 +1 @@ +1.0 --- readahead-fedora-1.5.6.orig/debian/triggers +++ readahead-fedora-1.5.6/debian/triggers @@ -0,0 +1,2 @@ +interest-noawait /etc/init.d +interest-noawait /lib/modules --- readahead-fedora-1.5.6.orig/debian/watch +++ readahead-fedora-1.5.6/debian/watch @@ -0,0 +1,3 @@ +version=3 +http://git.fedorahosted.org/git/?p=readahead;a=tags \ + /git/?\?p=readahead;.+h=refs/tags/[vr](.+)