[PATCH 1/7] fio: allow trim operations for verify/trim workloads
Vincent Fu <[email protected]>
| Newsgroups | org.kernel.vger.fio |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]>
---
fio.h | 10 +++++++++-
init.c | 7 +++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/fio.h b/fio.h
index d6423258..00f0f09b 100644
--- a/fio.h
+++ b/fio.h
@@ -292,6 +292,7 @@ struct thread_data {
unsigned int verify_batch;
unsigned int trim_batch;
+ bool trim_verify;
struct thread_io_list *vstate;
@@ -618,7 +619,14 @@ extern bool eta_time_within_slack(unsigned int time);
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)
diff --git a/init.c b/init.c
index 95f2179d..85ae67fd 100644
--- a/init.c
+++ b/init.c
@@ -729,6 +729,13 @@ static int fixup_options(struct thread_data *td)
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, "
--
2.47.2