Print filenames in the stats screen

This commit is contained in:
Andrea Mazzoleni 2017-11-19 19:33:47 +01:00
parent 176851bbda
commit b9740e06f4
9 changed files with 43 additions and 10 deletions

View file

@ -10,6 +10,8 @@ SnapRAID HISTORY
* More efficient 'pool' command that updates only the links
that need to be updated. This ensures that no change is
done, avoiding to trigger a directory rescan of other programs.
* Changed the --test-io-stats screen to print the file name in process
for each disk.
11.1 2017/05
============

View file

@ -248,6 +248,8 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit
if (!disk)
continue;
state_usage_file(state, disk, task->file);
/* if the block is not used */
if (!block_has_file(block))
continue;

View file

@ -755,7 +755,8 @@ struct snapraid_disk* disk_alloc(const char* name, const char* dir, uint64_t dev
disk->smartctl[0] = 0;
disk->device = dev;
disk->tick = 0;
disk->cached = 0;
disk->cached_blocks = 0;
disk->progress_file = 0;
disk->total_blocks = 0;
disk->free_blocks = 0;
disk->first_free_block = 0;

View file

@ -338,7 +338,8 @@ struct snapraid_disk {
uint64_t tick; /**< Usage time. */
uint64_t progress_tick[PROGRESS_MAX]; /**< Last ticks of progress. */
unsigned cached; /**< Number of IO blocks cached. */
unsigned cached_blocks; /**< Number of IO blocks cached. */
struct snapraid_file* progress_file; /**< File in progress. */
/**
* First free searching block.
@ -468,7 +469,7 @@ struct snapraid_parity {
int skip_access; /**< If at least one of the parity disk is inaccessible and it should be skipped. */
uint64_t tick; /**< Usage time. */
uint64_t progress_tick[PROGRESS_MAX]; /**< Last cpu ticks of progress. */
unsigned cached; /**< Number of IO blocks cached. */
unsigned cached_blocks; /**< Number of IO blocks cached. */
};
/**

View file

@ -490,9 +490,9 @@ static void io_refresh_thread(struct snapraid_io* io)
cached = end - begin;
if (worker->parity_handle)
io->state->parity[worker->parity_handle->level].cached = cached;
io->state->parity[worker->parity_handle->level].cached_blocks = cached;
else
worker->handle->disk->cached = cached;
worker->handle->disk->cached_blocks = cached;
}
/* for all writers, count the number of written blocks */
@ -509,7 +509,7 @@ static void io_refresh_thread(struct snapraid_io* io)
end += io->io_max;
cached = end - begin;
io->state->parity[worker->parity_handle->level].cached = cached;
io->state->parity[worker->parity_handle->level].cached_blocks = cached;
}
thread_mutex_unlock(&io->io_mutex);

View file

@ -392,6 +392,8 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
if (!disk)
continue;
state_usage_file(state, disk, file);
/* if the block is unsynced, errors are expected */
if (block_has_invalid_parity(block)) {
/* report that the block and the file are not synced */

View file

@ -161,7 +161,7 @@ void state_init(struct snapraid_state* state)
state->parity[l].free_blocks = 0;
state->parity[l].skip_access = 0;
state->parity[l].tick = 0;
state->parity[l].cached = 0;
state->parity[l].cached_blocks = 0;
state->parity[l].is_excluded_by_filter = 0;
}
state->tick_io = 0;
@ -4253,17 +4253,23 @@ static void state_progress_graph(struct snapraid_state* state, struct snapraid_i
printf("\n");
/* search for the slowest */
for (i = state->disklist; i != 0; i = i->next) {
struct snapraid_disk* disk = i->data;
v = disk->cached;
v = disk->cached_blocks;
printr(disk->name, pad);
printf("%4" PRIu64 " | ", v);
printc('o', v * bar / io->io_max);
if (disk->progress_file && disk->progress_file->sub)
printf("%s", disk->progress_file->sub);
else
printf("-");
printf("\n");
}
for (l = 0; l < state->level; ++l) {
v = state->parity[l].cached;
v = state->parity[l].cached_blocks;
printr(lev_config_name(l), pad);
printf("%4" PRIu64 " | ", v);
printc('o', v * bar / io->io_max);
@ -4289,6 +4295,9 @@ static void state_progress_graph(struct snapraid_state* state, struct snapraid_i
printf("%3" PRIu64 "%% | ", v * 100 / tick_total);
printc('*', v * bar / tick_total);
printf("\n");
/* clear the file in progress */
disk->progress_file = 0;
}
for (l = 0; l < state->level; ++l) {
@ -4543,6 +4552,13 @@ void state_usage_hash(struct snapraid_state* state)
state->tick_last = now;
}
void state_usage_file(struct snapraid_state* state, struct snapraid_disk* disk, struct snapraid_file* file)
{
(void)state;
disk->progress_file = file;
}
void state_usage_disk(struct snapraid_state* state, struct snapraid_handle* handle_map, unsigned* waiting_map, unsigned waiting_mac)
{
uint64_t now = tick();

View file

@ -347,6 +347,11 @@ void state_usage_sched(struct snapraid_state* state);
void state_usage_raid(struct snapraid_state* state);
void state_usage_hash(struct snapraid_state* state);
/**
* Set the last file used
*/
void state_usage_file(struct snapraid_state* state, struct snapraid_disk* disk, struct snapraid_file* file);
/**
* Set the usage time for a set of data disks.
*/

View file

@ -248,6 +248,8 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
/* until now is disk */
state_usage_disk(state, handle, &j, 1);
state_usage_file(state, disk, file);
countsize += read_size;
/* now compute the hash */
@ -851,6 +853,8 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
if (!disk)
continue;
state_usage_file(state, disk, file);
/* get the state of the block */
block_state = block_state_get(block);