X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Fmtd.c;h=b4a660041cf1c9ecf2210e9387aef3e38d9b47da;hp=3c22a1b15be99032b53d1bb70a27cf1109811cde;hb=e59b9e111792bd0f5f807ed2466cf1904b5f1379;hpb=589e88b7d96e8ea18f3257558fd1e00d320cef7d diff --git a/engines/mtd.c b/engines/mtd.c index 3c22a1b1..b4a66004 100644 --- a/engines/mtd.c +++ b/engines/mtd.c @@ -13,6 +13,7 @@ #include #include "../fio.h" +#include "../optgroup.h" #include "../verify.h" #include "../oslib/libmtd.h" @@ -22,6 +23,28 @@ struct fio_mtd_data { struct mtd_dev_info info; }; +struct fio_mtd_options { + void *pad; /* avoid off1 == 0 */ + unsigned int skip_bad; +}; + +static struct fio_option options[] = { + { + .name = "skip_bad", + .lname = "Skip operations against bad blocks", + .type = FIO_OPT_BOOL, + .off1 = offsetof(struct fio_mtd_options, skip_bad), + .help = "Skip operations against known bad blocks.", + .hide = 1, + .def = "0", + .category = FIO_OPT_C_ENGINE, + .group = FIO_OPT_G_MTD, + }, + { + .name = NULL, + }, +}; + static int fio_mtd_maybe_mark_bad(struct thread_data *td, struct fio_mtd_data *fmd, struct io_u *io_u, int eb) @@ -55,6 +78,7 @@ static int fio_mtd_queue(struct thread_data *td, struct io_u *io_u) { struct fio_file *f = io_u->file; struct fio_mtd_data *fmd = FILE_ENG_DATA(f); + struct fio_mtd_options *o = td->eo; int local_offs = 0; int ret; @@ -77,7 +101,7 @@ static int fio_mtd_queue(struct thread_data *td, struct io_u *io_u) (int)fmd->info.eb_size - eb_offs); char *buf = ((char *)io_u->buf) + local_offs; - if (td->o.skip_bad) { + if (o->skip_bad) { ret = fio_mtd_is_bad(td, fmd, io_u, eb); if (ret == -1) break; @@ -190,6 +214,8 @@ static struct ioengine_ops ioengine = { .close_file = fio_mtd_close_file, .get_file_size = fio_mtd_get_file_size, .flags = FIO_SYNCIO | FIO_NOEXTEND, + .options = options, + .option_struct_size = sizeof(struct fio_mtd_options), }; static void fio_init fio_mtd_register(void)