Flexible I/O Tester development
 help / color / mirror / Atom feed
* [PATCH] Fixing wraparound behavior for time-based sequential read jobs
@ 2012-08-15 22:08 Dan Ehrenberg
  2012-08-16  6:57 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Ehrenberg @ 2012-08-15 22:08 UTC (permalink / raw)
  To: fio, axboe; +Cc: nauman, jhr, akashv, aschade, Dan Ehrenberg

Previously, a buggy patch made sequential jobs wrap around when they
reached an offset of 'size'. However, the appropriate wraparound is at
size + initial offset. This patch restores the previous behavior.
---
 file.h      |    1 +
 filesetup.c |    9 +++++++--
 io_u.c      |    4 ++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/file.h b/file.h
index 51df839..68f9a6e 100644
--- a/file.h
+++ b/file.h
@@ -147,6 +147,7 @@ FILE_FLAG_FNS(partial_mmap);
 struct thread_data;
 extern void close_files(struct thread_data *);
 extern void close_and_free_files(struct thread_data *);
+extern unsigned long long get_start_offset(struct thread_data *);
 extern int __must_check setup_files(struct thread_data *);
 extern int __must_check file_invalidate_cache(struct thread_data *, struct fio_file *);
 extern int __must_check generic_open_file(struct thread_data *, struct fio_file *);
diff --git a/filesetup.c b/filesetup.c
index 6277f0f..3594a80 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -657,6 +657,12 @@ static unsigned long long get_fs_free_counts(struct thread_data *td)
 	return ret;
 }
 
+unsigned long long get_start_offset(struct thread_data *td)
+{
+	return td->o.start_offset +
+		(td->thread_number - 1) * td->o.offset_increment;
+}
+
 /*
  * Open the files and setup files sizes, creating files if necessary.
  */
@@ -718,8 +724,7 @@ int setup_files(struct thread_data *td)
 	extend_size = total_size = 0;
 	need_extend = 0;
 	for_each_file(td, f, i) {
-		f->file_offset = td->o.start_offset +
-			(td->thread_number - 1) * td->o.offset_increment;
+		f->file_offset = get_start_offset(td);
 
 		if (!td->o.file_size_low) {
 			/*
diff --git a/io_u.c b/io_u.c
index 6646332..2f54562 100644
--- a/io_u.c
+++ b/io_u.c
@@ -256,7 +256,7 @@ static int get_next_seq_offset(struct thread_data *td, struct fio_file *f,
 {
 	assert(ddir_rw(ddir));
 
-	if (f->last_pos >= f->io_size && td->o.time_based)
+	if (f->last_pos >= f->io_size + get_start_offset(td) && td->o.time_based)
 		f->last_pos = f->last_pos - f->io_size;
 
 	if (f->last_pos < f->real_file_size) {
@@ -377,7 +377,7 @@ static inline int io_u_fits(struct thread_data *td, struct io_u *io_u,
 {
 	struct fio_file *f = io_u->file;
 
-	return io_u->offset + buflen <= f->io_size + td->o.start_offset;
+	return io_u->offset + buflen <= f->io_size + get_start_offset(td);
 }
 
 static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u)
-- 
1.7.7.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fixing wraparound behavior for time-based sequential read jobs
  2012-08-15 22:08 [PATCH] Fixing wraparound behavior for time-based sequential read jobs Dan Ehrenberg
@ 2012-08-16  6:57 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2012-08-16  6:57 UTC (permalink / raw)
  To: Dan Ehrenberg; +Cc: fio, nauman, jhr, akashv, aschade

On 08/16/2012 12:08 AM, Dan Ehrenberg wrote:
> Previously, a buggy patch made sequential jobs wrap around when they
> reached an offset of 'size'. However, the appropriate wraparound is at
> size + initial offset. This patch restores the previous behavior.

Thanks Dan, that looks correct. Applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-16  6:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-15 22:08 [PATCH] Fixing wraparound behavior for time-based sequential read jobs Dan Ehrenberg
2012-08-16  6:57 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox