windowsaio: obey sequential/random I/O hinting
[fio.git] / filesetup.c
index 4ceaef6b376716b2ffa0b77aa308e1d741e2c18a..5e8ea357deb82a308d1102f888d895171cfc9e3c 100644 (file)
@@ -110,7 +110,7 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
 {
        int new_layout = 0, unlink_file = 0, flags;
        unsigned long long left;
-       unsigned int bs;
+       unsigned int bs, alloc_size = 0;
        char *b = NULL;
 
        if (read_only) {
@@ -204,7 +204,8 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
        if (bs > left)
                bs = left;
 
-       b = fio_memalign(page_size, bs);
+       alloc_size = bs;
+       b = fio_memalign(page_size, alloc_size);
        if (!b) {
                td_verror(td, errno, "fio_memalign");
                goto err;
@@ -259,14 +260,14 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
                        f->io_size = f->real_file_size;
        }
 
-       fio_memfree(b, bs);
+       fio_memfree(b, alloc_size);
 done:
        return 0;
 err:
        close(f->fd);
        f->fd = -1;
        if (b)
-               fio_memfree(b, bs);
+               fio_memfree(b, alloc_size);
        return 1;
 }
 
@@ -1862,7 +1863,7 @@ void filesetup_mem_free(void)
 int fio_set_directio(struct thread_data *td, struct fio_file *f)
 {
 #ifdef FIO_OS_DIRECTIO
-       int ret = fio_set_odirect(f->fd);
+       int ret = fio_set_odirect(f);
 
        if (ret) {
                td_verror(td, ret, "fio_set_directio");