Skip to content

Commit

Permalink
t/verify-state.c: adjust to verify state format change
Browse files Browse the repository at this point in the history
The previous commit modified the format of verify state files. To adjust
to the change, add support of the new field "max_no_comps_per_file" and
pass it to __thread_io_list_sz(). Also check the version number against
the new version 4.

Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
kawasaki authored and axboe committed Feb 13, 2025
1 parent 9abce42 commit 0e0d9a3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions t/verify-state.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static void show_s(struct thread_io_list *s, unsigned int no_s)
printf("Name:\t\t%s\n", s->name);
printf("Completions:\t%llu\n", (unsigned long long) s->no_comps);
printf("Depth:\t\t%llu\n", (unsigned long long) s->depth);
printf("Max completions per file:\t\t%lu\n", (unsigned long) s->max_no_comps_per_file);
printf("Number IOs:\t%llu\n", (unsigned long long) s->numberio);
printf("Index:\t\t%llu\n", (unsigned long long) s->index);

Expand All @@ -46,6 +47,7 @@ static void show(struct thread_io_list *s, size_t size)

s->no_comps = le64_to_cpu(s->no_comps);
s->depth = le32_to_cpu(s->depth);
s->max_no_comps_per_file = le32_to_cpu(s->max_no_comps_per_file);
s->nofiles = le32_to_cpu(s->nofiles);
s->numberio = le64_to_cpu(s->numberio);
s->index = le64_to_cpu(s->index);
Expand All @@ -57,9 +59,9 @@ static void show(struct thread_io_list *s, size_t size)

show_s(s, no_s);
no_s++;
size -= __thread_io_list_sz(s->depth, s->nofiles);
size -= __thread_io_list_sz(s->max_no_comps_per_file, s->nofiles);
s = (struct thread_io_list *)((char *) s +
__thread_io_list_sz(s->depth, s->nofiles));
__thread_io_list_sz(s->max_no_comps_per_file, s->nofiles));
} while (size != 0);
}

Expand Down Expand Up @@ -90,7 +92,7 @@ static void show_verify_state(void *buf, size_t size)
return;
}

if (hdr->version == 0x03)
if (hdr->version == 0x04)
show(s, size);
else
log_err("Unsupported version %d\n", (int) hdr->version);
Expand Down

0 comments on commit 0e0d9a3

Please sign in to comment.