- if (!get_next_offset(td, f, &io_u->offset, io_u->ddir)) {
- io_u->buflen = get_next_buflen(td, io_u->ddir);
- if (io_u->buflen) {
+ io_u->buflen = get_next_buflen(td, io_u->ddir);
+ if (io_u->buflen) {
+ if (!get_next_offset(td, f, io_u)) {
+ /*
+ * mark entry before potentially trimming io_u
+ */
+ if (!td->read_iolog && !td->sequential &&
+ !td->norandommap)
+ mark_random_map(td, f, io_u);
+