static int fio_ioring_post_init(struct thread_data *td) { struct ioring_data *ld = td->io_ops_data; struct io_u *io_u; int err, i; for (i = 0; i < td->o.iodepth; i++) { struct iovec *iov = &ld->iovecs[i]; io_u = ld->io_u_index[i]; iov->iov_base = io_u->buf; iov->iov_len = td_max_bs(td); } err = fio_ioring_queue_init(td); if (err) { td_verror(td, errno, "io_queue_init"); return 1; } return 0; }
static int verify_io_u_meta(struct verify_header *hdr, struct vcont *vc) { struct thread_data *td = vc->td; struct vhdr_meta *vh = hdr_priv(hdr); struct io_u *io_u = vc->io_u; int ret = EILSEQ; dprint(FD_VERIFY, "meta verify io_u %p, len %u\n", io_u, hdr->len); if (vh->offset == io_u->offset + vc->hdr_num * td->o.verify_interval) ret = 0; if (td->o.verify_pattern_bytes) ret |= verify_io_u_pattern(hdr, vc); /* * For read-only workloads, the program cannot be certain of the * last numberio written to a block. Checking of numberio will be * done only for workloads that write data. For verify_only, * numberio will be checked in the last iteration when the correct * state of numberio, that would have been written to each block * in a previous run of fio, has been reached. */ if ((td_write(td) || td_rw(td)) && (td_min_bs(td) == td_max_bs(td)) && !td->o.time_based) if (!td->o.verify_only || td->o.loops == 0) if (vh->numberio != io_u->numberio) ret = EILSEQ; if (!ret) return 0; vc->name = "meta"; log_verify_failure(hdr, vc); return ret; }
static int verify_header(struct io_u *io_u, struct thread_data *td, struct verify_header *hdr, unsigned int hdr_num, unsigned int hdr_len) { void *p = hdr; uint32_t crc; if (hdr->magic != FIO_HDR_MAGIC) { log_err("verify: bad magic header %x, wanted %x", hdr->magic, FIO_HDR_MAGIC); goto err; } if (hdr->len != hdr_len) { log_err("verify: bad header length %u, wanted %u", hdr->len, hdr_len); goto err; } if (hdr->rand_seed != io_u->rand_seed) { log_err("verify: bad header rand_seed %"PRIu64 ", wanted %"PRIu64, hdr->rand_seed, io_u->rand_seed); goto err; } if (hdr->offset != io_u->offset + hdr_num * td->o.verify_interval) { log_err("verify: bad header offset %"PRIu64 ", wanted %llu", hdr->offset, io_u->offset); goto err; } /* * For read-only workloads, the program cannot be certain of the * last numberio written to a block. Checking of numberio will be * done only for workloads that write data. For verify_only, * numberio will be checked in the last iteration when the correct * state of numberio, that would have been written to each block * in a previous run of fio, has been reached. */ if ((td_write(td) || td_rw(td)) && (td_min_bs(td) == td_max_bs(td)) && !td->o.time_based) if (!td->o.verify_only || td->o.loops == 0) if (hdr->numberio != io_u->numberio) { log_err("verify: bad header numberio %"PRIu16 ", wanted %"PRIu16, hdr->numberio, io_u->numberio); goto err; } crc = fio_crc32c(p, offsetof(struct verify_header, crc32)); if (crc != hdr->crc32) { log_err("verify: bad header crc %x, calculated %x", hdr->crc32, crc); goto err; } return 0; err: log_err(" at file %s offset %llu, length %u\n", io_u->file->file_name, io_u->offset + hdr_num * hdr_len, hdr_len); if (td->o.verify_dump) dump_buf(p, hdr_len, io_u->offset + hdr_num * hdr_len, "hdr_fail", io_u->file); return EILSEQ; }