Skip to content

Commit f6fbe25

Browse files
colmbuckleybehlendorf
authored andcommitted
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 <[email protected]> Reviewed-by: Garrett Fields <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Colm Buckley <[email protected]> Closes #9042
1 parent 1a26cb6 commit f6fbe25

File tree

1 file changed

+13
-6
lines changed
  • contrib/initramfs/scripts

1 file changed

+13
-6
lines changed

contrib/initramfs/scripts/zfs.in

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -884,20 +884,27 @@ mountroot()
884884
ZFS_RPOOL="${pool}"
885885
fi
886886

887-
# Set elevator=noop on the root pool's vdevs' disks. ZFS already
888-
# does this for wholedisk vdevs (for all pools), so this is only
889-
# important for partitions.
887+
# Set the no-op scheduler on the disks containing the vdevs of
888+
# the root pool. For single-queue devices, this scheduler is
889+
# "noop", for multi-queue devices, it is "none".
890+
# ZFS already does this for wholedisk vdevs (for all pools), so this
891+
# is only important for partitions.
890892
"${ZPOOL}" status -L "${ZFS_RPOOL}" 2> /dev/null |
891893
awk '/^\t / && !/(mirror|raidz)/ {
892894
dev=$1;
893895
sub(/[0-9]+$/, "", dev);
894896
print dev
895897
}' |
896-
while read i
898+
while read -r i
897899
do
898-
if grep -sq noop /sys/block/$i/queue/scheduler
900+
SCHEDULER=/sys/block/$i/queue/scheduler
901+
if [ -e "${SCHEDULER}" ]
899902
then
900-
echo noop > "/sys/block/$i/queue/scheduler"
903+
# Query to see what schedulers are available
904+
case "$(cat "${SCHEDULER}")" in
905+
*noop*) echo noop > "${SCHEDULER}" ;;
906+
*none*) echo none > "${SCHEDULER}" ;;
907+
esac
901908
fi
902909
done
903910

0 commit comments

Comments
 (0)