All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: fio@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Cc: Damien Le Moal <Damien.LeMoal@wdc.com>,
	Dmitry Fomichev <Dmitry.Fomichev@wdc.com>,
	Niklas Cassel <niklas.cassel@wdc.com>,
	Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: [PATCH 2/2] Refer td->loops instead of td->o.loops to fix loop count issue
Date: Fri,  1 Oct 2021 19:32:57 +0900	[thread overview]
Message-ID: <20211001103257.4130231-3-shinichiro.kawasaki@wdc.com> (raw)
In-Reply-To: <20211001103257.4130231-1-shinichiro.kawasaki@wdc.com>

In the github issues #1093 and #1278, it was reported that the loops
option does not work as expected when do_verify=0 option is specified.
Per analysis by Sowmya Ravi, the cause was as follows:

1) keep_running() decrements td->o.loops at job repetition, then
   td->o.loops has zero value when the last loop is executed.
2) clear_io_state() is called at the beginning of the thread_main loop
   for each repetition for loops option.
3) clear_io_state() calls reset_io_counters() which resets
   td->nr_done_files to zero when td->o.loops is non-zero.
4) For the last loop of loops option, clear_io_state() call does not
   clear td->nr_done_files since td->l.loops is zero. This results in a
   setup error in do_io().

To fix the issue, modify reset_io_counters() to refer td->loops instead
of td->o.loops. td->o.loops is not a good reference since it is updated
in keep_running(). td->loops is not updated during fio run, and safe to
refer.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 libfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libfio.c b/libfio.c
index 6144a474..ed5906d4 100644
--- a/libfio.c
+++ b/libfio.c
@@ -104,7 +104,7 @@ static void reset_io_counters(struct thread_data *td, int all)
 	/*
 	 * reset file done count if we are to start over
 	 */
-	if (td->o.time_based || td->o.loops || td->o.do_verify)
+	if (td->o.time_based || td->loops > 1 || td->o.do_verify)
 		td->nr_done_files = 0;
 }
 
-- 
2.31.1


  parent reply	other threads:[~2021-10-01 10:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 10:32 [PATCH 0/2] Fix job completion failure for sequential IOs with holes Shin'ichiro Kawasaki
2021-10-01 10:32 ` [PATCH 1/2] Revert "Fix for loop count issue when do_verify=0 (#1093)" Shin'ichiro Kawasaki
2021-10-01 10:32 ` Shin'ichiro Kawasaki [this message]
2021-10-01 17:17 ` [PATCH 0/2] Fix job completion failure for sequential IOs with holes 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=20211001103257.4130231-3-shinichiro.kawasaki@wdc.com \
    --to=shinichiro.kawasaki@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=Dmitry.Fomichev@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=niklas.cassel@wdc.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.