-int setup_shared_file(struct thread_data *td)
-{
- struct fio_file *f;
- uint64_t file_size;
- int err = 0;
-
- if (td->o.nr_files > 1) {
- log_err("fio: shared file setup called for multiple files\n");
- return -1;
- }
-
- get_file_sizes(td);
-
- f = td->files[0];
-
- if (f == NULL) {
- log_err("fio: NULL shared file\n");
- return -1;
- }
-
- file_size = thread_number * td->o.size;
- dprint(FD_FILE, "shared setup %s real_file_size=%llu, desired=%llu\n",
- f->file_name, (unsigned long long)f->real_file_size, (unsigned long long)file_size);
-
- if (f->real_file_size < file_size) {
- dprint(FD_FILE, "fio: extending shared file\n");
- f->real_file_size = file_size;
- err = extend_file(td, f);
- if (!err) {
- err = __file_invalidate_cache(td, f, 0, f->real_file_size);
- }
- get_file_sizes(td);
- dprint(FD_FILE, "shared setup new real_file_size=%llu\n",
- (unsigned long long)f->real_file_size);
- }
-
- return err;
-}
-