create_serialize=x If 'x', serialize file creation.
create_fsync=x If 'x', run fsync() after file creation.
loops=x Run the job 'x' number of times.
+ verify=x If 'x' and writing, verify data written.
Examples using a job file
#define DEF_CREATE_SER (1)
#define DEF_CREATE_FSYNC (1)
#define DEF_LOOPS (1)
+#define DEF_VERIFY (0)
#define ALIGN(buf) (char *) (((unsigned long) (buf) + MASK) & ~(MASK))
unsigned long long file_offset;
unsigned int sync_io;
unsigned int mem_type;
+ unsigned int verify;
cpu_set_t cpumask;
struct drand48_data bsrange_state;
return 0;
}
+/*
+ * fill body of io_u->buf with random data and add a header with the
+ * (eg) sha1sum of that data.
+ */
+static void populate_io_u(struct io_u *io_u)
+{
+}
+
static void put_io_u(struct thread_data *td, struct io_u *io_u)
{
list_del(&io_u->list);
io_u->offset = off;
io_u->buflen = len;
+ if (!td_read(td) && td->verify)
+ populate_io_u(io_u);
+
if (td->use_aio) {
if (td_read(td))
io_prep_pread(&io_u->iocb, td->fd, io_u->buf, io_u->buflen, io_u->offset);
return io_u;
}
+static int do_sync_verify(struct thread_data *td)
+{
+ return 0;
+}
+
static void do_sync_io(struct thread_data *td)
{
unsigned long msec, usec;
}
}
+static int do_async_verify(struct thread_data *td)
+{
+ return 0;
+}
+
static void do_async_io(struct thread_data *td)
{
struct timeval s, e;
memcpy(&td->stat_sample_time, &td->start, sizeof(td->start));
while (td->loops--) {
- if (!td->use_aio)
+ if (!td->use_aio) {
do_sync_io(td);
- else
+
+ if (td->verify) {
+ if (do_sync_verify(td))
+ break;
+ }
+ } else {
do_async_io(td);
+
+ if (td->verify) {
+ if (do_async_verify(td))
+ break;
+ }
+ }
}
td->runtime = mtime_since_now(&td->start);
td->create_serialize = def_thread.create_serialize;
td->create_fsync = def_thread.create_fsync;
td->loops = def_thread.loops;
+ td->verify = def_thread.verify;
memcpy(&td->cpumask, &def_thread.cpumask, sizeof(td->cpumask));
return td;
def_thread.create_serialize = DEF_CREATE_SER;
def_thread.create_fsync = DEF_CREATE_FSYNC;
def_thread.loops = DEF_LOOPS;
+ def_thread.verify = DEF_VERIFY;
i = parse_options(argc, argv);