Lines Matching defs:head

84  * current head position (bioq->last_offset) in the scan direction, i.e.
95 * bioq_first() return the head of the queue, without removing;
97 * bioq_takefirst() return and remove the head of the queue,
98 * updating the 'current head position' as
101 * When updating the 'current head position', we assume that the result of
103 * represents the head position once the request is complete.
111 * update, but its use tracks the head position in a better way.
112 * Historical behaviour was also to update the head position when
115 * has no method to update the head position; secondly, once
117 * the actual head position, so the final one is our best guess.
129 * bioq_insert_head() insert an entry at the head, update
135 * bioq_takefirst() if invoked on the head of the queue.
145 * at the head of the queue even after subsequent bioq_disksort().
154 bioq_init(struct bio_queue_head *head)
157 TAILQ_INIT(&head->queue);
158 head->last_offset = 0;
159 head->insert_point = NULL;
160 head->total = 0;
161 head->batched = 0;
165 bioq_remove(struct bio_queue_head *head, struct bio *bp)
168 if (head->insert_point == NULL) {
169 if (bp == TAILQ_FIRST(&head->queue))
170 head->last_offset = bp->bio_offset + bp->bio_length;
171 } else if (bp == head->insert_point)
172 head->insert_point = NULL;
174 TAILQ_REMOVE(&head->queue, bp, bio_queue);
175 if (TAILQ_EMPTY(&head->queue))
176 head->batched = 0;
177 head->total--;
181 bioq_flush(struct bio_queue_head *head, struct devstat *stp, int error)
185 while ((bp = bioq_takefirst(head)) != NULL)
190 bioq_insert_head(struct bio_queue_head *head, struct bio *bp)
193 if (head->insert_point == NULL)
194 head->last_offset = bp->bio_offset;
195 TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue);
196 head->total++;
197 head->batched = 0;
201 bioq_insert_tail(struct bio_queue_head *head, struct bio *bp)
204 TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue);
205 head->total++;
206 head->batched = 0;
207 head->insert_point = bp;
208 head->last_offset = bp->bio_offset;
212 bioq_first(struct bio_queue_head *head)
215 return (TAILQ_FIRST(&head->queue));
219 bioq_takefirst(struct bio_queue_head *head)
223 bp = TAILQ_FIRST(&head->queue);
225 bioq_remove(head, bp);
235 bioq_bio_key(struct bio_queue_head *head, struct bio *bp)
238 return ((uoff_t)(bp->bio_offset - head->last_offset));
249 bioq_disksort(struct bio_queue_head *head, struct bio *bp)
261 bioq_insert_tail(head, bp);
272 bioq_insert_tail(head, bp);
276 if (bioq_batchsize > 0 && head->batched > bioq_batchsize) {
277 bioq_insert_tail(head, bp);
282 key = bioq_bio_key(head, bp);
283 cur = TAILQ_FIRST(&head->queue);
285 if (head->insert_point) {
286 prev = head->insert_point;
287 cur = TAILQ_NEXT(head->insert_point, bio_queue);
290 while (cur != NULL && key >= bioq_bio_key(head, cur)) {
296 TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue);
298 TAILQ_INSERT_AFTER(&head->queue, prev, bp, bio_queue);
299 head->total++;
300 head->batched++;