[sheepdog] [PATCH] vditest: flush based on write counts

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Feb 4 12:07:13 CET 2013


It doesn't make sense to flush after read requests.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---

This patch is a fixed version of the 6th patch of my vditest series.


 script/vditest |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/script/vditest b/script/vditest
index c24f8e0..f1d950d 100755
--- a/script/vditest
+++ b/script/vditest
@@ -312,7 +312,6 @@ sub parse {
 sub vdi_main {
     my $roffset = $offset;
     my $woffset = $offset;
-    my $i = 1;
     my ($cur_time, $start_time, $end_time, $hbeat_time);
 
     $start_time = $cur_time = get_current_time();
@@ -328,8 +327,6 @@ sub vdi_main {
 	    wait_aio_requests();
 	}
 
-	print "$i: "  if $verbose;
-
 	if (rand($rrate + $wrate) < $rrate) {
 	    # read
 	    $length = $eblk - $roffset  if $roffset + $length > $eblk;
@@ -354,9 +351,11 @@ sub vdi_main {
 	    } else {
 		$woffset = get_aligned_blk($sblk, $eblk - 512);
 	    }
-	}
 
-	vdi_flush() if $flush_interval > 0 && $i % $flush_interval == 0;
+	    if ($flush_interval > 0 && $wr_ops % $flush_interval == 0) {
+		vdi_flush();
+	    }
+	}
 
 	$cur_time = get_current_time();
 	if ($hbeat > 0 && $hbeat_time <= $cur_time) {
@@ -368,7 +367,6 @@ sub vdi_main {
 
 	    $hbeat_time += $hbeat * 1000000;
 	}
-	$i++;
     }
 
     print_result('Total read', $total_rd_bytes, $total_rd_ops, $runtime) if $rrate;
-- 
1.7.2.5




More information about the sheepdog mailing list