Lines Matching defs:head

36  * current head position (bioq->last_offset) in the scan direction, i.e.
47 * bioq_first() return the head of the queue, without removing;
49 * bioq_takefirst() return and remove the head of the queue,
50 * updating the 'current head position' as
53 * When updating the 'current head position', we assume that the result of
55 * represents the head position once the request is complete.
63 * update, but its use tracks the head position in a better way.
64 * Historical behaviour was also to update the head position when
67 * has no method to update the head position; secondly, once
69 * the actual head position, so the final one is our best guess.
81 * bioq_insert_head() insert an entry at the head, update
87 * bioq_takefirst() if invoked on the head of the queue.
97 * at the head of the queue even after subsequent bioq_disksort().
106 gs_bioq_init(struct bio_queue_head *head)
109 TAILQ_INIT(&head->queue);
110 head->last_offset = 0;
111 head->insert_point = NULL;
115 gs_bioq_remove(struct bio_queue_head *head, struct bio *bp)
118 if (head->insert_point == NULL) {
119 if (bp == TAILQ_FIRST(&head->queue))
120 head->last_offset = bp->bio_offset + bp->bio_length;
121 } else if (bp == head->insert_point)
122 head->insert_point = NULL;
124 TAILQ_REMOVE(&head->queue, bp, bio_queue);
128 gs_bioq_flush(struct bio_queue_head *head, struct devstat *stp, int error)
132 while ((bp = gs_bioq_takefirst(head)) != NULL)
137 gs_bioq_insert_head(struct bio_queue_head *head, struct bio *bp)
140 if (head->insert_point == NULL)
141 head->last_offset = bp->bio_offset;
142 TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue);
146 gs_bioq_insert_tail(struct bio_queue_head *head, struct bio *bp)
149 TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue);
150 head->insert_point = bp;
151 head->last_offset = bp->bio_offset;
155 gs_bioq_first(struct bio_queue_head *head)
158 return (TAILQ_FIRST(&head->queue));
162 gs_bioq_takefirst(struct bio_queue_head *head)
166 bp = TAILQ_FIRST(&head->queue);
168 gs_bioq_remove(head, bp);
178 gs_bioq_bio_key(struct bio_queue_head *head, struct bio *bp)
181 return ((uoff_t)(bp->bio_offset - head->last_offset));
192 gs_bioq_disksort(struct bio_queue_head *head, struct bio *bp)
204 gs_bioq_insert_tail(head, bp);
209 key = gs_bioq_bio_key(head, bp);
210 cur = TAILQ_FIRST(&head->queue);
212 if (head->insert_point) {
213 prev = head->insert_point;
214 cur = TAILQ_NEXT(head->insert_point, bio_queue);
217 while (cur != NULL && key >= gs_bioq_bio_key(head, cur)) {
223 TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue);
225 TAILQ_INSERT_AFTER(&head->queue, prev, bp, bio_queue);