blktrace: only set O_DIRECT if the min bs is a multiple of 4k
[fio.git] / blktrace.c
index 8ffa9b0e186d49cefa2ad7a21417fe5061079e22..bb0bcbe60ac52e2f7f6c1fda34983f704e94ada0 100644 (file)
@@ -503,9 +503,10 @@ int load_blktrace(struct thread_data *td, const char *filename, int need_swap)
 
        /*
         * We need to do direct/raw ios to the device, to avoid getting
-        * read-ahead in our way.
+        * read-ahead in our way. But only do so if the minimum block size
+        * is a multiple of 4k, otherwise we don't know if it's safe to do so.
         */
-       if (!fio_option_is_set(&td->o, odirect))
+       if (!fio_option_is_set(&td->o, odirect) && !(td_min_bs(td) & 4095))
                td->o.odirect = 1;
 
        /*