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 <bblock@linux.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Steffen Maier
2022-12-03 00:05:11 +01:00
committed by Steffen Eiden
parent a4f4337060
commit d4316c155c
+1 -2
View File
@@ -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