unsigned long long max_blocks = f->file_size / td->min_bs[ddir];
int loops = 5;
+ if (!max_blocks)
+ return 1;
+
do {
r = os_random_long(&td->random_state);
b = ((max_blocks - 1) * r / (unsigned long long) (RAND_MAX+1.0));
* probably not the right place to do this, but see
* if we need to open a new file
*/
- if (td->nr_open_files < td->nr_files &&
+ if (td->nr_open_files < td->open_files &&
td->open_files != td->nr_files) {
f = find_next_new_file(td);
if (!f || (ret = td_io_open_file(td, f))) {
put_io_u(td, io_u);
- break;
+ return NULL;
}
goto set_file;
}