X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=verify.c;h=aa178e950b83bf43757b707c6e4b681ff08d015d;hp=2ae03f85fbea88f4e0f24ff33a4480d124d27e26;hb=44cc9c8fccd1862045ef029dc9a484c4a2e46731;hpb=b2a9e6496494373f97f78dcdb3663fbb7b7a4ddb diff --git a/verify.c b/verify.c index 2ae03f85..aa178e95 100644 --- a/verify.c +++ b/verify.c @@ -472,6 +472,7 @@ static int verify_io_u_sha256(struct verify_header *hdr, struct vcont *vc) fio_sha256_init(&sha256_ctx); fio_sha256_update(&sha256_ctx, p, hdr->len - hdr_size(hdr)); + fio_sha256_final(&sha256_ctx); if (!memcmp(vh->sha256, sha256_ctx.buf, sizeof(sha256))) return 0; @@ -497,6 +498,7 @@ static int verify_io_u_sha1(struct verify_header *hdr, struct vcont *vc) fio_sha1_init(&sha1_ctx); fio_sha1_update(&sha1_ctx, p, hdr->len - hdr_size(hdr)); + fio_sha1_final(&sha1_ctx); if (!memcmp(vh->sha1, sha1_ctx.H, sizeof(sha1))) return 0; @@ -627,6 +629,7 @@ static int verify_io_u_md5(struct verify_header *hdr, struct vcont *vc) fio_md5_init(&md5_ctx); fio_md5_update(&md5_ctx, p, hdr->len - hdr_size(hdr)); + fio_md5_final(&md5_ctx); if (!memcmp(vh->md5_digest, md5_ctx.hash, sizeof(hash))) return 0; @@ -653,7 +656,7 @@ int verify_io_u_async(struct thread_data *td, struct io_u **io_u_ptr) if (io_u->flags & IO_U_F_IN_CUR_DEPTH) { td->cur_depth--; - io_u->flags &= ~IO_U_F_IN_CUR_DEPTH; + io_u_clear(io_u, IO_U_F_IN_CUR_DEPTH); } flist_add_tail(&io_u->verify_list, &td->verify_list); *io_u_ptr = NULL; @@ -893,6 +896,7 @@ static void fill_sha256(struct verify_header *hdr, void *p, unsigned int len) fio_sha256_init(&sha256_ctx); fio_sha256_update(&sha256_ctx, p, len); + fio_sha256_final(&sha256_ctx); } static void fill_sha1(struct verify_header *hdr, void *p, unsigned int len) @@ -904,6 +908,7 @@ static void fill_sha1(struct verify_header *hdr, void *p, unsigned int len) fio_sha1_init(&sha1_ctx); fio_sha1_update(&sha1_ctx, p, len); + fio_sha1_final(&sha1_ctx); } static void fill_crc7(struct verify_header *hdr, void *p, unsigned int len) @@ -950,6 +955,7 @@ static void fill_md5(struct verify_header *hdr, void *p, unsigned int len) fio_md5_init(&md5_ctx); fio_md5_update(&md5_ctx, p, len); + fio_md5_final(&md5_ctx); } static void populate_hdr(struct thread_data *td, struct io_u *io_u, @@ -1099,10 +1105,10 @@ int get_next_verify(struct thread_data *td, struct io_u *io_u) io_u->buflen = ipo->len; io_u->numberio = ipo->numberio; io_u->file = ipo->file; - io_u->flags |= IO_U_F_VER_LIST; + io_u_set(io_u, IO_U_F_VER_LIST); if (ipo->flags & IP_F_TRIMMED) - io_u->flags |= IO_U_F_TRIMMED; + io_u_set(io_u, IO_U_F_TRIMMED); if (!fio_file_open(io_u->file)) { int r = td_io_open_file(td, io_u->file); @@ -1186,7 +1192,7 @@ static void *verify_async_thread(void *data) io_u = flist_first_entry(&list, struct io_u, verify_list); flist_del_init(&io_u->verify_list); - io_u->flags |= IO_U_F_NO_FILE_PUT; + io_u_set(io_u, IO_U_F_NO_FILE_PUT); ret = verify_io_u(td, &io_u); put_io_u(td, io_u); @@ -1341,7 +1347,8 @@ struct all_io_list *get_all_io_list(int save_mask, size_t *sz) s->rand.s[1] = cpu_to_le32(td->random_state.s2); s->rand.s[2] = cpu_to_le32(td->random_state.s3); s->rand.s[3] = 0; - strncpy((char *) s->name, td->o.name, sizeof(s->name)); + s->name[sizeof(s->name) - 1] = '\0'; + strncpy((char *) s->name, td->o.name, sizeof(s->name) - 1); next = io_list_next(s); } @@ -1539,10 +1546,12 @@ int verify_state_should_stop(struct thread_data *td, struct io_u *io_u) return 0; /* - * If we're not into the window of issues - depth yet, continue + * If we're not into the window of issues - depth yet, continue. If + * issue is shorter than depth, do check. */ - if (td->io_blocks[DDIR_READ] < s->depth || - s->numberio - td->io_blocks[DDIR_READ] > s->depth) + if ((td->io_blocks[DDIR_READ] < s->depth || + s->numberio - td->io_blocks[DDIR_READ] > s->depth) && + s->numberio > s->depth) return 0; /*