From: Colin Patrick McCabe Date: Thu, 30 Dec 2010 08:09:11 +0000 (-0800) Subject: qa: rbd: small optimization to script X-Git-Tag: v0.25~411 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c846615d8b226df034d970f04bdb3201b61bfbb1;p=ceph.git qa: rbd: small optimization to script Signed-off-by: Colin McCabe --- diff --git a/qa/rbd/common.sh b/qa/rbd/common.sh index 14e8c67ad9a5..aa6efe7de83e 100644 --- a/qa/rbd/common.sh +++ b/qa/rbd/common.sh @@ -67,9 +67,10 @@ rbd_add() { pushd /sys/bus/rbd/devices &> /dev/null [ $? -eq 0 ] || die "failed to cd" devid="" - # We 'should' start at the end (sorting numerically) - # TODO: rewrite this to be more efficient if it's important - for f in *; do + rm -f "$TDIR/rbd_devs" + for f in *; do echo $f >> "$TDIR/rbd_devs"; done + sort -nr "$TDIR/rbd_devs" > "$TDIR/rev_rbd_devs" + while read f < "$TDIR/rev_rbd_devs"; do read d_img_name < "$f/name" if [ "x$d_img_name" == "x$img_name.$id" ]; then devid=$f