FreeBSD/sys/geom/sched/gs_rr.c
/*
 * Called when a real request for disk I/O arrives.
 * Locate the queue associated with the client.
 * If the queue is the one we are anticipating for, reset its timeout;
 * if the queue is not in the round robin list, insert it in the list.
 * On any error, do not queue the request and return -1, the caller
 * will take care of this request.
 */
Called when a real request for disk I/O arrives.
Locate the queue associated with the client.
If the queue is the one we are anticipating for, reset its timeout;
if the queue is not in the round robin list, insert it in the list.
On any error, do not queue the request and return -1, the caller
will take care of this request.
Called when a real request for disk I / O arrives . Locate the queue associated with the client . If the queue is the one we are anticipating for reset its timeout ; if the queue is not in the round robin list insert it in the list . On any error do not queue the request and return - 1 the caller will take care of this request .
static int
g_rr_start(void *data, struct bio *bp)
{
	struct g_rr_softc *sc = data;
	struct g_rr_queue *qp;
	if (me.bypass)
		return (-1);	
	qp = g_rr_queue_get(sc, bp);
	if (qp == NULL)
		return (-1); 
	if (bioq_first(&qp->q_bioq) == NULL) {
		if (qp == sc->sc_active) {
			qp->q_status = G_QUEUE_READY;
			callout_stop(&sc->sc_wait);
		} else {
			g_sched_priv_ref(qp);
			TAILQ_INSERT_TAIL(&sc->sc_rr_tailq, qp, q_tailq);
		}
	}
	qp->q_bionum = 1 + qp->q_bionum - (qp->q_bionum >> 3);
	g_rr_update_thinktime(qp);
	g_rr_update_seekdist(qp, bp);
	bp->bio_caller1 = qp;
	bioq_disksort(&qp->q_bioq, bp);
	return (0);
}
static int g_rr_start ( void * data , struct bio * bp ) { struct g_rr_softc * sc = data ; struct g_rr_queue * qp ; if ( me . bypass ) return ( -1 ) ; qp = g_rr_queue_get ( sc , bp ) ; if ( qp == NULL ) return ( -1 ) ; if ( bioq_first ( & qp -> q_bioq ) == NULL ) { if ( qp == sc -> sc_active ) { qp -> q_status = G_QUEUE_READY ; callout_stop ( & sc -> sc_wait ) ; } else { g_sched_priv_ref ( qp ) ; TAILQ_INSERT_TAIL ( & sc -> sc_rr_tailq , qp , q_tailq ) ; } } qp -> q_bionum = 1 + qp -> q_bionum - ( qp -> q_bionum >> 3 ) ; g_rr_update_thinktime ( qp ) ; g_rr_update_seekdist ( qp , bp ) ; bp -> bio_caller1 = qp ; bioq_disksort ( & qp -> q_bioq , bp ) ; return ( 0 ) ; }
Called when a real request for disk I/O arrives.
Called when a real request for disk I / O arrives .
/* bypass the scheduler */ /* Get the queue for the request. */ /* allocation failed, tell upstream */ /*
		 * We are inserting into an empty queue.
		 * Reset its state if it is sc_active,
		 * otherwise insert it in the RR list.
		 */ /* Inherit the reference returned by g_rr_queue_get(). */