[PATCH] Fix character + O_DIRECT
authorJens Axboe <jens.axboe@oracle.com>
Wed, 20 Dec 2006 11:54:25 +0000 (12:54 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 20 Dec 2006 11:54:25 +0000 (12:54 +0100)
Just clear ->odirect if it's a character device, it doesn't apply.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
init.c

diff --git a/init.c b/init.c
index 7d7c9d63f40b3c5e54d1408accda38c328e24d72..0c888b8fcdca83a0bdc7691d2eb38202393ebcbb 100644 (file)
--- a/init.c
+++ b/init.c
@@ -508,6 +508,12 @@ static void fixup_options(struct thread_data *td)
        }
        if (td->bs_unaligned && (td->odirect || td->io_ops->flags & FIO_RAWIO))
                log_err("fio: bs_unaligned may not work with raw io\n");
+
+       /*
+        * O_DIRECT and char doesn't mix, clear that flag if necessary.
+        */
+       if (td->filetype == FIO_TYPE_CHAR && td->odirect)
+               td->odirect = 0;
 }
 
 /*
@@ -564,8 +570,6 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
        if (td->odirect)
                td->io_ops->flags |= FIO_RAWIO;
 
-       fixup_options(td);
-
        td->filetype = FIO_TYPE_FILE;
        if (!stat(jobname, &sb)) {
                if (S_ISBLK(sb.st_mode))
@@ -574,6 +578,8 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                        td->filetype = FIO_TYPE_CHAR;
        }
 
+       fixup_options(td);
+
        if (td->filename)
                td->nr_uniq_files = 1;
        else