File bsc1164726-search-only-part-of-sys.patch of Package powerpc-utils.17914

From c97fe35b5b6d767b88419fa2084a59e986ac3da0 Mon Sep 17 00:00:00 2001
From: Nathan Lynch <nathanl@linux.ibm.com>
Date: Mon, 27 Apr 2020 20:48:04 -0500
Subject: [PATCH] ofpathname: speed up l2of_scsi()

References: bsc#1164726 ltc#183674
Upstream: pending - expected 1.3.8
Git-commit: c97fe35b5b6d767b88419fa2084a59e986ac3da0

There is no need to search the entire /sys hierarchy for kernel device
names like "sda". We know that if it is present it will be in
/sys/class/block.

In an environment with more than 800 scsi devices, this brings the
execution time for a command like "lsdevinfo -F name -c -q
parent=host1" from over 20 minutes to under two minutes.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
 scripts/ofpathname | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/ofpathname b/scripts/ofpathname
index 7c6345eeaca1..bd61ee04bc14 100755
--- a/scripts/ofpathname
+++ b/scripts/ofpathname
@@ -773,7 +773,7 @@ l2of_scsi()
     local devtype
 
     # There may be many instances of DEVICE under /sys
-    for dir in `$FIND /sys -name $DEVICE`; do
+    for dir in `$FIND /sys/class/block -name $DEVICE`; do
 	# Move up until we find one with a device link
 	goto_dir $dir "device" 0
 	if [ $? -eq 0 ]; then
-- 
2.26.2

openSUSE Build Service is sponsored by