mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
lszfcp: eliminate costly child process for each SCSI device
A simple built-in parameter expansion removing the matching prefix pattern (everything up to and including the last slash) is sufficient to strip the path from the basename. Speeds up "lszfcp -D" significantly. Before: $ time ~/git/s390-tools/zconf/lszfcp -D | wc -l 1028 real 0m5.322s user 0m0.300s sys 0m4.907s After: $ time ~/git/s390-tools/zconf/lszfcp -D | wc -l 1028 real 0m0.602s user 0m0.100s sys 0m0.492s Above measurements are from the fast in-memory sysfs. The improvements are likely amplified when running "lszfcp --sysfs ..." on collected debug data in a regular file system. 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:
committed by
Steffen Eiden
parent
63142e3051
commit
32dbfc4712
@@ -422,7 +422,7 @@ show_devices()
|
||||
fi
|
||||
|
||||
if [ $VERBOSITY -eq 0 ]; then
|
||||
echo "$ADAPTER/$WWPN/$LUN `basename $SCSI_DEVICE_PATH`$SDEVMARKER"
|
||||
echo "$ADAPTER/$WWPN/$LUN ${SCSI_DEVICE_PATH##*/}$SDEVMARKER"
|
||||
else
|
||||
echo "`ls -d $SYSFS/devices/css0/[0-9d]*/$ADAPTER`/$WWPN/$LUN"
|
||||
echo ${SCSI_DEVICE_PATH%*/}$SDEVMARKER # without trailing slash
|
||||
|
||||
Reference in New Issue
Block a user