[PATCH] Add 'bs_unaligned' option
[fio.git] / init.c
diff --git a/init.c b/init.c
index e4f866a3bc883151372b9b9b3bfd528ee7477775..6ad3c64c4221124d779ae982ac3b96ee12ced5bc 100644 (file)
--- a/init.c
+++ b/init.c
@@ -348,6 +348,11 @@ static struct fio_option options[] = {
                .type   = FIO_OPT_STR_SET,
                .off1   = td_var_offset(norandommap),
        },
                .type   = FIO_OPT_STR_SET,
                .off1   = td_var_offset(norandommap),
        },
+       {
+               .name   = "bs_unaligned",
+               .type   = FIO_OPT_STR_SET,
+               .off1   = td_var_offset(bs_unaligned),
+       },
        {
                .name = NULL,
        },
        {
                .name = NULL,
        },
@@ -490,6 +495,8 @@ static void fixup_options(struct thread_data *td)
                log_err("fio: norandommap given, verify disabled\n");
                td->verify = VERIFY_NONE;
        }
                log_err("fio: norandommap given, verify disabled\n");
                td->verify = VERIFY_NONE;
        }
+       if (td->bs_unaligned && (td->odirect || td->io_ops->flags & FIO_RAWIO))
+               log_err("fio: bs_unaligned may not work with raw io\n");
 }
 
 /*
 }
 
 /*
@@ -535,6 +542,9 @@ 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;
        fixup_options(td);
 
        td->filetype = FIO_TYPE_FILE;
@@ -545,9 +555,6 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                        td->filetype = FIO_TYPE_CHAR;
        }
 
                        td->filetype = FIO_TYPE_CHAR;
        }
 
-       if (td->odirect)
-               td->io_ops->flags |= FIO_RAWIO;
-
        if (td->filename)
                td->nr_uniq_files = 1;
        else
        if (td->filename)
                td->nr_uniq_files = 1;
        else