[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 15/33] cr-ensure-disk-space: Make main loop body into a subroutine



No functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 cr-ensure-disk-space |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/cr-ensure-disk-space b/cr-ensure-disk-space
index 0314e7a..8c5a708 100755
--- a/cr-ensure-disk-space
+++ b/cr-ensure-disk-space
@@ -67,7 +67,7 @@ END
 our @flights;
 our %latestref;
 
-for (;;) {
+sub iteration_continue () {
     open P, "-|", onloghost "df --block-size=1M -P $logdir" or die $!;
     $_= <P>;
     m/^filesystem/i or die "$_ ?";
@@ -76,7 +76,7 @@ for (;;) {
     $!=0; $?=0; close P or die "$! $?";
     my $space= $1;
     printf "space: %8d, wanted: %8d ", $space, logcfg('MinSpaceMby');
-    last if $space >= logcfg('MinSpaceMby');
+    return 0 if $space >= logcfg('MinSpaceMby');
 
     if (!@flights) {
        %latestref = ();
@@ -141,6 +141,13 @@ for (;;) {
 END
 
     printf "done.\n";
+
+    return 1;
+}
+
+for (;;) {
+    iteration_continue()
+       or last;
 }
 
 printf "ok.\n";
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.