File s390-tools-sles11sp2-lsdasd-improve-performance.patch of Package s390-tools

Description: lsdasd: improve performance when used with many DASDs
Symptom:     In systems with many DASDs lsdasd takes several seconds to respond.
Problem:     In a system with many DASDs, lsdasd spends a significant amount of
             time finding all DASD device entries in sysfs.
Solution:    We can reduce this time by searching through the dasd-eckd and
             dasd-fba driver directories instead of the device tree.
Problem-ID:  76236
---
 zconf/lsdasd |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

--- a/zconf/lsdasd
+++ b/zconf/lsdasd
@@ -112,8 +112,24 @@ function CheckDeviceString() {
 # Generate list of DASDs
 #------------------------------------------------------------------------------
 function listDASDDeviceDirectories() {
-    find "$SYSFSDIR/devices" -type l -name "driver" -lname "*/dasd*" \
-	-printf "%h\n" 2> /dev/null
+    DRIVERECKD="$SYSFSDIR/bus/ccw/drivers/dasd-eckd/"
+    DRIVERFBA="$SYSFSDIR/bus/ccw/drivers/dasd-fba/"
+    SEARCHDIRS=
+
+    if [[ -d "$DRIVERECKD" ]]; then
+	SEARCHDIRS="$DRIVERECKD"
+    fi
+    if [[ -d "$DRIVERFBA" ]]; then
+	SEARCHDIRS="$SEARCHDIRS $DRIVERFBA"
+    fi
+    if [[ -n "$SEARCHDIRS" ]]; then
+        find $SEARCHDIRS -type l -printf "%h/%l\n" 2> /dev/null
+    else
+        # The above paths may become invalid in the future, so we keep the
+        # following query as backup:
+        find "$SYSFSDIR/devices" -type l -name "driver" -lname "*/dasd*" \
+		    -printf "%h\n" 2> /dev/null
+    fi
     return 0
 }