Streamline thread_data data direction setting and checking
Currently it's a mess of ->ddir, ->iomix and ->sequential. Add
a TD_DDIR_* for each of these, so we can store them as one value.
A prerequisite for the next parsing cleanup.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/filesetup.c b/filesetup.c
index 11138b7..356580e 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -113,8 +113,7 @@
for_each_file(td, f, i) {
int file_there = !file_ok(td, f);
- if (file_there && td->ddir == DDIR_WRITE &&
- !td->overwrite) {
+ if (file_there && td_write(td) && !td->overwrite) {
unlink(f->file_name);
file_there = 0;
}
@@ -279,7 +278,7 @@
if (td->invalidate_cache && file_invalidate_cache(td, f))
return 1;
- if (td->sequential) {
+ if (!td_random(td)) {
if (madvise(f->mmap, f->file_size, MADV_SEQUENTIAL) < 0) {
td_verror(td, errno, "madvise");
return 1;
@@ -313,7 +312,7 @@
if (td->invalidate_cache && file_invalidate_cache(td, f))
return 1;
- if (td->sequential) {
+ if (!td_random(td)) {
if (fadvise(f->fd, f->file_offset, f->file_size, POSIX_FADV_SEQUENTIAL) < 0) {
td_verror(td, errno, "fadvise");
return 1;