Lines Matching refs:head

77  * current head position (bioq->last_offset) in the scan direction, i.e.
88 * bioq_first() return the head of the queue, without removing;
90 * bioq_takefirst() return and remove the head of the queue,
91 * updating the 'current head position' as
94 * When updating the 'current head position', we assume that the result of
96 * represents the head position once the request is complete.
104 * update, but its use tracks the head position in a better way.
105 * Historical behaviour was also to update the head position when
108 * has no method to update the head position; secondly, once
110 * the actual head position, so the final one is our best guess.
122 * bioq_insert_head() insert an entry at the head, update
128 * bioq_takefirst() if invoked on the head of the queue.
138 * at the head of the queue even after subsequent bioq_disksort().
147 bioq_init(struct bio_queue_head *head)
150 TAILQ_INIT(&head->queue);
151 head->last_offset = 0;
152 head->insert_point = NULL;
156 bioq_remove(struct bio_queue_head *head, struct bio *bp)
159 if (head->insert_point == NULL) {
160 if (bp == TAILQ_FIRST(&head->queue))
161 head->last_offset = bp->bio_offset + bp->bio_length;
162 } else if (bp == head->insert_point)
163 head->insert_point = NULL;
165 TAILQ_REMOVE(&head->queue, bp, bio_queue);
169 bioq_flush(struct bio_queue_head *head, struct devstat *stp, int error)
173 while ((bp = bioq_takefirst(head)) != NULL)
178 bioq_insert_head(struct bio_queue_head *head, struct bio *bp)
181 if (head->insert_point == NULL)
182 head->last_offset = bp->bio_offset;
183 TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue);
187 bioq_insert_tail(struct bio_queue_head *head, struct bio *bp)
190 TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue);
191 head->insert_point = bp;
192 head->last_offset = bp->bio_offset;
196 bioq_first(struct bio_queue_head *head)
199 return (TAILQ_FIRST(&head->queue));
203 bioq_takefirst(struct bio_queue_head *head)
207 bp = TAILQ_FIRST(&head->queue);
209 bioq_remove(head, bp);
219 bioq_bio_key(struct bio_queue_head *head, struct bio *bp)
222 return ((uoff_t)(bp->bio_offset - head->last_offset));
233 bioq_disksort(struct bio_queue_head *head, struct bio *bp)
245 bioq_insert_tail(head, bp);
256 bioq_insert_tail(head, bp);
261 key = bioq_bio_key(head, bp);
262 cur = TAILQ_FIRST(&head->queue);
264 if (head->insert_point) {
265 prev = head->insert_point;
266 cur = TAILQ_NEXT(head->insert_point, bio_queue);
269 while (cur != NULL && key >= bioq_bio_key(head, cur)) {
275 TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue);
277 TAILQ_INSERT_AFTER(&head->queue, prev, bp, bio_queue);