From d4316c155cb1298147c572b1b73ad25738a580e5 Mon Sep 17 00:00:00 2001 From: Steffen Maier Date: Sat, 3 Dec 2022 00:05:11 +0100 Subject: [PATCH] lszfcp: save a stat syscall on the SCSI device loop hot path Just go ahead and read the sysfs attribute directly as the syscalls are needed anyway. If necessary stderr could be redirected to /dev/null in the future, but there was no case so far where the attribute did not exist. This does not make a runtime difference when running on sysfs. Change it anyway to avoid somebody searching for speed improvement options stumbling over it again. Reviewed-by: Benjamin Block Signed-off-by: Steffen Maier Signed-off-by: Steffen Eiden --- zconf/lszfcp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zconf/lszfcp b/zconf/lszfcp index f741d33b..01dd26de 100755 --- a/zconf/lszfcp +++ b/zconf/lszfcp @@ -415,8 +415,7 @@ show_devices() SDEVMARKER="" if $SHOW_EXTENDED; then [ -d $ZFCP_UNIT_PATH ] || SDEVMARKER="$SDEVMARKER auto" - [ -r $SCSI_DEVICE_PATH/state ] \ - && read SDEVSTATE < $SCSI_DEVICE_PATH/state + read SDEVSTATE < $SCSI_DEVICE_PATH/state [ "$SDEVSTATE" != "running" ] \ && SDEVMARKER="$SDEVMARKER NotRunning" fi