Ignore pre-read for FIO_NOIO td
[fio.git] / filesetup.c
index ce19cf0b127d294e6d8d4c012595863552598b30..bd971e8e1f032731ed3f72582c07beb486f34261 100644 (file)
@@ -159,15 +159,18 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
                }
        }
 
-       b = malloc(td->o.max_bs[DDIR_WRITE]);
+       left = f->real_file_size;
+       bs = td->o.max_bs[DDIR_WRITE];
+       if (bs > left)
+               bs = left;
+
+       b = malloc(bs);
        if (!b) {
                td_verror(td, errno, "malloc");
                goto err;
        }
 
-       left = f->real_file_size;
        while (left && !td->terminate) {
-               bs = td->o.max_bs[DDIR_WRITE];
                if (bs > left)
                        bs = left;
 
@@ -232,7 +235,8 @@ static int pre_read_file(struct thread_data *td, struct fio_file *f)
        unsigned int bs;
        char *b;
 
-       if (td_ioengine_flagged(td, FIO_PIPEIO))
+       if (td_ioengine_flagged(td, FIO_PIPEIO) ||
+           td_ioengine_flagged(td, FIO_NOIO))
                return 0;
 
        if (!fio_file_open(f)) {
@@ -245,7 +249,11 @@ static int pre_read_file(struct thread_data *td, struct fio_file *f)
 
        old_runstate = td_bump_runstate(td, TD_PRE_READING);
 
+       left = f->io_size;
        bs = td->o.max_bs[DDIR_READ];
+       if (bs > left)
+               bs = left;
+
        b = malloc(bs);
        if (!b) {
                td_verror(td, errno, "malloc");
@@ -261,8 +269,6 @@ static int pre_read_file(struct thread_data *td, struct fio_file *f)
                goto error;
        }
 
-       left = f->io_size;
-
        while (left && !td->terminate) {
                if (bs > left)
                        bs = left;