+ this_events++;
+ }
+#else
+ io_u_qiter(&td->io_u_all, io_u, i) {
+ if (!(io_u->flags & IO_U_F_FLIGHT))
+ continue;
+ if (rbd_io_u_seen(io_u))
+ continue;
+
+ if (fri_check_complete(rbd, io_u, events))
+ this_events++;
+ else if (wait)
+ rbd->sort_events[sidx++] = io_u;
+ }
+#endif
+
+ if (!wait || !sidx)
+ return this_events;
+
+ /*
+ * Sort events, oldest issue first, then wait on as many as we
+ * need in order of age. If we have enough events, stop waiting,
+ * and just check if any of the older ones are done.
+ */
+ if (sidx > 1)
+ qsort(rbd->sort_events, sidx, sizeof(struct io_u *), rbd_io_u_cmp);
+
+ for (i = 0; i < sidx; i++) {
+ io_u = rbd->sort_events[i];
+
+ if (fri_check_complete(rbd, io_u, events)) {
+ this_events++;
+ continue;