From aa31f1f108348ba2a8749c73fa8c25f3d4630a7c Mon Sep 17 00:00:00 2001 From: Shawn Lewis Date: Fri, 11 Jan 2008 09:45:11 +0100 Subject: [PATCH] Add fill_device option Add fill_device option. Causes fio to write until ENOSPC occurs (assuming rw=write). Signed-off-by: Jens Axboe --- HOWTO | 4 ++++ filesetup.c | 2 +- fio.c | 4 ++++ fio.h | 1 + init.c | 3 +++ options.c | 7 +++++++ 6 files changed, 20 insertions(+), 1 deletion(-) diff --git a/HOWTO b/HOWTO index 569b998f..7b717f77 100644 --- a/HOWTO +++ b/HOWTO @@ -262,6 +262,10 @@ filesize=siint Individual file sizes. May be a range, in which case fio and limited to 'size' in total (if that is given). If not given, each created file is the same size. +fill_device=bool Sets size to something really large and waits for ENOSPC (no + space left on device) as the terminating condition. Only makes + sense with sequential write. + blocksize=siint bs=siint The block size used for the io units. Defaults to 4k. Values can be given for both read and writes. If a single siint is diff --git a/filesetup.c b/filesetup.c index a7dff0fc..210cd2ff 100644 --- a/filesetup.c +++ b/filesetup.c @@ -380,7 +380,7 @@ int setup_files(struct thread_data *td) * device/file sizes are zero and no size given, punt */ if ((!total_size || total_size == -1ULL) && !td->o.size && - !(td->io_ops->flags & FIO_NOIO)) { + !(td->io_ops->flags & FIO_NOIO) && !td->o.fill_device) { log_err("%s: you need to specify size=\n", td->o.name); td_verror(td, EINVAL, "total_file_size"); return 1; diff --git a/fio.c b/fio.c index e9b27d9c..1c79d682 100644 --- a/fio.c +++ b/fio.c @@ -568,6 +568,10 @@ sync_done: } } + if (td->o.fill_device && td->error == ENOSPC) { + td->error = 0; + td->terminate = 1; + } if (!td->error) { struct fio_file *f; diff --git a/fio.h b/fio.h index b7b25b21..7c39be32 100644 --- a/fio.h +++ b/fio.h @@ -393,6 +393,7 @@ struct thread_options { unsigned int iodepth_batch; unsigned long long size; + unsigned int fill_device; unsigned long long file_size_low; unsigned long long file_size_high; unsigned long long start_offset; diff --git a/init.c b/init.c index 83957cfc..a5036267 100644 --- a/init.c +++ b/init.c @@ -293,6 +293,9 @@ static int fixup_options(struct thread_data *td) o->time_based = 0; } + if (o->fill_device && !o->size) + o->size = ULONG_LONG_MAX; + return 0; } diff --git a/options.c b/options.c index 055fbab7..36f80fce 100644 --- a/options.c +++ b/options.c @@ -534,6 +534,13 @@ static struct fio_option options[] = { .minval = 1, .help = "Total size of device or files", }, + { + .name = "fill_device", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(fill_device), + .help = "Write until an ENOSPC error occurs", + .def = "0", + }, { .name = "filesize", .type = FIO_OPT_STR_VAL, -- 2.25.1