From: Jens Axboe Date: Wed, 20 Dec 2006 11:54:25 +0000 (+0100) Subject: [PATCH] Fix character + O_DIRECT X-Git-Tag: fio-1.10~7 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=e0a223354342cc45a916b669343718b80a20c2ea [PATCH] Fix character + O_DIRECT Just clear ->odirect if it's a character device, it doesn't apply. Signed-off-by: Jens Axboe --- diff --git a/init.c b/init.c index 7d7c9d63..0c888b8f 100644 --- 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