[PATCH 2/2] Added wraparound IO support for replay on smaller/offsetted device.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch is related to previous one, but is independent.

When replayed IO goes beyond end of IO-redirected drive,
fio currently fails with lseek error. This happens when
IO offset shifting in previous patch is done, or when
redirected device is smaller than that of log-generating
device.

This patch wraps around IO offset by target device size
to keep fio running.

Signed-off-by: Taisuke Yamada <tai@xxxxxxxxxxxx>
---
 log.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)


diff --git a/log.c b/log.c
index 57fc0f4..a636b7e 100644
--- a/log.c
+++ b/log.c
@@ -87,6 +87,7 @@ static int ipo_special(struct thread_data *td, struct io_piece *ipo)
 
 	switch (ipo->file_action) {
 	case FIO_LOG_OPEN_FILE:
+		ret = td_io_get_file_size(td, f); /* for wraparound replay */
 		ret = td_io_open_file(td, f);
 		if (!ret)
 			break;
@@ -132,6 +133,8 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u)
 			io_u->offset = ipo->offset + td->o.replay_rebase * td->thread_number;
 			io_u->buflen = ipo->len;
 			io_u->file = td->files[ipo->fileno];
+			if (io_u->file->real_file_size > 0)
+				io_u->offset %= io_u->file->real_file_size;
 			get_file(io_u->file);
 			dprint(FD_IO, "iolog: get %llu/%lu/%s\n", io_u->offset,
 						io_u->buflen, io_u->file->file_name);


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux