Flexible I/O Tester development
 help / color / mirror / Atom feed
From: vincentfu@gmail.com
To: axboe@kernel.dk, fio@vger.kernel.org
Cc: Vincent Fu <vincent.fu@wdc.com>
Subject: [PATCH 2/2] filesetup: honor the offset option
Date: Wed, 11 Sep 2019 10:56:40 -0400	[thread overview]
Message-ID: <20190911145640.30005-3-vincentfu@gmail.com> (raw)
In-Reply-To: <20190911145640.30005-1-vincentfu@gmail.com>

From: Vincent Fu <vincent.fu@wdc.com>

Commands like the following do not honor the value given by the offset
option:

./fio --name=test --rw=randread --runtime=10s --offset=90% --time_based --ioengine=null --size=1T --norandommap --randrepeat=0
./fio --name=test --size=8k --offset=4k

In the random case, eventually a random offset will be generated beyond
the 1T file size, leading to a failure.

In the sequential case, a 12k file will be created despite size
specifying the 8k end boundary.

This patch modifies setup_files() so that f->io_size incorporates the
offset for cases like those above.
---
 filesetup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/filesetup.c b/filesetup.c
index 7904d187..b8d1d838 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -1047,7 +1047,7 @@ int setup_files(struct thread_data *td)
 			 * doesn't divide nicely with the min blocksize,
 			 * make the first files bigger.
 			 */
-			f->io_size = fs;
+			f->io_size = fs - f->file_offset;
 			if (nr_fs_extra) {
 				nr_fs_extra--;
 				f->io_size += bs;
-- 
2.17.1



  parent reply	other threads:[~2019-09-11 14:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11 14:56 [PATCH 0/2] two patches vincentfu
2019-09-11 14:56 ` [PATCH 1/2] doc: clarify what --alloc-size does vincentfu
2019-09-11 14:56 ` vincentfu [this message]
2019-09-11 15:00 ` [PATCH 0/2] two patches 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=20190911145640.30005-3-vincentfu@gmail.com \
    --to=vincentfu@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=vincent.fu@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox