Re: offset broken for randwrite?

From: Jens Axboe <jens.axboe_at_oracle.com>
Date: Tue, 19 Feb 2008 18:24:13 +0100

On Tue, Feb 19 2008, Jens Axboe wrote:
> On Tue, Feb 19 2008, Ryan Thomas wrote:
> >
> >
> > > Sorry for the late response, I was on vacation last week. It is indeed
> > > the offset screwing things up, mark_random_map() needs to take that into
> > > account. Does this work?
> >
> > > diff --git a/io_u.c b/io_u.c
> > > index 8f10bfd..c102d5f 100644
> > > --- a/io_u.c
> > > +++ b/io_u.c
> > > @@ -44,7 +44,7 @@ static void mark_random_map(struct thread_data *td, struct io_u *io_u)
> > > unsigned int blocks;
> > > unsigned int nr_blocks;
> > >
> > > - block = io_u->offset / (unsigned long long) min_bs;
> > > + block = (io_u->offset - f->file_offset) / (unsigned long long) min_bs;
> > > blocks = 0;
> > > nr_blocks = (io_u->buflen + min_bs - 1) / min_bs;
> >
> > I get segfaults with 1.18.1 (which includes the above patch) and the git-latest version as well.
> >
> > vmware64 ~ # fio-1.18.1/fio xraid.fio
> > xraid: (g=0): rw=randwrite, bs=64K-64K/64K-64K, ioengine=libaio, iodepth=32
> > Starting 1 process
> > fio: pid=30723, got signal=11
> >
> > xraid: (groupid=0, jobs=1): err= 0: pid=30723
> > cpu : usr=0.00%, sys=0.00%, ctx=0, majf=0, minf=0
> > IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
> > issued r/w: total=0/1, short=0/0
> >
> >
> >
> > Run status group 0 (all jobs):
> >
> > Disk stats (read/write):
> > sdf: ios=0/0, merge=0/0, ticks=0/0, in_queue=0, util=0.00%
> >
> >
> > I was using the same testing file as I referenced before
>
> Oops, that's no good. I'll get on it.

This should fix it.

diff --git a/fio.h b/fio.h
index 9c90024..d8c6595 100644
--- a/fio.h
+++ b/fio.h
@@ -683,7 +683,7 @@ static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u)
 }
 
 #define BLOCKS_PER_MAP (8 * sizeof(long))
-#define TO_MAP_BLOCK(td, f, b) ((b) - ((f)->file_offset / (unsigned long long) (td)->o.rw_min_bs))
+#define TO_MAP_BLOCK(td, f, b) ((b) / ((unsigned long long) (td)->o.rw_min_bs))
 #define RAND_MAP_IDX(td, f, b) (TO_MAP_BLOCK(td, f, b) / BLOCKS_PER_MAP)
 #define RAND_MAP_BIT(td, f, b) (TO_MAP_BLOCK(td, f, b) & (BLOCKS_PER_MAP - 1))
 

-- 
Jens Axboe
Received on Tue Feb 19 2008 - 18:24:13 CET

This archive was generated by hypermail 2.2.0 : Tue Feb 19 2008 - 18:30:02 CET