Fio has the ability to verify trim operations by running a verify
workload and setting the trim_percentage, trim_backlog, and
trim_verify_zero options. Some of the written blocks will then be
trimmed and then read back to see if they are zeroed out.
This patch changes fio_ro_check to allow trim operations when fio is
running a verify/trim workload.
Fixes:
196ccc44 ("fio.h: also check trim operations in fio_ro_check")
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
unsigned int verify_batch;
unsigned int trim_batch;
+ bool trim_verify;
struct thread_io_list *vstate;
static inline void fio_ro_check(const struct thread_data *td, struct io_u *io_u)
{
assert(!(io_u->ddir == DDIR_WRITE && !td_write(td)) &&
- !(io_u->ddir == DDIR_TRIM && !td_trim(td)));
+ !(io_u->ddir == DDIR_TRIM && !(td_trim(td) || td->trim_verify)));
+
+ /*
+ * The last line above allows trim operations during trim/verify
+ * workloads. For these workloads we cannot simply set the trim bit for
+ * the thread's ddir because then fio would assume that
+ * ddir={trimewrite, randtrimwrite}.
+ */
}
static inline bool multi_range_trim(struct thread_data *td, struct io_u *io_u)
o->start_delay_high);
}
+ /*
+ * Denote whether we are verifying trims. Now we only have to check a
+ * single variable instead of having to check all three options.
+ */
+ td->trim_verify = o->verify && o->trim_backlog && o->trim_percentage;
+ dprint(FD_VERIFY, "td->trim_verify=%d\n", td->trim_verify);
+
if (o->norandommap && o->verify != VERIFY_NONE
&& !fixed_block_size(o)) {
log_err("fio: norandommap given for variable block sizes, "