diff options
Diffstat (limited to 'sys-apps/preload/files')
9 files changed, 313 insertions, 0 deletions
diff --git a/sys-apps/preload/files/00-patch-configure.diff b/sys-apps/preload/files/00-patch-configure.diff new file mode 100644 index 000000000000..0fa5feb47b1f --- /dev/null +++ b/sys-apps/preload/files/00-patch-configure.diff @@ -0,0 +1,15 @@ +--- configure.ac~ 2009-04-15 23:47:52.000000000 +0200 ++++ configure.ac 2010-03-29 17:59:39.000000000 +0200 +@@ -54,9 +54,9 @@ + PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.14) + + # Directories we need. +-pkgdocdir='${datadir}/doc/'${PACKAGE_NAME}-${PACKAGE_VERSION} +-initddir='${sysconfdir}/rc.d/init.d' +-sysconfigdir='${sysconfdir}/sysconfig' ++pkgdocdir='${datadir}/doc/'${PF} ++initddir='${sysconfdir}/init.d' ++sysconfigdir='${sysconfdir}/conf.d' + logrotatedir='${sysconfdir}/logrotate.d' + logdir='${localstatedir}/log' + subsysdir='${localstatedir}/lock/subsys' diff --git a/sys-apps/preload/files/0001-Early-restart-of-forking-readahead-children.patch b/sys-apps/preload/files/0001-Early-restart-of-forking-readahead-children.patch new file mode 100644 index 000000000000..2143ba3cc15e --- /dev/null +++ b/sys-apps/preload/files/0001-Early-restart-of-forking-readahead-children.patch @@ -0,0 +1,64 @@ +From 63cbd8862714a97c8ef752041dc8c351ba4fae1d Mon Sep 17 00:00:00 2001 +From: Kai Krakow <kai@kaishome.de> +Date: Mon, 28 Jul 2008 19:50:22 +0200 +Subject: [PATCH] Early restart of forking readahead children + +This patch adds ability to wait_for_children() to restart +forking new readahead children as soon as a slot becomes +available which should make the effect of parallelism even +more effective. Previous situation was: + +Wait for all children to exit as soon as the high water mark +was reached. This resulted in 30 processes in peak, wait for +them to reach 0 processes. Start another 30 processes in +peak, wait again etc. + +New situation is: Start a new process as soon as a previous +process exited which keeps the peak at 30 processes until +the readahead list is finished. + +This introduces a new parameter to wait_for_children() which +tells it to leave now more than XY processes running when +returning. +--- + src/readahead.c | 8 ++++---- + 1 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/readahead.c b/src/readahead.c +index c169e81..7617449 100644 +--- a/src/readahead.c ++++ b/src/readahead.c +@@ -103,10 +103,10 @@ map_block_compare (const preload_map_t **pa, const preload_map_t **pb) + static int procs = 0; + + static void +-wait_for_children (void) ++wait_for_children (int maxprocs) + { + /* wait for child processes to terminate */ +- while (procs > 0) ++ while (procs >= maxprocs) + { + int status; + if (wait (&status) > 0) +@@ -121,7 +121,7 @@ process_file(const char *path, size_t offset, size_t length) + int maxprocs = conf->system.maxprocs; + + if (procs >= maxprocs) +- wait_for_children (); ++ wait_for_children (maxprocs); + + if (maxprocs > 0) + { +@@ -257,7 +257,7 @@ preload_readahead (preload_map_t **files, int file_count) + path = NULL; + } + +- wait_for_children (); ++ wait_for_children (0); + + return processed; + } +-- +1.5.4.5 + diff --git a/sys-apps/preload/files/0002-Create-short-overlapping-io-bursts.patch b/sys-apps/preload/files/0002-Create-short-overlapping-io-bursts.patch new file mode 100644 index 000000000000..20ba67a1bb4b --- /dev/null +++ b/sys-apps/preload/files/0002-Create-short-overlapping-io-bursts.patch @@ -0,0 +1,29 @@ +From 97814f566aeb84f60031008c3dda5457ba176fe7 Mon Sep 17 00:00:00 2001 +From: Kai Krakow <kai@kaishome.de> +Date: Mon, 28 Jul 2008 20:57:06 +0200 +Subject: [PATCH] Create short overlapping io bursts + +Modify the wait_for_children() mechanism to create short +burst instead of constant flow of new io requests. This +is more fair and should enable the kernel to rearrange +io requests better. +--- + src/readahead.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/readahead.c b/src/readahead.c +index 7617449..466961d 100644 +--- a/src/readahead.c ++++ b/src/readahead.c +@@ -121,7 +121,7 @@ process_file(const char *path, size_t offset, size_t length) + int maxprocs = conf->system.maxprocs; + + if (procs >= maxprocs) +- wait_for_children (maxprocs); ++ wait_for_children (maxprocs >> 1); + + if (maxprocs > 0) + { +-- +1.5.4.5 + diff --git a/sys-apps/preload/files/0003-Fix-wait_for_children-loop.patch b/sys-apps/preload/files/0003-Fix-wait_for_children-loop.patch new file mode 100644 index 000000000000..dc37548638a5 --- /dev/null +++ b/sys-apps/preload/files/0003-Fix-wait_for_children-loop.patch @@ -0,0 +1,27 @@ +From 536714622135e53db3f8a5673db32c5de9620aa8 Mon Sep 17 00:00:00 2001 +From: Kai Krakow <kai@kaishome.de> +Date: Tue, 29 Jul 2008 08:15:55 +0200 +Subject: [PATCH] Fix wait_for_children() loop + +Brain damage repaired: One should not wait while zero or +more children exist... That's always the case. :-( +--- + src/readahead.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/readahead.c b/src/readahead.c +index 466961d..08d9f4f 100644 +--- a/src/readahead.c ++++ b/src/readahead.c +@@ -106,7 +106,7 @@ static void + wait_for_children (int maxprocs) + { + /* wait for child processes to terminate */ +- while (procs >= maxprocs) ++ while (procs > maxprocs) + { + int status; + if (wait (&status) > 0) +-- +1.5.4.5 + diff --git a/sys-apps/preload/files/02-patch-preload_conf.diff b/sys-apps/preload/files/02-patch-preload_conf.diff new file mode 100644 index 000000000000..70055c3bbb0f --- /dev/null +++ b/sys-apps/preload/files/02-patch-preload_conf.diff @@ -0,0 +1,21 @@ +diff -urN preload-0.6.orig/src/preload.conf.in preload-0.6/src/preload.conf.in +--- preload-0.6.orig/src/preload.conf.in 2008-07-24 02:02:11.000000000 +0200 ++++ preload-0.6/src/preload.conf.in 2008-07-24 16:32:28.565184094 +0200 +@@ -132,7 +132,7 @@ + # preload doesn't special-handle device files internally. + # + # default: (empty list, accept all) +-mapprefix = /usr/;/lib;/var/cache/;!/ ++mapprefix = /usr/;/lib;/var/cache/;/opt/;/home/;!/ + + # exeprefix: + # +@@ -141,7 +141,7 @@ + # files instead of maps. + # + # default: (empty list, accept all) +-exeprefix = !/usr/sbin/;!/usr/local/sbin/;/usr/;!/ ++exeprefix = !/usr/sbin/;!/usr/local/sbin/;/usr/;/opt/;/usr/libexec/;!/ + + # maxprocs + # diff --git a/sys-apps/preload/files/02-patch-preload_sysconfig.diff b/sys-apps/preload/files/02-patch-preload_sysconfig.diff new file mode 100644 index 000000000000..84308b6e14d8 --- /dev/null +++ b/sys-apps/preload/files/02-patch-preload_sysconfig.diff @@ -0,0 +1,39 @@ +diff -urN preload-0.6.4.orig/preload.sysconfig preload-0.6.4/preload.sysconfig +--- preload-0.6.4.orig/preload.sysconfig 2008-10-23 03:08:20.000000000 +0200 ++++ preload-0.6.4/preload.sysconfig 2009-05-01 13:51:03.493828659 +0200 +@@ -1,10 +1,30 @@ ++# Copyright 1999-2008 Gentoo Foundation ++# $Id$ ++# preload configuration file ++ ++PIDFILE="/var/run/preload.pid" ++ ++# verbosity. 0-10, Default is 1. ++#PRELOAD_VERBOSITY="1" ++ ++# set this for niceness. Default is 15. Valid ranges are from -20 to 19. See ++# nice(1) man page. ++#PRELOAD_NICE="15" ++ ++# log file (default is /var/log/preload.log ) ++#PRELOAD_LOGFILE="/var/log/preload.log" ++ ++# preload state file (default location is /var/lib/preload/preload.state ) ++# Empty (commented out) means no state is saved. ++PRELOAD_STATEFILE="/var/lib/preload/preload.state" ++ + # Miminum memory that the system should have for preload to be launched. +-# In megabytes. +-MIN_MEMORY="256" ++# In megabytes. Currently unused. ++#MIN_MEMORY="256" + + # Command-line arguments to pass to the daemon. Read preload(8) man page + # for available options. +-PRELOAD_OPTS="--verbose 1" ++#PRELOAD_OPTS="--verbose 1" + +-# Option to call ionice with. Leave empty to skip ionice. +-IONICE_OPTS="-c3" ++# Option to call ionice with. Leave empty to use defaults. ++#IONICE_OPTS="-c3" diff --git a/sys-apps/preload/files/preload-0.6.4-use-help2man-as-usual.patch b/sys-apps/preload/files/preload-0.6.4-use-help2man-as-usual.patch new file mode 100644 index 000000000000..61db50692524 --- /dev/null +++ b/sys-apps/preload/files/preload-0.6.4-use-help2man-as-usual.patch @@ -0,0 +1,31 @@ +--- src/Makefile.am~ 2009-04-15 23:46:04.000000000 +0200 ++++ src/Makefile.am 2010-04-09 12:56:45.000000000 +0200 +@@ -54,23 +54,11 @@ + + dist_man_MANS = preload.8 + +-$(srcdir)/preload.8: cmdline.c ../configure.ac preload.8.i +- $(MAKE) $(AM_MAKEFLAGS) preload +- @echo "Creating $@ using help2man(1)" +- @$(top_builddir)/missing --run \ +- help2man --no-info --section=8 --include=preload.8.i \ +- --help-option="-H" --output="$@.tmp" \ +- --name 'Adaptive readahead daemon' ./preload \ +- && mv "$@.tmp" "$@" \ +- || ($(RM) "$@"; \ +- echo Failed to update preload.8, the man page may be outdated >&2; \ +- (test -f "$@" || echo help2man is required to generate this file. >> "$@")); +- +-install-data-hook: +- @cd "$(DESTDIR)$(man8dir)" && gzip -c preload.8 > preload.8.gz.tmp && mv preload.8.gz.tmp preload.8.gz && $(RM) preload.8 +- +-uninstall-hook: +- $(RM) "$(DESTDIR)$(man8dir)/preload.8.gz" ++preload.8: preload preload.8.i ++ help2man \ ++ --no-info --section=8 --include=preload.8.i \ ++ --help-option="-H" --output="$@" \ ++ --name 'Adaptive readahead daemon' ./preload + + ###################################################################### + diff --git a/sys-apps/preload/files/preload-0.6.4-use-make-dependencies.patch b/sys-apps/preload/files/preload-0.6.4-use-make-dependencies.patch new file mode 100644 index 000000000000..0f41780c31e4 --- /dev/null +++ b/sys-apps/preload/files/preload-0.6.4-use-make-dependencies.patch @@ -0,0 +1,21 @@ +--- src/Makefile.am~ 2010-04-09 12:56:45.000000000 +0200 ++++ src/Makefile.am 2010-04-09 12:58:36.000000000 +0200 +@@ -8,8 +8,6 @@ + -DLOGDIR='"${logdir}"' \ + -DPKGLOCALSTATEDIR='"${pkglocalstatedir}"' + +-preload.o cmdline.o preload.8: Makefile +- + sbin_PROGRAMS = preload + + preload_SOURCES = \ +@@ -64,8 +62,7 @@ + + MAINTAINERCLEANFILES += preload.conf.debug + +-preload.conf.debug: +- $(MAKE) $(AM_MAKEFLAGS) preload.conf ++preload.conf.debug: preload.conf + cp preload.conf preload.conf.debug + + RUNPREQ = preload preload.conf.debug diff --git a/sys-apps/preload/files/preload-0.6.4.init.in-r2 b/sys-apps/preload/files/preload-0.6.4.init.in-r2 new file mode 100644 index 000000000000..f8cae0c4d93e --- /dev/null +++ b/sys-apps/preload/files/preload-0.6.4.init.in-r2 @@ -0,0 +1,66 @@ +#!/sbin/openrc-run + +description='Start/stop the preload daemon' +extra_started_commands='dump reload' +description_dump='Dump the config and state of the daemon (to the logfile)' +description_reload='Reload the daemon' + +PIDFILE="/var/run/preload.pid" + +depend() { + after localmount + use netmount ntpd +} + +dump() { + local pid + pid=$(cat ${PIDFILE}) + + ebegin "Dumping the config and state of preload" + if [ -n "${pid}" ]; then + kill -USR1 ${pid} + kill -USR2 ${pid} + fi + eend ${?} && \ + einfo "These should have been written to ${PRELOAD_LOGFILE:-/var/log/preload.log}" +} + +reload() { + ebegin "Reloading preload" + kill -HUP $(cat ${PIDFILE}) + eend ${?} +} + +start() { + local ionice + + ebegin "Starting preload" + + #MIN_MEMORY=${MIN_MEMORY:-256} + # Check for > MIN_MEMORY MB + #free -m | awk '/Mem:/ {exit ($2 >= ('"$MIN_MEMORY"'))?0:1}' || exit 0 + + # First try to start with ionice; if that fails, try without. + for ionice in "ionice ${IONICE_OPTS:--c3}" ''; do + # Avoid 'ionice not found' errors + ${ionice} true >/dev/null 2>&1 || continue + + ${ionice} start-stop-daemon --start --quiet --background \ + --make-pidfile --pidfile ${PIDFILE} \ + --exec /usr/sbin/preload -- \ + -l ${PRELOAD_LOGFILE:-/var/log/preload.log} \ + -V ${PRELOAD_VERBOSITY:-1} \ + -n ${PRELOAD_NICE:-15} \ + -s ${PRELOAD_STATEFILE:-""} \ + ${PRELOAD_OPTS} -f \ + && break + done + + eend ${?} +} + +stop() { + ebegin "Stopping preload (this may take a while)" + start-stop-daemon --stop --retry 120 --quiet --pidfile ${PIDFILE} + eend ${?} +} |