From 36690c9b5b50736cec1fcd53100f01fd1181fdf4 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 26 Mar 2007 10:23:34 +0200 Subject: [PATCH] Add 'null' verify option For testing purposes. Signed-off-by: Jens Axboe --- HOWTO | 4 ++++ fio.h | 7 +++++-- io_u.c | 2 +- options.c | 5 +++++ verify.c | 7 +++++-- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/HOWTO b/HOWTO index 8312d931..a5be9dbd 100644 --- a/HOWTO +++ b/HOWTO @@ -555,6 +555,10 @@ verify=str If writing to a file, fio can verify the file contents crc32 Use a crc32 sum of the data area and store it in the header of each block. + null Only pretend to verify. Useful for testing + internals with ioengine=null, not for much + else. + This option can be used for repeated burn-in tests of a system to make sure that the written data is also correctly read back. diff --git a/fio.h b/fio.h index 4111bffb..4d7e6ea7 100644 --- a/fio.h +++ b/fio.h @@ -102,6 +102,8 @@ enum { IO_U_F_FLIGHT = 1 << 1, }; +struct thread_data; + /* * The io unit */ @@ -162,7 +164,7 @@ struct io_u { /* * Callback for io completion */ - int (*end_io)(struct io_u *); + int (*end_io)(struct thread_data *, struct io_u *); }; /* @@ -180,6 +182,7 @@ enum { VERIFY_NONE = 0, /* no verification */ VERIFY_MD5, /* md5 sum data blocks */ VERIFY_CRC32, /* crc32 sum data blocks */ + VERIFY_NULL, /* pretend to verify */ }; /* @@ -744,7 +747,7 @@ enum { */ extern void populate_verify_io_u(struct thread_data *, struct io_u *); extern int __must_check get_next_verify(struct thread_data *td, struct io_u *); -extern int __must_check verify_io_u(struct io_u *); +extern int __must_check verify_io_u(struct thread_data *, struct io_u *); /* * Memory helpers diff --git a/io_u.c b/io_u.c index 660db070..9c8ff263 100644 --- a/io_u.c +++ b/io_u.c @@ -666,7 +666,7 @@ static void io_completed(struct thread_data *td, struct io_u *io_u, icd->bytes_done[idx] += bytes; if (io_u->end_io) { - ret = io_u->end_io(io_u); + ret = io_u->end_io(td, io_u); if (ret && !icd->error) icd->error = ret; } diff --git a/options.c b/options.c index bbb30990..5401f903 100644 --- a/options.c +++ b/options.c @@ -531,6 +531,11 @@ static struct fio_option options[] = { .oval = VERIFY_MD5, .help = "Use md5 checksums for verification", }, + { + .ival = "null", + .oval = VERIFY_NULL, + .help = "Pretend to verify", + }, }, }, { diff --git a/verify.c b/verify.c index 7fbb2e6c..f1ac43bf 100644 --- a/verify.c +++ b/verify.c @@ -78,11 +78,14 @@ static int verify_io_u_md5(struct verify_header *hdr, struct io_u *io_u) return 0; } -int verify_io_u(struct io_u *io_u) +int verify_io_u(struct thread_data *td, struct io_u *io_u) { struct verify_header *hdr = (struct verify_header *) io_u->buf; int ret; + if (td->o.verify == VERIFY_NULL) + return 0; + if (hdr->fio_magic != FIO_HDR_MAGIC) { log_err("Bad verify header %x\n", hdr->fio_magic); return EIO; @@ -134,7 +137,7 @@ void populate_verify_io_u(struct thread_data *td, struct io_u *io_u) if (td->o.verify == VERIFY_MD5) { fill_md5(&hdr, p, io_u->buflen - sizeof(hdr)); hdr.verify_type = VERIFY_MD5; - } else { + } else if (td->o.verify == VERIFY_CRC32) { fill_crc32(&hdr, p, io_u->buflen - sizeof(hdr)); hdr.verify_type = VERIFY_CRC32; } -- 2.25.1