From e0a223354342cc45a916b669343718b80a20c2ea Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 20 Dec 2006 12:54:25 +0100 Subject: [PATCH] [PATCH] Fix character + O_DIRECT Just clear ->odirect if it's a character device, it doesn't apply. Signed-off-by: Jens Axboe --- init.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 -- 2.25.1