diff options
author | colmbuckley <colm@tuatha.org> | 2019-08-19 23:11:47 +0100 |
---|---|---|
committer | Brian Behlendorf <behlendorf1@llnl.gov> | 2019-08-19 15:11:46 -0700 |
commit | f6fbe25664629d1ae6a3b186f14ec69dbe6c6232 (patch) | |
tree | c3997769ae12cc2007a2f2cb46fef9efb540399c /contrib | |
parent | 1a26cb6160949d1aa16a91714c88fd927423209f (diff) |
Set "none" scheduler if available (initramfs)
Existing zfs initramfs script logic will attempt to set the 'noop'
scheduler if it's available on the vdev block devices. Newer kernels
have the similar 'none' scheduler on multiqueue devices; this change
alters the initramfs script logic to also attempt to set this scheduler
if it's available.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Garrett Fields <ghfields@gmail.com>
Reviewed-by: Richard Laager <rlaager@wiktel.com>
Signed-off-by: Colm Buckley <colm@tuatha.org>
Closes #9042
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/initramfs/scripts/zfs.in | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/contrib/initramfs/scripts/zfs.in b/contrib/initramfs/scripts/zfs.in index ad604a82c..9d11e1926 100644 --- a/contrib/initramfs/scripts/zfs.in +++ b/contrib/initramfs/scripts/zfs.in @@ -884,20 +884,27 @@ mountroot() ZFS_RPOOL="${pool}" fi - # Set elevator=noop on the root pool's vdevs' disks. ZFS already - # does this for wholedisk vdevs (for all pools), so this is only - # important for partitions. + # Set the no-op scheduler on the disks containing the vdevs of + # the root pool. For single-queue devices, this scheduler is + # "noop", for multi-queue devices, it is "none". + # ZFS already does this for wholedisk vdevs (for all pools), so this + # is only important for partitions. "${ZPOOL}" status -L "${ZFS_RPOOL}" 2> /dev/null | awk '/^\t / && !/(mirror|raidz)/ { dev=$1; sub(/[0-9]+$/, "", dev); print dev }' | - while read i + while read -r i do - if grep -sq noop /sys/block/$i/queue/scheduler + SCHEDULER=/sys/block/$i/queue/scheduler + if [ -e "${SCHEDULER}" ] then - echo noop > "/sys/block/$i/queue/scheduler" + # Query to see what schedulers are available + case "$(cat "${SCHEDULER}")" in + *noop*) echo noop > "${SCHEDULER}" ;; + *none*) echo none > "${SCHEDULER}" ;; + esac fi done |