- Subject: [PATCH 2/2] Added wraparound IO support for replay on smaller/offsetted device.
- From: Taisuke Yamada <tai@xxxxxxxxxxxx>
- Date: Fri, 09 Sep 2011 14:17:33 +0900
- User-agent: Thunderbird 2.0.0.24 (Windows/20100228)
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);
[Home]
[Linux SCSI]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Video Projectors]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]