Skip to content

Commit

Permalink
i-t: don't brokenly set the scheduler for root pool vdev's disks
Browse files Browse the repository at this point in the history
This effectively reverts
  4fc411f (part of #6807) and
  f6fbe25 (#9042) ‒
the code itself and latter PR cite symmetry with whole-disk-vdev
behaviour (presumably because rootfs vdevs are rarely whole disks),
but the code is broken for NVME devices (indeed, it'd strip the
controller number instead of the (potential) partition number, turning
"nvme0n1p1" into "nvmen1p1", which would then subsequently fail the
sysfs existence check); it could be fixed to handle those (and any
others) rather easily by dereferencing /sys/class/block/$devname,
but this isn't the place for setting this ‒ as noted in the commit that
removed setting the scheduler by default
(9e17e6f) ‒ use an udev rule

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #11838
  • Loading branch information
nabijaczleweli authored and behlendorf committed Apr 7, 2021
1 parent 46aec6d commit 04344d5
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions contrib/initramfs/scripts/zfs
Original file line number Diff line number Diff line change
Expand Up @@ -890,30 +890,6 @@ mountroot()
ZFS_RPOOL="${pool}"
fi

# 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 -r i
do
SCHEDULER=/sys/block/$i/queue/scheduler
if [ -e "${SCHEDULER}" ]
then
# Query to see what schedulers are available
case "$(cat "${SCHEDULER}")" in
*noop*) echo noop > "${SCHEDULER}" ;;
*none*) echo none > "${SCHEDULER}" ;;
esac
fi
done


# ----------------------------------------------------------------
# P R E P A R E R O O T F I L E S Y S T E M
Expand Down

0 comments on commit 04344d5

Please sign in to comment.