b = td->last_pos / td->min_bs;
*offset = (b * td->min_bs) + td->file_offset;
- if (*offset > td->file_size)
+ if (*offset > td->real_file_size)
return 1;
return 0;
return NULL;
}
- if (io_u->buflen + io_u->offset > td->file_size)
- io_u->buflen = td->file_size - io_u->offset;
+ if (io_u->buflen + io_u->offset > td->real_file_size)
+ io_u->buflen = td->real_file_size - io_u->offset;
if (!io_u->buflen) {
put_io_u(td, io_u);
return 1;
}
- if (!td->file_size)
- td->file_size = st.st_size;
+ td->real_file_size = st.st_size;
+
+ if (!td->file_size || td->file_size > td->real_file_size)
+ td->file_size = td->real_file_size;
return 0;
}
return 1;
}
+ td->real_file_size = bytes;
+
/*
* no extend possibilities, so limit size to device size if too large
*/
- if (!td->file_size || td->file_size > bytes)
- td->file_size = bytes;
+ if (!td->file_size || td->file_size > td->real_file_size)
+ td->file_size = td->real_file_size;
return 0;
}
if (ret)
return ret;
- if (td->file_offset > td->file_size) {
- fprintf(stderr, "Client%d: offset larger than length (%Lu > %Lu)\n", td->thread_number, td->file_offset, td->file_size);
+ if (td->file_offset + td->file_size > td->real_file_size) {
+ fprintf(stderr, "Client%d: offset extends end (%Lu > %Lu)\n", td->thread_number, td->file_offset + td->file_size, td->real_file_size);
return 1;
}
- td->io_size = td->file_size - td->file_offset;
+ td->io_size = td->file_size;
if (td->io_size == 0) {
fprintf(stderr, "Client%d: no io blocks\n", td->thread_number);
td_verror(td, EINVAL);
unsigned int create_fsync;
unsigned int loops;
unsigned long long file_size;
+ unsigned long long real_file_size;
unsigned long long file_offset;
unsigned long long zone_size;
unsigned long long zone_skip;