2017-03-27 20:29:04 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-06-30 23:55:21 +02:00
|
|
|
## Minio Cloud Storage, (C) 2017, 2018 Minio, Inc.
|
2017-03-27 20:29:04 +02:00
|
|
|
##
|
|
|
|
## Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
## you may not use this file except in compliance with the License.
|
|
|
|
## You may obtain a copy of the License at
|
|
|
|
##
|
|
|
|
## http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
##
|
|
|
|
## Unless required by applicable law or agreed to in writing, software
|
|
|
|
## distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
## See the License for the specific language governing permissions and
|
|
|
|
## limitations under the License.
|
|
|
|
|
2018-03-13 14:17:49 +01:00
|
|
|
# This script changes protected files, and must be run as root
|
|
|
|
|
2018-06-30 23:55:21 +02:00
|
|
|
for i in $(echo /sys/block/*/queue/iosched 2>/dev/null); do
|
|
|
|
iosched_dir=$(echo "${i}" | awk '/iosched/ {print $1}')
|
|
|
|
[ -z "${iosched_dir}" ] && {
|
2017-03-27 20:29:04 +02:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
## Change each disk ioscheduler to be "deadline"
|
|
|
|
## Deadline dispatches I/Os in batches. A batch is a
|
|
|
|
## sequence of either read or write I/Os which are in
|
|
|
|
## increasing LBA order (the one-way elevator). After
|
|
|
|
## processing each batch, the I/O scheduler checks to
|
|
|
|
## see whether write requests have been starved for too
|
|
|
|
## long, and then decides whether to start a new batch
|
|
|
|
## of reads or writes
|
2018-06-30 23:55:21 +02:00
|
|
|
path=$(dirname "${iosched_dir}")
|
|
|
|
[ -f "${path}/scheduler" ] && {
|
|
|
|
echo "deadline" > "${path}/scheduler" 2>/dev/null || true
|
2017-03-27 20:29:04 +02:00
|
|
|
}
|
|
|
|
## This controls how many requests may be allocated
|
|
|
|
## in the block layer for read or write requests.
|
|
|
|
## Note that the total allocated number may be twice
|
|
|
|
## this amount, since it applies only to reads or
|
|
|
|
## writes (not the accumulate sum).
|
2018-06-30 23:55:21 +02:00
|
|
|
[ -f "${path}/nr_requests" ] && {
|
|
|
|
echo "256" > "${path}/nr_requests" 2>/dev/null || true
|
2017-03-27 20:29:04 +02:00
|
|
|
}
|
|
|
|
## This is the maximum number of kilobytes
|
|
|
|
## supported in a single data transfer at
|
|
|
|
## block layer.
|
2018-06-30 23:55:21 +02:00
|
|
|
[ -f "${path}/max_sectors_kb" ] && {
|
|
|
|
echo "1024" > "${path}/max_sectors_kb" 2>/dev/null || true
|
2017-03-27 20:29:04 +02:00
|
|
|
}
|
|
|
|
done
|