[PATCH 3/7] init: error out when readonly is set for a trim/verify workload

Vincent Fu <[email protected]>
Newsgroups org.kernel.vger.fio
Message-ID <[email protected]>
Fio may issue trim commands for a verify/trim job. Abort and print an
error message if this type of job is run with the --readonly option.

Signed-off-by: Vincent Fu <[email protected]>
---
 init.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/init.c b/init.c
index 85ae67fd..20f5462d 100644
--- a/init.c
+++ b/init.c
@@ -612,7 +612,14 @@ static int fixup_options(struct thread_data *td)
 	struct thread_options *o = &td->o;
 	int ret = 0;
 
-	if (read_only && (td_write(td) || td_trim(td))) {
+	/*
+	 * 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 (read_only && (td_write(td) || td_trim(td) || td->trim_verify)) {
 		log_err("fio: trim and write operations are not allowed"
 			 " with the --readonly parameter.\n");
 		ret |= 1;
@@ -729,13 +736,6 @@ 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.