- struct fio_file *f;
- unsigned int i;
- int err = 0;
-
- dprint(FD_FILE, "open files\n");
-
- for_each_file(td, f, i) {
- err = td_io_open_file(td, f);
- if (err) {
- if (td->error == EMFILE) {
- log_err("fio: limited open files to: %d\n", td->nr_open_files);
- td->o.open_files = td->nr_open_files;
- err = 0;
- clear_error(td);
- }
- break;
- }
-
- if (td->o.open_files == td->nr_open_files)
- break;
- }
-
- if (!err)
- return 0;
-
- for_each_file(td, f, i)
- td_io_close_file(td, f);
-
- return err;