Lines Matching refs:head

147 bioq_init(struct bio_queue_head *head)  in bioq_init()  argument
150 TAILQ_INIT(&head->queue); in bioq_init()
151 head->last_offset = 0; in bioq_init()
152 head->insert_point = NULL; in bioq_init()
156 bioq_remove(struct bio_queue_head *head, struct bio *bp) in bioq_remove() argument
159 if (head->insert_point == NULL) { in bioq_remove()
160 if (bp == TAILQ_FIRST(&head->queue)) in bioq_remove()
161 head->last_offset = bp->bio_offset + bp->bio_length; in bioq_remove()
162 } else if (bp == head->insert_point) in bioq_remove()
163 head->insert_point = NULL; in bioq_remove()
165 TAILQ_REMOVE(&head->queue, bp, bio_queue); in bioq_remove()
169 bioq_flush(struct bio_queue_head *head, struct devstat *stp, int error) in bioq_flush() argument
173 while ((bp = bioq_takefirst(head)) != NULL) in bioq_flush()
178 bioq_insert_head(struct bio_queue_head *head, struct bio *bp) in bioq_insert_head() argument
181 if (head->insert_point == NULL) in bioq_insert_head()
182 head->last_offset = bp->bio_offset; in bioq_insert_head()
183 TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue); in bioq_insert_head()
187 bioq_insert_tail(struct bio_queue_head *head, struct bio *bp) in bioq_insert_tail() argument
190 TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue); in bioq_insert_tail()
191 head->insert_point = bp; in bioq_insert_tail()
192 head->last_offset = bp->bio_offset; in bioq_insert_tail()
196 bioq_first(struct bio_queue_head *head) in bioq_first() argument
199 return (TAILQ_FIRST(&head->queue)); in bioq_first()
203 bioq_takefirst(struct bio_queue_head *head) in bioq_takefirst() argument
207 bp = TAILQ_FIRST(&head->queue); in bioq_takefirst()
209 bioq_remove(head, bp); in bioq_takefirst()
219 bioq_bio_key(struct bio_queue_head *head, struct bio *bp) in bioq_bio_key() argument
222 return ((uoff_t)(bp->bio_offset - head->last_offset)); in bioq_bio_key()
233 bioq_disksort(struct bio_queue_head *head, struct bio *bp) in bioq_disksort() argument
245 bioq_insert_tail(head, bp); in bioq_disksort()
250 key = bioq_bio_key(head, bp); in bioq_disksort()
251 cur = TAILQ_FIRST(&head->queue); in bioq_disksort()
253 if (head->insert_point) { in bioq_disksort()
254 prev = head->insert_point; in bioq_disksort()
255 cur = TAILQ_NEXT(head->insert_point, bio_queue); in bioq_disksort()
258 while (cur != NULL && key >= bioq_bio_key(head, cur)) { in bioq_disksort()
264 TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue); in bioq_disksort()
266 TAILQ_INSERT_AFTER(&head->queue, prev, bp, bio_queue); in bioq_disksort()