]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: Reducing commands in get_num_active_clean()
authorErwan Velu <erwan@redhat.com>
Mon, 21 Mar 2016 10:16:12 +0000 (11:16 +0100)
committerErwan Velu <erwan@redhat.com>
Tue, 5 Apr 2016 07:36:25 +0000 (09:36 +0200)
get_num_active_clean() is called very often but spawn 1 useless process.
The current "grep -v | wc -l" can be easily replaced by "grep -cv" which
do the same while spawning one process less.

Signed-off-by: Erwan Velu <erwan@redhat.com>
qa/workunits/ceph-helpers.sh

index c866df9f3460625b70e00fb3515a86a669823d4c..87eb82a9d92bd1e30694d22173944c1b59e129dc 100755 (executable)
@@ -940,7 +940,7 @@ function get_num_active_clean() {
     # grep -v '^$' 
     ceph --format xml pg dump pgs 2>/dev/null | \
         $XMLSTARLET sel -t -m "//pg_stat/state[$expression]" -v . -n | \
-        grep -v '^$' | wc -l
+        grep -cv '^$'
 }
 
 function test_get_num_active_clean() {