+ /*
+ * If we lie after the first (currently active)
+ * request, then we must locate the second request list
+ * and add ourselves to it.
+ */
+ if (bp->b_cylin < ap->b_cylin) {
+ while (ap->av_forw) {
+ /*
+ * Check for an ``inversion'' in the
+ * normally ascending cylinder numbers,
+ * indicating the start of the second request list.
+ */
+ if (ap->av_forw->b_cylin < ap->b_cylin) {
+ /*
+ * Search the second request list
+ * for the first request at a larger
+ * cylinder number. We go before that;
+ * if there is no such request, we go at end.
+ */
+ do {
+ if (bp->b_cylin < ap->av_forw->b_cylin)
+ goto insert;
+ ap = ap->av_forw;
+ } while (ap->av_forw);
+ goto insert; /* after last */
+ }
+ ap = ap->av_forw;