!67 backport speed multipatch scan patches from mainline
From: @volcanodragon Reviewed-by: @wenchao-hao, @liuzhiqiang26 Signed-off-by: @liuzhiqiang26
This commit is contained in:
commit
42ed38f080
33
0008-rescan-scsi-bus.sh-speed-testonline.patch
Normal file
33
0008-rescan-scsi-bus.sh-speed-testonline.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From e680e840140d19cb3419ff92595bc2c91de3368a Mon Sep 17 00:00:00 2001
|
||||
From: Douglas Gilbert <dgilbert@interlog.com>
|
||||
Date: Mon, 26 Sep 2022 21:41:45 +0000
|
||||
Subject: [PATCH 1/2] rescan-scsi-bus.sh speed testonline()
|
||||
|
||||
speed testonline() function when
|
||||
peripheral_qualifier != 0 in the standard INQUIRY
|
||||
response. See:
|
||||
https://github.com/doug-gilbert/sg3_utils/issues/24
|
||||
|
||||
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@972 6180dd3e-e324-4e3e-922d-17de1ae2f315
|
||||
|
||||
Conflict: Reserve changes about rescan-scsi-bus only
|
||||
---
|
||||
scripts/rescan-scsi-bus.sh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
|
||||
index 67dccf3..0e7697b 100755
|
||||
--- a/scripts/rescan-scsi-bus.sh
|
||||
+++ b/scripts/rescan-scsi-bus.sh
|
||||
@@ -276,7 +276,7 @@ testonline ()
|
||||
|
||||
# Handle in progress of becoming ready and unit attention
|
||||
while [ $RC = 2 -o $RC = 6 ] && [ $ctr -le 30 ] ; do
|
||||
- if [ $RC = 2 ] && [ "$RMB" != "1" ] ; then
|
||||
+ if [ $RC = 2 ] && [ "$RMB" != "1" ] && [ sg_inq /dev/$SGDEV | grep -q -i "PQual=0" ] ; then
|
||||
echo -n "."
|
||||
let LN+=1
|
||||
sleep 1
|
||||
--
|
||||
2.35.3
|
||||
|
||||
130
0009-rescan-scsi-bus-speed-large-multipath-scans.patch
Normal file
130
0009-rescan-scsi-bus-speed-large-multipath-scans.patch
Normal file
@ -0,0 +1,130 @@
|
||||
From fe62f3e9ce96927bf9bcfb19b33447b54aafdc1f Mon Sep 17 00:00:00 2001
|
||||
From: Douglas Gilbert <dgilbert@interlog.com>
|
||||
Date: Fri, 30 Sep 2022 08:58:39 +0000
|
||||
Subject: [PATCH 2/2] rescan-scsi-bus: speed large multipath scans
|
||||
|
||||
Speed multipath scans with many LUNs by caching multipath
|
||||
LUN info in temporary file, see:
|
||||
https://github.com/doug-gilbert/sg3_utils/issues/22
|
||||
Fix small bug in last commit, see:
|
||||
https://github.com/doug-gilbert/sg3_utils/issues/24
|
||||
|
||||
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@973 6180dd3e-e324-4e3e-922d-17de1ae2f315
|
||||
|
||||
Conflict: reserve changes about rescan-scsi-bus only
|
||||
---
|
||||
scripts/rescan-scsi-bus.sh | 57 ++++++++++++++++++++++++++------------
|
||||
1 file changed, 40 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
|
||||
index 0e7697b..7508dba 100755
|
||||
--- a/scripts/rescan-scsi-bus.sh
|
||||
+++ b/scripts/rescan-scsi-bus.sh
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
VERSION="20180615"
|
||||
SCAN_WILD_CARD=4294967295
|
||||
+TMPLUNINFOFILE="/tmp/rescan-scsi-mpath-info.txt"
|
||||
|
||||
setcolor ()
|
||||
{
|
||||
@@ -276,7 +277,7 @@ testonline ()
|
||||
|
||||
# Handle in progress of becoming ready and unit attention
|
||||
while [ $RC = 2 -o $RC = 6 ] && [ $ctr -le 30 ] ; do
|
||||
- if [ $RC = 2 ] && [ "$RMB" != "1" ] && [ sg_inq /dev/$SGDEV | grep -q -i "PQual=0" ] ; then
|
||||
+ if [ $RC = 2 ] && [ "$RMB" != "1" ] && sg_inq /dev/$SGDEV | grep -q -i "PQual=0" ; then
|
||||
echo -n "."
|
||||
let LN+=1
|
||||
sleep 1
|
||||
@@ -777,6 +778,33 @@ searchexisting()
|
||||
done
|
||||
}
|
||||
|
||||
+getallmultipathinfo()
|
||||
+{
|
||||
+ local mp=
|
||||
+ local uuid=
|
||||
+ local dmtmp=
|
||||
+ local maj_min=
|
||||
+ local tmpfile=
|
||||
+
|
||||
+ truncate -s 0 $TMPLUNINFOFILE
|
||||
+ for mp in $($DMSETUP ls --target=multipath | cut -f 1) ; do
|
||||
+ [ "$mp" = "No" ] && break;
|
||||
+ maj_min=$($DMSETUP status "$mp" | cut -d " " -f14)
|
||||
+ if [ ! -L /dev/mapper/${mp} ]; then
|
||||
+ echo "softlink /dev/mapper/${mp} not available."
|
||||
+ continue
|
||||
+ fi
|
||||
+ local ret=$(readlink /dev/mapper/$mp 2>/dev/null)
|
||||
+ if [[ $? -ne 0 || -z "$ret" ]]; then
|
||||
+ echo "readlink /dev/mapper/$mp failed. check multipath status."
|
||||
+ continue
|
||||
+ fi
|
||||
+ dmtmp=$(basename $ret)
|
||||
+ uuid=$(cut -f2 -d- "/sys/block/$dmtmp/dm/uuid")
|
||||
+ echo "$mp $maj_min $dmtmp $uuid" >> $TMPLUNINFOFILE
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
# Go through all of the existing devices and figure out any that have been remapped
|
||||
findremapped()
|
||||
{
|
||||
@@ -815,6 +843,8 @@ findremapped()
|
||||
udevadm_settle 2>&1 /dev/null
|
||||
echo "Done"
|
||||
|
||||
+ getallmultipathinfo
|
||||
+
|
||||
# See what changed and reload the respective multipath device if applicable
|
||||
while read -r hctl sddev id_serial_old ; do
|
||||
remapped=0
|
||||
@@ -945,7 +975,6 @@ findmultipath()
|
||||
local dev="$1"
|
||||
local find_mismatch="$2"
|
||||
local mp=
|
||||
- local mp2=
|
||||
local found_dup=0
|
||||
local maj_min=
|
||||
|
||||
@@ -955,27 +984,21 @@ findmultipath()
|
||||
fi
|
||||
|
||||
maj_min=$(cat "/sys/block/$dev/dev")
|
||||
- for mp in $($DMSETUP ls --target=multipath | cut -f 1) ; do
|
||||
- [ "$mp" = "No" ] && break;
|
||||
- if "$DMSETUP" status "$mp" | grep -q " $maj_min "; then
|
||||
- # With two arguments, look up current uuid from sysfs
|
||||
- # if it doesn't match what was passed, this multipath
|
||||
- # device is not updated, so this is a remapped LUN
|
||||
- if [ -n "$find_mismatch" ] ; then
|
||||
- mp2=$($MULTIPATH -l "$mp" | egrep -o "dm-[0-9]+")
|
||||
- mp2=$(cut -f2 -d- "/sys/block/$mp2/dm/uuid")
|
||||
- if [ "$find_mismatch" != "$mp2" ] ; then
|
||||
- addmpathtolist "$mp"
|
||||
- found_dup=1
|
||||
- fi
|
||||
- continue
|
||||
+ mp=$(cat $TMPLUNINFOFILE | grep -w "$maj_min" | cut -d " " -f1)
|
||||
+ if [ -n "$mp" ]; then
|
||||
+ if [ -n "$find_mismatch" ] ; then
|
||||
+ uuid=$(cat $TMPLUNINFOFILE | grep -w "$maj_min" | cut -d " " -f4)
|
||||
+ if [ "$find_mismatch" != "$uuid" ] ; then
|
||||
+ addmpathtolist "$mp"
|
||||
+ found_dup=1
|
||||
fi
|
||||
+ else
|
||||
# Normal mode: Find the first multipath with the sdev
|
||||
# and add it to the list
|
||||
addmpathtolist "$mp"
|
||||
return
|
||||
fi
|
||||
- done
|
||||
+ fi
|
||||
|
||||
# Return 1 to signal that a duplicate was found to the calling function
|
||||
if [ $found_dup -eq 1 ] ; then
|
||||
--
|
||||
2.35.3
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: sg3_utils
|
||||
Version: 1.47
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: Utilities that send SCSI commands to devices.
|
||||
License: GPL-2.0-or-later AND BSD
|
||||
URL: http://sg.danny.cz/sg/sg3_utils.html
|
||||
@ -14,6 +14,8 @@ Patch4: 0004-sg3_utils-rescan-scsi-bus-list-all-LUNs-in-one-line.patch
|
||||
Patch5: 0005-rescan-scsi-bus.sh-apply-fix-for-r-from-https-github.patch
|
||||
Patch6: 0006-rescan-scsi-bus-sgdevice26-do-not-traverse-sg-class-.patch
|
||||
Patch7: 0007-rescan-scsi-bus.sh-add-option-no-lip-scan.patch
|
||||
Patch8: 0008-rescan-scsi-bus.sh-speed-testonline.patch
|
||||
Patch9: 0009-rescan-scsi-bus-speed-large-multipath-scans.patch
|
||||
|
||||
Provides: %{name}-libs
|
||||
Obsoletes: %{name}-libs
|
||||
@ -77,6 +79,9 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
* Thu Nov 3 2022 volcanodragon <linfeilong@huawei.com> - 1.47-3
|
||||
- backport speed multipath scan patches from mainline
|
||||
|
||||
* Fri Sep 2 2022 Wenchao Hao <haowenchao@huawei.com> - 1.47-2
|
||||
- backport rescan-scsi-bus patches from mainline
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user