Fix kernel tuning script to ignore write failures (#6107)

Certain SCSI drivers do not allow certain tuning parameters
like nr_requests, max_sectors_kb to be changed, ignore these
errors silently as this script is simply a best effort.

Fixes #6103
master
Harshavardhana 6 years ago committed by kannappanr
parent 92a6676a2f
commit a5453c307f
  1. 22
      docs/deployment/kernel-tuning/disk-tuning.sh

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
## Minio Cloud Storage, (C) 2017 Minio, Inc. ## Minio Cloud Storage, (C) 2017, 2018 Minio, Inc.
## ##
## Licensed under the Apache License, Version 2.0 (the "License"); ## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License. ## you may not use this file except in compliance with the License.
@ -16,9 +16,9 @@
# This script changes protected files, and must be run as root # This script changes protected files, and must be run as root
for i in $(ls -d /sys/block/*/queue/iosched 2>/dev/null); do for i in $(echo /sys/block/*/queue/iosched 2>/dev/null); do
iosched_dir=$(echo $i | awk '/iosched/ {print $1}') iosched_dir=$(echo "${i}" | awk '/iosched/ {print $1}')
[ -z $iosched_dir ] && { [ -z "${iosched_dir}" ] && {
continue continue
} }
## Change each disk ioscheduler to be "deadline" ## Change each disk ioscheduler to be "deadline"
@ -29,22 +29,22 @@ for i in $(ls -d /sys/block/*/queue/iosched 2>/dev/null); do
## see whether write requests have been starved for too ## see whether write requests have been starved for too
## long, and then decides whether to start a new batch ## long, and then decides whether to start a new batch
## of reads or writes ## of reads or writes
path=$(dirname $iosched_dir) path=$(dirname "${iosched_dir}")
[ -f $path/scheduler ] && { [ -f "${path}/scheduler" ] && {
echo "deadline" > $path/scheduler echo "deadline" > "${path}/scheduler" 2>/dev/null || true
} }
## This controls how many requests may be allocated ## This controls how many requests may be allocated
## in the block layer for read or write requests. ## in the block layer for read or write requests.
## Note that the total allocated number may be twice ## Note that the total allocated number may be twice
## this amount, since it applies only to reads or ## this amount, since it applies only to reads or
## writes (not the accumulate sum). ## writes (not the accumulate sum).
[ -f $path/nr_requests ] && { [ -f "${path}/nr_requests" ] && {
echo "256" > $path/nr_requests echo "256" > "${path}/nr_requests" 2>/dev/null || true
} }
## This is the maximum number of kilobytes ## This is the maximum number of kilobytes
## supported in a single data transfer at ## supported in a single data transfer at
## block layer. ## block layer.
[ -f $path/max_sectors_kb ] && { [ -f "${path}/max_sectors_kb" ] && {
echo "1024" > $path/max_sectors_kb || true echo "1024" > "${path}/max_sectors_kb" 2>/dev/null || true
} }
done done

Loading…
Cancel
Save