flexnbd status: Add current pass clean/dirty byte statistics

This commit is contained in:
nick
2013-07-08 13:51:15 +01:00
parent b29ef6d4de
commit f4bfc70a4b
5 changed files with 44 additions and 0 deletions

View File

@@ -166,8 +166,10 @@ int mirror_pass(struct server * serve, int is_last_pass, uint64_t *written)
uint64_t current = 0;
int success = 1;
struct bitset_mapping *map = serve->mirror->dirty_map;
struct mirror * m = serve->mirror;
*written = 0;
while (current < serve->size) {
int run = bitset_run_count(map, current, mirror_longest_write);
@@ -205,7 +207,10 @@ int mirror_pass(struct server * serve, int is_last_pass, uint64_t *written)
}
if (!is_last_pass) { server_unlock_io( serve ); }
m->this_pass_dirty += run;
*written += run;
} else {
m->this_pass_clean += run;
}
current += run;
@@ -353,6 +358,8 @@ void mirror_run( struct server *serve )
info("Starting mirror" );
for (m->pass=0; m->pass < mirror_maximum_passes-1; m->pass++) {
m->this_pass_clean = 0;
m->this_pass_dirty = 0;
debug("mirror start pass=%d", m->pass);
if ( !mirror_pass( serve, 0, &written ) ){
@@ -366,6 +373,9 @@ void mirror_run( struct server *serve )
server_lock_io( serve );
{
m->this_pass_clean = 0;
m->this_pass_dirty = 0;
if ( mirror_pass( serve, 1, &written ) &&
mirror_should_quit( serve->mirror ) ) {
debug("exit!");