From 8bd483a47c4e00cf106fb16d50ac5d0c61f21ab8 Mon Sep 17 00:00:00 2001 From: Jan Vcelak Date: Wed, 11 Jan 2012 12:40:23 +0100 Subject: [PATCH] functions: support for disk scheduler quantum setting --- tune-profiles/functions | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tune-profiles/functions b/tune-profiles/functions index cd98a59..0fc4920 100644 --- a/tune-profiles/functions +++ b/tune-profiles/functions @@ -69,6 +69,25 @@ remount_partitions() { done } +DISK_QUANTUM_SAVE="/var/run/tuned/disk_quantum.save" + +set_disk_scheduler_quantum() { + value=$1 + rm -f "$DISK_QUANTUM_SAVE" + for disk in $DISKS_SYS; do + control="${disk}/queue/iosched/quantum" + echo "echo $(cat $control) > $control" >> "$DISK_QUANTUM_SAVE" 2>/dev/null + (echo $value > $control) &2>/dev/null + done +} + +restore_disk_scheduler_quantum() { + if [ -r "$DISK_QUANTUM_SAVE" ]; then + /bin/sh "$DISK_QUANTUM_SAVE" &>/dev/null + rm -f "$DISK_QUANTUM_SAVE" + fi +} + # # CPU tuning #