X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=filesetup.c;h=3594a80faf3bfe8300e29fc7cc04f7c892e826f8;hp=9acce64a45fc91eecbce536b89c7dc015dc3a713;hb=c90e1017b9384b170d47b97d2353f7bff3b5a34d;hpb=214ac7e009897f8f82ab9e21aff9bc86d33bb470 diff --git a/filesetup.c b/filesetup.c index 9acce64a..3594a80f 100644 --- a/filesetup.c +++ b/filesetup.c @@ -526,6 +526,11 @@ open_again: snprintf(buf, sizeof(buf) - 1, "open(%s)", f->file_name); + if (__e == EINVAL && (flags & OS_O_DIRECT)) { + log_err("fio: looks like your file system does not " \ + "support direct=1/buffered=0\n"); + } + td_verror(td, __e, buf); } @@ -652,6 +657,12 @@ static unsigned long long get_fs_free_counts(struct thread_data *td) return ret; } +unsigned long long get_start_offset(struct thread_data *td) +{ + return td->o.start_offset + + (td->thread_number - 1) * td->o.offset_increment; +} + /* * Open the files and setup files sizes, creating files if necessary. */ @@ -665,7 +676,7 @@ int setup_files(struct thread_data *td) dprint(FD_FILE, "setup files\n"); if (td->o.read_iolog_file) - return 0; + goto done; /* * if ioengine defines a setup() method, it's responsible for @@ -713,8 +724,7 @@ int setup_files(struct thread_data *td) extend_size = total_size = 0; need_extend = 0; for_each_file(td, f, i) { - f->file_offset = td->o.start_offset + - td->thread_number * td->o.offset_increment; + f->file_offset = get_start_offset(td); if (!td->o.file_size_low) { /* @@ -816,6 +826,11 @@ int setup_files(struct thread_data *td) */ if (!td->o.read_iolog_file) td->total_io_size = td->o.size * td->o.loops; + +done: + if (td->o.create_only) + td->done = 1; + return 0; err_offset: log_err("%s: you need to specify valid offset=\n", td->o.name); @@ -969,6 +984,7 @@ int add_file(struct thread_data *td, const char *fname) td->files_size = new_size; } td->files[cur_files] = f; + f->fileno = cur_files; /* * init function, io engine may not be loaded yet @@ -995,7 +1011,7 @@ int add_file(struct thread_data *td, const char *fname) f->lock = fio_mutex_rw_init(); break; case FILE_LOCK_EXCLUSIVE: - f->lock = fio_mutex_init(1); + f->lock = fio_mutex_init(FIO_MUTEX_UNLOCKED); break; default: log_err("fio: unknown lock mode: %d\n", td->o.file_lock_mode);