All of lore.kernel.org
 help / color / mirror / Atom feed
From: kusumi.tomohiro@gmail.com
To: axboe@kernel.dk, fio@vger.kernel.org
Cc: Tomohiro Kusumi <tkusumi@tuxera.com>
Subject: [PATCH 08/17] Drop redundant td_rw(td) tests
Date: Tue,  7 Mar 2017 22:12:59 +0200	[thread overview]
Message-ID: <20170307201308.66814-9-tkusumi@tuxera.com> (raw)
In-Reply-To: <20170307201308.66814-1-tkusumi@tuxera.com>

From: Tomohiro Kusumi <tkusumi@tuxera.com>

Since TD_DDIR_READ is 1, TD_DDIR_WRITE is 1<<1, and td_rw() requires
both TD_DDIR_READ/WRITE bits set, testing (td_read(td) || td_rw(td))
turns out to be

if td_read(td) is false, td_rw(td) is always false,
if td_read(td) is true, td_rw(td) won't be tested,
thus the result equals that of td_read(td).

It's the same for td_write(td) as well.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
---
 backend.c | 2 +-
 fio.h     | 2 +-
 init.c    | 2 +-
 verify.c  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/backend.c b/backend.c
index 4bc00e6..2e8a994 100644
--- a/backend.c
+++ b/backend.c
@@ -1693,7 +1693,7 @@ static void *thread_main(void *data)
 
 		prune_io_piece_log(td);
 
-		if (td->o.verify_only && (td_write(td) || td_rw(td)))
+		if (td->o.verify_only && td_write(td))
 			verify_bytes = do_dry_run(td);
 		else {
 			uint64_t bytes_done[DDIR_RWDIR_CNT];
diff --git a/fio.h b/fio.h
index b2f0e2f..b573ac5 100644
--- a/fio.h
+++ b/fio.h
@@ -490,7 +490,7 @@ static inline int should_fsync(struct thread_data *td)
 {
 	if (td->last_was_sync)
 		return 0;
-	if (td_write(td) || td_rw(td) || td->o.override_sync)
+	if (td_write(td) || td->o.override_sync)
 		return 1;
 
 	return 0;
diff --git a/init.c b/init.c
index acdc659..5353890 100644
--- a/init.c
+++ b/init.c
@@ -619,7 +619,7 @@ static int fixup_options(struct thread_data *td)
 	/*
 	 * Reads can do overwrites, we always need to pre-create the file
 	 */
-	if (td_read(td) || td_rw(td))
+	if (td_read(td))
 		o->overwrite = 1;
 
 	if (!o->min_bs[DDIR_READ])
diff --git a/verify.c b/verify.c
index 5c7e43d..f2841c7 100644
--- a/verify.c
+++ b/verify.c
@@ -760,7 +760,7 @@ static int verify_header(struct io_u *io_u, struct thread_data *td,
 	 * 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)) &&
+	if (td_write(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) {
-- 
2.9.3



  parent reply	other threads:[~2017-03-07 20:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-07 20:12 [PATCH 00/17] kusumi.tomohiro
2017-03-07 20:12 ` [PATCH 01/17] Add runtime handlers for 97900ebf for FreeBSD/DragonFlyBSD kusumi.tomohiro
2017-03-07 20:12 ` [PATCH 02/17] HOWTO: Add platforms without fdatasync(2) kusumi.tomohiro
2017-03-07 20:12 ` [PATCH 03/17] configure: Align help messages kusumi.tomohiro
2017-03-07 20:12 ` [PATCH 04/17] Avoid irrelevant "offset extend ends" error message for chrdev kusumi.tomohiro
2017-03-07 20:12 ` [PATCH 05/17] Fix debug print format of file ->file_name kusumi.tomohiro
2017-03-07 20:12 ` [PATCH 06/17] Fixup for a minor 0 byte file size case kusumi.tomohiro
2017-03-07 20:12 ` [PATCH 07/17] Explicitly check td_trim(td) to detect open(2) flag kusumi.tomohiro
2017-03-07 20:12 ` kusumi.tomohiro [this message]
2017-03-07 20:13 ` [PATCH 09/17] Remove unassigned fio_unused variable kusumi.tomohiro
2017-03-07 20:13 ` [PATCH 10/17] Drop fio_unused attribute from used variable kusumi.tomohiro
2017-03-07 20:13 ` [PATCH 11/17] Fix a function name typo in debug print kusumi.tomohiro
2017-03-07 20:13 ` [PATCH 12/17] Don't set FIO_FILE_extend when create_on_open= option is set kusumi.tomohiro
2017-03-07 20:13 ` [PATCH 13/17] Minor fixup for "Layint out IO file..." message kusumi.tomohiro
2017-03-07 20:13 ` [PATCH 14/17] HOWTO: Add some details for invalidate= kusumi.tomohiro
2017-03-07 20:13 ` [PATCH 15/17] Define struct file_name as a file local structure kusumi.tomohiro
2017-03-07 20:13 ` [PATCH 16/17] Use union for per file engine private data storage kusumi.tomohiro
2017-03-07 20:13 ` [PATCH 17/17] configure: Make Cygwin take regular configure path kusumi.tomohiro
2017-03-10 21:44 ` [PATCH 00/17] Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170307201308.66814-9-tkusumi@tuxera.com \
    --to=kusumi.tomohiro@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=tkusumi@tuxera.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.