diff -u readahead-fedora-1.5.6/debian/control readahead-fedora-1.5.6/debian/control --- readahead-fedora-1.5.6/debian/control +++ readahead-fedora-1.5.6/debian/control @@ -3,14 +3,13 @@ Priority: optional Maintainer: Raphael Geissert Build-Depends: debhelper (>= 6), cdbs, quilt, e2fslibs-dev, libaudit-dev, libblkid-dev, autopoint | cvs, autopoint | gettext (<< 0.17-10), autoconf, automake -Standards-Version: 3.8.4 +Standards-Version: 3.9.2 Homepage: https://fedorahosted.org/readahead/ Package: readahead-fedora Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, dpkg (>= 1.15.0) -Conflicts: ureadahead, sreadahead -Breaks: readahead (<< 2:1.5.4-2) +Depends: ${shlibs:Depends}, ${misc:Depends}, dpkg (>= 1.15.7.2), initscripts (>= 2.88dsf-13.3) +Conflicts: ureadahead, sreadahead, readahead Provides: readahead Replaces: readahead Description: Fedora's implementation of readahead to preload boot process files @@ -27,10 +25,0 @@ - -Package: readahead -Depends: readahead-fedora, ${misc:Depends} -Architecture: any -Description: read files into the page cache (dummy transitional package) - This package helps users transition to the readahead-fedora package, - which superseeds the readahead-list implementation. - . - Once readahead-fedora is installed, this package should be removed and - purged. diff -u readahead-fedora-1.5.6/debian/postrm readahead-fedora-1.5.6/debian/postrm --- readahead-fedora-1.5.6/debian/postrm +++ readahead-fedora-1.5.6/debian/postrm @@ -4,7 +4,7 @@ if [ "$1" = "purge" ]; then rm -f /.readahead_collect - rm -f /lib/init/rw/readahead + rm -f /run/readahead if [ -d /etc/readahead.d ]; then for t in early later; do rm -f /etc/readahead.d/$t.sorted @@ -16,2 +16,5 @@ +dpkg-maintscript-helper rm_conffile /etc/cron.daily/readahead \ + "2:1.5.6-1" -- "$@" + #DEBHELPER# diff -u readahead-fedora-1.5.6/debian/dirs readahead-fedora-1.5.6/debian/dirs --- readahead-fedora-1.5.6/debian/dirs +++ readahead-fedora-1.5.6/debian/dirs @@ -1,0 +2 @@ +usr/share/readahead-fedora diff -u readahead-fedora-1.5.6/debian/preinst readahead-fedora-1.5.6/debian/preinst --- readahead-fedora-1.5.6/debian/preinst +++ readahead-fedora-1.5.6/debian/preinst @@ -14,2 +14,7 @@ +if dpkg-maintscript-helper supports rm_conffile; then + dpkg-maintscript-helper rm_conffile /etc/cron.daily/readahead \ + "2:1.5.6-1" -- "$@" +fi + #DEBHELPER# diff -u readahead-fedora-1.5.6/debian/rules readahead-fedora-1.5.6/debian/rules --- readahead-fedora-1.5.6/debian/rules +++ readahead-fedora-1.5.6/debian/rules @@ -1,7 +1,6 @@ #!/usr/bin/make -f PKG=readahead-fedora -PKG_FILES=postinst preinst postrm triggers dirs lintian-overrides DEB_INSTALL_CHANGELOGS_ALL = NEWS DEB_INSTALL_DOCS_$(PKG) = lists/README.lists debian/README.bootchart DEB_INSTALL_MANPAGES_$(PKG) = $(wildcard debian/man/*) @@ -12,11 +11,6 @@ post-patches:: [ -f configure ] || $(CURDIR)/autogen.sh - # debhelper's ugliness requires yet another hack... - for f in $(PKG_FILES); do \ - [ -f debian/$(PKG).$$f ] || \ - ln debian/$$f debian/$(PKG).$$f; \ - done binary-post-install/$(PKG):: $(RM) debian/$(PKG)/usr/share/doc/$(PKG)/NEWS* @@ -24,12 +18,12 @@ 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):: - # another hack... - [ ! -d debian/tmp ] || \ - cp -a debian/tmp/* debian/$(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 @@ -56,3 +49,0 @@ - for f in $(PKG_FILES); do \ - $(RM) debian/$(PKG).$$f; \ - done reverted: --- readahead-fedora-1.5.6/debian/readahead.postrm +++ readahead-fedora-1.5.6.orig/debian/readahead.postrm @@ -1,15 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "purge" ]; then - rm -f /etc/readahead/profile-once - [ ! -d /etc/readahead ] || \ - rmdir --ignore-fail-on-non-empty /etc/readahead - - for script in readahead readahead-desktop stop-readahead; do - update-rc.d $script remove >/dev/null || exit $? - done -fi - -#DEBHELPER# diff -u readahead-fedora-1.5.6/debian/changelog readahead-fedora-1.5.6/debian/changelog --- readahead-fedora-1.5.6/debian/changelog +++ readahead-fedora-1.5.6/debian/changelog @@ -1,3 +1,39 @@ +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) diff -u readahead-fedora-1.5.6/debian/watch readahead-fedora-1.5.6/debian/watch --- readahead-fedora-1.5.6/debian/watch +++ readahead-fedora-1.5.6/debian/watch @@ -1,3 +1,3 @@ version=3 -http://git.fedoraproject.org/git/?p=readahead;a=tags \ +http://git.fedorahosted.org/git/?p=readahead;a=tags \ /git/?\?p=readahead;.+h=refs/tags/[vr](.+) diff -u readahead-fedora-1.5.6/debian/postinst readahead-fedora-1.5.6/debian/postinst --- readahead-fedora-1.5.6/debian/postinst +++ readahead-fedora-1.5.6/debian/postinst @@ -18,6 +18,15 @@ touch /.readahead_collect fi +if [ "$1" = configure ] && dpkg --compare-versions "$2" le-nl 2:1.5.6-1; then + if [ -f /lib/init/rw/readahead ] && [ -d /run/ ]; then + mv /lib/init/rw/readahead /run + fi +fi + +dpkg-maintscript-helper rm_conffile /etc/cron.daily/readahead \ + "2:1.5.6-1" -- "$@" + #DEBHELPER# # The rest of the code is only meant to be run the first time the @@ -216 +225 @@ -[ ! -x /etc/cron.daily/readahead ] || /etc/cron.daily/readahead +exec /usr/share/readahead-fedora/build-lists diff -u readahead-fedora-1.5.6/debian/patches/debianise.patch readahead-fedora-1.5.6/debian/patches/debianise.patch --- readahead-fedora-1.5.6/debian/patches/debianise.patch +++ readahead-fedora-1.5.6/debian/patches/debianise.patch @@ -2,7 +2,7 @@ =================================================================== --- readahead.orig/src/readahead.conf +++ readahead/src/readahead.conf -@@ -15,19 +15,19 @@ RAC_INITPATH="/sbin/init" +@@ -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" @@ -14,7 +14,7 @@ # 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" ++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" @@ -26,11 +26,23 @@ # 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 -@@ -10,7 +10,7 @@ The program works in three modes: +@@ -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 @@ -39,7 +51,7 @@ 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,7 +26,7 @@ The program works in three modes: +@@ -26,18 +27,16 @@ The program works in three modes: 2) sort mode @@ -48,8 +60,11 @@ 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 -@@ -37,7 +37,7 @@ The program works in three modes: + 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 @@ -57,7 +72,7 @@ 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 +52,30 @@ during boot process. The goal is to gen +@@ -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(), ... @@ -68,46 +83,43 @@ - -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. --A newly generated lists you will found in +-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 -- /var/lib/readahead/custom.{early,later} + touch /.readahead_collect --WARNING: you have to disable auditd by: +-BUILDING +--------- +To manually trigger the collector on grub or any other boot loader that +supports passing parameters add the word 'profile' (without the quotes). -- # chkconfig auditd off -+Note: the Debian package uses triggers in addition to a monthly and -+daily cronjobs that are designed to keep a good performance without +-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. --It's because auditd deletes all audit rules during boot. That's --contra-productive for the collector. +WARNING: if you have auditd installed you have to disable it by removing its symlink -+ from rcS.d. This because auditd deletes all audit rules during boot. That's -+ contra-productive for the collector. - - 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. -- -- --BUILDING ---------- -- --The e2fsprogs and e2fsprogs-devel packages are required to build and run the --program. -- -+ If readahead-collector is started by upstart and if /.readahead_collect is -+ present (which is created by a monthly cron job) the auditd and -+ restorecond services startup is delayed. ++ from rcS.d, at least when profiling. auditd deletes all audit rules ++ during boot, interfering with collector. CREDIT ------ @@ -187,28 +199,28 @@ =================================================================== --- readahead.orig/scripts/readahead_early +++ readahead/scripts/readahead_early -@@ -34,7 +34,7 @@ READAHEAD_CMD="/sbin/readahead" +@@ -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 - start() { - LTYPE="early" + RETVAL=0 + VAR_SUBSYS_READAHEAD="/var/lock/subsys/readahead_early" Index: readahead/scripts/readahead_later =================================================================== --- readahead.orig/scripts/readahead_later +++ readahead/scripts/readahead_later -@@ -32,7 +32,7 @@ READAHEAD_CMD="/sbin/readahead" +@@ -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 - start() { - LTYPE="later" + RETVAL=0 + VAR_SUBSYS_READAHEAD="/var/lock/subsys/readahead_later" Index: readahead/scripts/readahead-monthly.cron =================================================================== --- readahead.orig/scripts/readahead-monthly.cron @@ -242,7 +254,7 @@ =================================================================== --- readahead.orig/readahead +++ readahead/readahead -@@ -4,16 +4,17 @@ READAHEAD="yes" +@@ -4,17 +4,14 @@ READAHEAD="yes" # enable (at least monthly) readahead list collection READAHEAD_COLLECT="yes" @@ -252,21 +264,22 @@ -# 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" ++# enable to run readahead in the background instead of blocking ++# useful for SSDs ++#RUN_IN_BACKGROUND="yes" + +-# 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" - - # Minimum memory the machine has to have (kB) - # to run readahead. Index: readahead/scripts/Makefile.am =================================================================== --- readahead.orig/scripts/Makefile.am diff -u readahead-fedora-1.5.6/debian/patches/series readahead-fedora-1.5.6/debian/patches/series --- readahead-fedora-1.5.6/debian/patches/series +++ readahead-fedora-1.5.6/debian/patches/series @@ -1,3 +1,5 @@ +timer_macro.patch +monotonic_clock.patch better-cron.patch no_dependency_on_ionice.patch debianise.patch @@ -10,2 +12,10 @@ -use_fadvise.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 +rac_dont_list_rewritten_files.patch +only_open_files_once.patch +more_efficient_build-lists.patch reverted: --- readahead-fedora-1.5.6/debian/patches/use_fadvise.patch +++ readahead-fedora-1.5.6.orig/debian/patches/use_fadvise.patch @@ -1,80 +0,0 @@ -Index: readahead/src/readahead.c -=================================================================== ---- readahead.orig/src/readahead.c -+++ readahead/src/readahead.c -@@ -56,6 +56,7 @@ - static char *progname; - static int verbose; - static int timing; -+static int pfadv; - static long int maxsize; - - /* Modes */ -@@ -373,7 +374,11 @@ list_do_readahead(struct file *files, in - #else - if ((fd = open(file->path, O_RDONLY)) != -1) { - #endif -- readahead(fd, 0, file->size); -+ if (pfadv) { -+ posix_fadvise(fd, 0, file->size, POSIX_FADV_WILLNEED); -+ } else { -+ readahead(fd, 0, file->size); -+ } - close(fd); - total += file->size; - fcount++; /* number of really loaded files */ -@@ -424,6 +429,7 @@ usage(int excode) - " -h | --help this help\n" - " -v | --verbose verbose mode\n" - " -t | --timing report wasted time\n" -+ " -f | --fadvise use fadvise instead of readahead\n" - " -m | --maxsize <10240> max size of a file to be preloaded (in KiB)\n" - "\n"), stdout); - -@@ -445,6 +451,7 @@ main(int argc, char **argv) - { "output", 1, 0, 'o' }, - { "verbose", 0, 0, 'v' }, - { "timing", 0, 0, 't' }, -+ { "fadvise", 0, 0, 'f' }, - { "maxsize", 1, 0, 'm' }, - { NULL, 0, 0, 0 } - }; -@@ -462,7 +469,7 @@ main(int argc, char **argv) - if ((p = strrchr(argv[0], '/'))) - progname = p+1; - -- while((i = getopt_long(argc, argv, "dho:bstvm:", opts, NULL)) != -1) { -+ while((i = getopt_long(argc, argv, "dho:bstvm:f", opts, NULL)) != -1) { - switch(i) { - case 'd': - mode = MODE_FAST; -@@ -483,6 +490,9 @@ main(int argc, char **argv) - case 'v': - verbose = 1; - break; -+ case 'f': -+ pfadv = 1; -+ break; - case 'm': - maxsize = strtol(optarg, NULL, 10); - break; -@@ -509,6 +519,7 @@ main(int argc, char **argv) - fprintf(stderr, _("Output: %s\n"), output); - for (i = 0; i < argc; i++) - fprintf(stderr, _("List: %s\n"), argv[i]); -+ fprintf(stderr, _("Preload method: %s\n"), pfadv? "fadvise" : "readahead"); - } - - -Index: readahead/readahead -=================================================================== ---- readahead.orig/readahead -+++ readahead/readahead -@@ -23,3 +23,7 @@ READAHEAD_MIN_MEM=393216 - # Don't preload files bigger than x KiBs - # leave commented to use readahead's built-in default - #MAX_FILE_SIZE=10240 -+ -+# use fadvise instead of readahead -- experimental, might perform -+# better on SSDs. Default is to use readahead (i.e. "no") -+#USE_FADVISE="yes" diff -u readahead-fedora-1.5.6/debian/patches/later_means_with_usr.patch readahead-fedora-1.5.6/debian/patches/later_means_with_usr.patch --- readahead-fedora-1.5.6/debian/patches/later_means_with_usr.patch +++ readahead-fedora-1.5.6/debian/patches/later_means_with_usr.patch @@ -14,8 +14,8 @@ --exec $READAHEAD_CMD --startas $0 fi -+if [ -f /lib/init/rw/readahead ]; then -+ . /lib/init/rw/readahead ++if [ -f /run/readahead ]; then ++ . /run/readahead + if $MOUNTED_USR && $MOUNTED_VAR; then + MERGE_LISTS=true + fi diff -u readahead-fedora-1.5.6/debian/patches/unsorted_custom_lists.patch readahead-fedora-1.5.6/debian/patches/unsorted_custom_lists.patch --- readahead-fedora-1.5.6/debian/patches/unsorted_custom_lists.patch +++ readahead-fedora-1.5.6/debian/patches/unsorted_custom_lists.patch @@ -69,7 +69,7 @@ =================================================================== --- readahead.orig/src/readahead.c +++ readahead/src/readahead.c -@@ -62,6 +62,7 @@ static long int maxsize; +@@ -70,6 +70,7 @@ static long int maxsize; #define MODE_FULL 1 #define MODE_SORT 2 #define MODE_FAST 3 @@ -77,7 +77,7 @@ struct device { dev_t st_dev; -@@ -416,7 +417,8 @@ static void +@@ -424,7 +425,8 @@ static void usage(int excode) { fprintf(stdout, _("\n%s [options] [...]\n\n"), progname); @@ -87,7 +87,7 @@ " -o | --output output sorted list of files\n" " -d | --dont-sort call readahead(2) for already sorted list\n" " -h | --help this help\n" -@@ -436,6 +438,7 @@ main(int argc, char **argv) +@@ -444,6 +446,7 @@ main(int argc, char **argv) char *p, *output = NULL; struct option opts[] = { @@ -95,7 +95,7 @@ { "sort", 0, 0, 's' }, { "dont-sort", 0, 0, 'd' }, { "help", 0, 0, 'h' }, -@@ -459,7 +462,7 @@ main(int argc, char **argv) +@@ -467,7 +470,7 @@ main(int argc, char **argv) if ((p = strrchr(argv[0], '/'))) progname = p+1; @@ -104,7 +104,7 @@ switch(i) { case 'd': mode = MODE_FAST; -@@ -469,6 +472,9 @@ main(int argc, char **argv) +@@ -477,6 +480,9 @@ main(int argc, char **argv) break; case 'h': usage(EXIT_SUCCESS); @@ -114,7 +114,7 @@ case 's': mode = MODE_SORT; break; -@@ -497,7 +503,8 @@ main(int argc, char **argv) +@@ -505,7 +511,8 @@ main(int argc, char **argv) if (verbose) { fprintf(stderr, _("Mode: %s\n"), mode == MODE_FULL ? "full" : @@ -124,7 +124,7 @@ if (output) fprintf(stderr, _("Output: %s\n"), output); for (i = 0; i < argc; i++) -@@ -527,7 +534,7 @@ main(int argc, char **argv) +@@ -535,7 +542,7 @@ main(int argc, char **argv) if (mode == MODE_FULL || mode == MODE_FAST) list_do_readahead(files, nfiles); diff -u readahead-fedora-1.5.6/debian/patches/no_io_priority_handling.patch readahead-fedora-1.5.6/debian/patches/no_io_priority_handling.patch --- readahead-fedora-1.5.6/debian/patches/no_io_priority_handling.patch +++ readahead-fedora-1.5.6/debian/patches/no_io_priority_handling.patch @@ -2,15 +2,15 @@ =================================================================== --- readahead.orig/src/readahead.c +++ readahead/src/readahead.c -@@ -35,7 +35,6 @@ +@@ -34,7 +34,6 @@ + #include #include #include - #include -#include #include #include #include -@@ -43,16 +42,6 @@ +@@ -42,16 +41,6 @@ #include #include "nls.h" @@ -27,7 +27,7 @@ #define MAXFILES 32768 #define MAXDEVICES 32 -@@ -511,10 +500,6 @@ main(int argc, char **argv) +@@ -519,10 +508,6 @@ main(int argc, char **argv) } diff -u readahead-fedora-1.5.6/debian/patches/ignore-large-files.patch readahead-fedora-1.5.6/debian/patches/ignore-large-files.patch --- readahead-fedora-1.5.6/debian/patches/ignore-large-files.patch +++ readahead-fedora-1.5.6/debian/patches/ignore-large-files.patch @@ -2,10 +2,10 @@ =================================================================== --- readahead.orig/readahead +++ readahead/readahead -@@ -19,3 +19,7 @@ READAHEAD_EXTRA_COLLECT="10" - # Minimum memory the machine has to have (kB) - # to run readahead. - READAHEAD_MIN_MEM=393216 +@@ -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 diff -u readahead-fedora-1.5.6/debian/patches/no_i18n.patch readahead-fedora-1.5.6/debian/patches/no_i18n.patch --- readahead-fedora-1.5.6/debian/patches/no_i18n.patch +++ readahead-fedora-1.5.6/debian/patches/no_i18n.patch @@ -2,7 +2,7 @@ =================================================================== --- readahead.orig/src/readahead.c +++ readahead/src/readahead.c -@@ -38,7 +38,6 @@ +@@ -37,7 +37,6 @@ #include #include #include @@ -10,7 +10,7 @@ #include #include "nls.h" -@@ -461,10 +460,6 @@ main(int argc, char **argv) +@@ -462,10 +461,6 @@ main(int argc, char **argv) maxsize = 10240; diff -u readahead-fedora-1.5.6/debian/patches/dontsort_also_preloads_inodes.patch readahead-fedora-1.5.6/debian/patches/dontsort_also_preloads_inodes.patch --- readahead-fedora-1.5.6/debian/patches/dontsort_also_preloads_inodes.patch +++ readahead-fedora-1.5.6/debian/patches/dontsort_also_preloads_inodes.patch @@ -2,7 +2,7 @@ =================================================================== --- readahead.orig/src/readahead.c +++ readahead/src/readahead.c -@@ -255,7 +255,7 @@ list_sort_by_paths(struct file *files, i +@@ -263,7 +263,7 @@ list_sort_by_paths(struct file *files, i } static void @@ -11,14 +11,7 @@ { int i; struct file *file, *last = NULL; -@@ -298,18 +298,23 @@ list_read_blocks(struct file *files, int - continue; /* mounted over NFS */ - if (st.st_size == 0 || (maxsize >= 0 && st.st_size > (maxsize*1024))) - continue; /* empty or too big file */ -- file->size = st.st_size; -+ if (update) -+ file->size = st.st_size; - dev = get_file_device(st.st_dev, devices, &ndevices); +@@ -311,13 +311,17 @@ list_read_blocks(struct file *files, int if (dev == NULL || dev->fs == NULL) continue; /* no dev? */ @@ -33,14 +26,14 @@ - dev->group_hits[group]++; + if (dev->group_hits[group] == GROUP_HIT_THRESH) + preload_inodes(dev->fs, group); -+ -+ dev->group_hits[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); -@@ -513,8 +518,8 @@ main(int argc, char **argv) +@@ -521,8 +525,8 @@ main(int argc, char **argv) if (mode == MODE_FULL || mode == MODE_SORT) list_sort_by_paths(files, nfiles); diff -u readahead-fedora-1.5.6/debian/init.d/stop-readahead-fedora readahead-fedora-1.5.6/debian/init.d/stop-readahead-fedora --- readahead-fedora-1.5.6/debian/init.d/stop-readahead-fedora +++ readahead-fedora-1.5.6/debian/init.d/stop-readahead-fedora @@ -3,7 +3,7 @@ ### BEGIN INIT INFO # Provides: stop-readahead-fedora # Required-Start: $all -# Required-Stop: +# Required-Stop: $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: init script for stopping readahead profiling @@ -13,25 +13,56 @@ [ -x $READAHEAD_COLLECT_CMD ] || exit 0 -if test ! -f /.readahead_collect && ! grep -qw "profile" /proc/cmdline; then - 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 -pidof readahead-collector >/dev/null || exit 0 +# 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) - ( - rm -f /.readahead_collect - sleep ${READAHEAD_EXTRA_COLLECT:-0} - /sbin/start-stop-daemon --stop --quiet --oknodo \ - --exec "$READAHEAD_COLLECT_CMD" - if [ -x /etc/cron.daily/readahead ]; then - /etc/cron.daily/readahead + 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) ;; diff -u readahead-fedora-1.5.6/debian/init.d/readahead readahead-fedora-1.5.6/debian/init.d/readahead --- readahead-fedora-1.5.6/debian/init.d/readahead +++ readahead-fedora-1.5.6/debian/init.d/readahead @@ -17,12 +17,10 @@ [ -x $READAHEAD_CMD ] || exit 0 . /lib/lsb/init-functions -. /lib/init/splash-functions-base RUN_IN_BACKGROUND= IO_PRIORITY= MAX_FILE_SIZE= -USE_FADVISE= READAHEAD_BASE=/etc/readahead.d [ ! -f /etc/default/readahead-fedora ] || . /etc/default/readahead-fedora @@ -37,14 +35,7 @@ MAX_FILE_SIZE="-m $MAX_FILE_SIZE" fi -case "$USE_FADVISE" in - yes) - USE_FADVISE=-f - ;; - *) - USE_FADVISE= - ;; -esac +NICE_COLLECTOR="-N ${NICE_COLLECTOR:-5}" get_lists() { if [ -f "$READAHEAD_BASE/$LTYPE.sorted" ]; then @@ -63,7 +54,7 @@ case "$1" in start|restart|force-reload) - [ -f /lib/init/rw/readahead ] || { + [ -f /run/readahead ] || { [ "$LTYPE" = early ] || { log_warning_msg "Early readahead flag not found" } @@ -75,29 +66,27 @@ # daily cronjob that sorts the files lists MOUNTED_USR=$([ -d /usr/bin ] && echo true || echo false) MOUNTED_VAR=$([ -d /var/lib ] && echo true || echo false) - " > /lib/init/rw/readahead + " > /run/readahead } - if [ "$RUN_IN_BACKGROUND" = yes ] && $SHOULD_COLLECT; then + 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 \ - -- $USE_FADVISE $MAX_FILE_SIZE $(get_lists) > /dev/null; then + -- $MAX_FILE_SIZE $(get_lists) > /dev/null; then log_end_msg 0 else log_end_msg $? fi else - splash_start_indefinite log_begin_msg "Reading $LTYPE boot files..." if /sbin/start-stop-daemon --start --quiet \ -I ${IO_PRIORITY:-real-time} --exec $READAHEAD_CMD \ - -- $USE_FADVISE $MAX_FILE_SIZE $(get_lists) > /dev/null; then + -- $MAX_FILE_SIZE $(get_lists) > /dev/null; then log_end_msg 0 else log_end_msg $? fi - splash_stop_indefinite fi if $SHOULD_COLLECT; then @@ -106,12 +95,15 @@ exit 1 fi log_begin_msg "Preparing to profile boot sequence..." - if /sbin/start-stop-daemon --start --quiet \ + 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) diff -u readahead-fedora-1.5.6/debian/man/readahead.8 readahead-fedora-1.5.6/debian/man/readahead.8 --- readahead-fedora-1.5.6/debian/man/readahead.8 +++ readahead-fedora-1.5.6/debian/man/readahead.8 @@ -14,7 +14,7 @@ .\" 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" "August 2009" +.TH readahead "8" "July 2011" .SH NAME readahead \- file preloader for boot process optimization .SH SYNOPSIS @@ -46,9 +46,6 @@ .B -t, --timing report time spent on each operation. .TP -.B -f, --fadvise -use posix_fadvise(2) instead of readahead(2) as preloading method. -.TP .B -m, --maxsize maximum size in KiB a file can be in order to be preloaded, default is \fI10240\fP. @@ -62,7 +59,6 @@ .SH "SEE ALSO" .BR readahead-collector (8), .BR readahead (2), -.BR posix_fadvise (2) .SH AUTHORS .TP Arjan van de Ven , only in patch2: unchanged: --- 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 only in patch2: unchanged: --- readahead-fedora-1.5.6.orig/debian/examples +++ readahead-fedora-1.5.6/debian/examples @@ -0,0 +1 @@ +debian/dpkg.cfg only in patch2: unchanged: --- 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; + } only in patch2: unchanged: --- 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 + only in patch2: unchanged: --- 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" only in patch2: unchanged: --- readahead-fedora-1.5.6.orig/debian/patches/rac_dont_list_rewritten_files.patch +++ readahead-fedora-1.5.6/debian/patches/rac_dont_list_rewritten_files.patch @@ -0,0 +1,85 @@ +Index: readahead/src/readahead-collector.c +=================================================================== +--- readahead.orig/src/readahead-collector.c ++++ readahead/src/readahead-collector.c +@@ -1021,9 +1021,11 @@ static char ** + parse_events(RacStatus *rac, char **ary, int *_nfiles, int *sep) + { + char **all; ++ char *toignore[1001] = {NULL}; + int nfiles = 0; + int ignlen = 0; + int begin = 0; ++ int nignore = 0; + auparse_state_t *au; + + *_nfiles = *sep = 0; +@@ -1049,7 +1051,7 @@ parse_events(RacStatus *rac, char **ary, + /* audit uses quotation marks in auparse_find_field() result */ + char path[PATH_MAX+3]; + char cwd[PATH_MAX+3]; +- int wanted = 1; ++ int wanted = 1, addtoignore = 0; + + if (auparse_first_record(au) <= 0) + return NULL; +@@ -1087,8 +1089,9 @@ parse_events(RacStatus *rac, char **ary, + else if (flags & O_WRONLY || + flags & O_EXCL || + flags & O_TRUNC) { +- wanted = 0; +- break; ++ /* don't set wanted, will reject it ++ * later because of 'addtoignore' */ ++ addtoignore = 1; + } + } + } +@@ -1132,6 +1135,23 @@ parse_events(RacStatus *rac, char **ary, + if (*buff != '/') + continue; + ++ if (addtoignore) { ++ if (nignore == (sizeof(toignore)-1)) { ++ debug("Reached max number of files to ignore"); ++ continue; ++ } ++ /* don't add the last filename. We don't ++ * use a hash table, so it's the best ++ * attempt to easily minimise dups */ ++ if (nignore && !strcmp(buff, toignore[nignore-1])) ++ continue; ++ ++ debug("previous path added to ignore list"); ++ toignore[nignore] = strdup(buff); ++ toignore[++nignore] = NULL; ++ continue; ++ } ++ + /* + * Lookup for begin of the list (if defined) + */ +@@ -1151,6 +1171,12 @@ parse_events(RacStatus *rac, char **ary, + if (exclude_file(rac->excludes, buff)) + continue; + ++ /* exclude files that were written to in an ++ * earlier event. ++ */ ++ if (exclude_file(toignore, buff)) ++ continue; ++ + if (stat(buff, &st) == -1 || S_ISREG(st.st_mode) == 0) + continue; + +@@ -1172,6 +1198,10 @@ parse_events(RacStatus *rac, char **ary, + + auparse_destroy(au); + ++ while (--nignore) { ++ free(toignore[nignore]); ++ } ++ + all[nfiles] = NULL; + *_nfiles = nfiles; + return all; only in patch2: unchanged: --- 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"); only in patch2: unchanged: --- 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"))) only in patch2: unchanged: --- 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 ); only in patch2: unchanged: --- 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"); + only in patch2: unchanged: --- 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 only in patch2: unchanged: --- 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); only in patch2: unchanged: --- 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")))