Add fill_device option
Add fill_device option. Causes fio to write until ENOSPC occurs (assuming
rw=write).
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/HOWTO b/HOWTO
index 569b998..7b717f7 100644
--- a/HOWTO
+++ b/HOWTO
@@ -262,6 +262,10 @@
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 a7dff0f..210cd2f 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -380,7 +380,7 @@
* 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 e9b27d9..1c79d68 100644
--- a/fio.c
+++ b/fio.c
@@ -568,6 +568,10 @@
}
}
+ 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 b7b25b2..7c39be3 100644
--- a/fio.h
+++ b/fio.h
@@ -393,6 +393,7 @@
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 83957cf..a503626 100644
--- a/init.c
+++ b/init.c
@@ -293,6 +293,9 @@
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 055fbab..36f80fc 100644
--- a/options.c
+++ b/options.c
@@ -535,6 +535,13 @@
.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,
.off1 = td_var_offset(file_size_low),