SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Wed Oct 24 20:31:23 CEST 2007


Author: glen
Date: Wed Oct 24 20:31:22 2007
New Revision: 8858

Modified:
   geninitrd/trunk/geninitrd
Log:
- optimize little dmraid part

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Wed Oct 24 20:31:22 2007
@@ -590,7 +590,7 @@
 		return
 	fi
 
-	if [[ "$devpath" == /dev/mapper/* ]] && is_yes "$USE_MULTIPATH"; then
+	if is_yes "$USE_MULTIPATH" && [[ "$devpath" == /dev/mapper/* ]]; then
 		if find_modules_multipath "$devpath"; then
 			return
 		fi
@@ -607,21 +607,19 @@
 		return
 	fi
 
-	if is_yes "$(echo "$devpath" | awk '/^\/dev\/mapper\/(sil|hpt37x|hpt45x|isw|lsi|nvidia|pdc|sil|via|dos)_/ { print "yes"; }')"; then
+	if is_yes "$USE_DMRAID" && is_yes "$(echo "$devpath" | awk '/^\/dev\/mapper\/(sil|hpt37x|hpt45x|isw|lsi|nvidia|pdc|sil|via|dos)_/ { print "yes"; }')"; then
 		# dmraid nodes taken from: `dmraid -l` output
-		if [ ! -x /usr/sbin/dmraid ]; then
-			die "root on dmraid but /usr/sbin/dmraid not found."
-		fi
-
 		# XXX dmraid could say to us that /dev/dm-3 consists from /dev/sda, /dev/sdb
 
+		local node
 		# get blockdev itself (without partition)
-		local node blockdev
-		blockdev=${devpath%%[0-9]*}
-		blockdev=${blockdev#/dev/mapper/}
-		for node in $(dmraid -r -cdevpath,raidname |awk -F, -vv="$blockdev" '{if ($2 == v) print $1}'); do
-			find_modules_for_device $node
-			dmraid_devices="$dmraid_devices $node"
+		# /dev/mapper/sil_ahbgadcbchfc3 -> /dev/mapper/sil_ahbgadcbchfc
+		local blockdev=${devpath%%[0-9]*}
+		local raidname=${blockdev#/dev/mapper/}
+		local dev phydevs=$(dmraid -r -cdevpath,raidname | awk -F, -vv="$raidname" '{if ($2 == v) print $1}'); do
+		for dev in $phydevs; do
+			find_modules_for_device $dev
+			dmraid_devices="$dmraid_devices $dev"
 		done
 
 		# XXX probably should detect


More information about the pld-cvs-commit mailing list