On 2007-12-07 Kees Cook <[EMAIL PROTECTED]> wrote:
> On Fri, Dec 07, 2007 at 07:32:08PM +0100, Andreas Metzler wrote:
>> Thanks for the explanation. I have not got strong feelings about it
>> either. Since nice-level is already configurable I would suggest to
>> apply the patch but keep/change to IONICE_CLASS 3.

> Okay, sounds good.  Here's the updated patch, which avoids ionice
> yelling about an ignored priority when IONICE_CLASS is 3.

I have applied a slightly modified version:
------------------------------
--- debian/changelog    (Revision 275)
+++ debian/changelog    (Arbeitskopie)
@@ -1,6 +1,9 @@
 findutils (4.2.31-4) UNRELEASED; urgency=low
 
   * NOT RELEASED YET
+  * Allow seeting IONICE_CLASS and IONICE_PRIORITY in
+    /etc/updatedb.findutils.cron.local. (Thanks, Kees Cook).
+    Closes: #454677
 
  -- Andreas Metzler <[EMAIL PROTECTED]>  Sat,  1 Dec 2007 12:47:17 +0100
 
Index: debian/locate-cron.daily
===================================================================
--- debian/locate-cron.daily    (Revision 272)
+++ debian/locate-cron.daily    (Arbeitskopie)
@@ -21,20 +21,30 @@
 # (this is relative to the default which cron sets, which is usually +5)
 NICE=10
 
-# Set the task to run with "idle" I/O priority if possible
-# Linux supports io scheduling priorities and classes since
-# 2.6.13 with the CFQ io scheduler
+# I/O priority
+# 1 for real time, 2 for best-effort, 3 for idle ("3" only allowed for root)
+IONICE_CLASS=3
+# 0-7 (only valid for IONICE_CLASS 1 and 2), 0=highest, 7=lowest 
+IONICE_PRIORITY=7
 
-if [ -x /usr/bin/ionice ]; then
-       ionice -c3 -p$$
-fi
-
 # allow keeping local customizations in a separate file
 if [ -r /etc/updatedb.findutils.cron.local ] ; then
        . /etc/updatedb.findutils.cron.local
 fi
 export FINDOPTIONS PRUNEFS PRUNEPATHS NETPATHS LOCALUSER NICE
 
+# Set the task to run with desired I/O priority if possible
+# Linux supports io scheduling priorities and classes since
+# 2.6.13 with the CFQ io scheduler
+if [ -x /usr/bin/ionice ]; then
+       # Avoid providing "-n" when IONICE_CLASS isn't 1 or 2
+       case "$IONICE_CLASS" in
+               1|2) priority="-n ${IONICE_PRIORITY:-7}" ;;
+               *) priority="" ;;
+       esac
+       ionice -c $IONICE_CLASS $priority -p $$
+fi
+
 if getent passwd $LOCALUSER > /dev/null ; then
   cd / && nice -n ${NICE:-10} updatedb.findutils 2>/dev/null
 else
------------------------------

It does not export the IO* variables anymore, and 
-case "${IONICE_CLASS:=3}" in
+case "$IONICE_CLASS" in

cu andreas
-- 
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to