Add fill_device option
authorShawn Lewis <shawnlewis@google.com>
Fri, 11 Jan 2008 08:45:11 +0000 (09:45 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 11 Jan 2008 08:45:11 +0000 (09:45 +0100)
Add fill_device option. Causes fio to write until ENOSPC occurs (assuming
rw=write).

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
HOWTO
filesetup.c
fio.c
fio.h
init.c
options.c

diff --git a/HOWTO b/HOWTO
index 569b998f215b78d41a36ac71d78f1506a013af4e..7b717f7739664f44393d67b7b6521e8ca0404eae 100644 (file)
--- 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
index a7dff0fc5bed83fc5e6506f1402adc7598abf42f..210cd2ff7ed437a1f19414a82e20600486cdfbc5 100644 (file)
@@ -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 e9b27d9ccef7405583065434f60f858c09f02cea..1c79d6823ae95079f0b445ceac9ed7507bb9be3b 100644 (file)
--- 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 b7b25b21f37c8b81dc6e152d15955a74297f7980..7c39be323f2a193c0b460213059f9545838047eb 100644 (file)
--- 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 83957cfc10e09eb76e1206f6ba1d705b5a0e043a..a50362674e21902b30cd1519146e29c59a6ba48b 100644 (file)
--- 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;
 }
 
index 055fbab7a14180a91062635a4176a9603b0fd8d2..36f80fce61a7f6fe24dda2c474580bc3b74bb4bf 100644 (file)
--- 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,