April 2012
Intermediate to advanced
352 pages
8h
English
All storage drivers maintain a block I/O queue to house any pending block-centric I/O requests. Generally speaking, these requests are stored in increasing or decreasing device-offset order so that when they are processed, the disk head will move in a single direction (instead of bouncing around) to maximize performance.
The FreeBSD kernel provides the following functions for working with block I/O queues:
#include <sys/bio.h> void bioq_init(struct bio_queue_head *head); void bioq_disksort(struct bio_queue_head *head, struct bio *bp); struct bio * bioq_first(struct bio_queue_head *head); struct bio * bioq_takefirst(struct bio_queue_head *head); void bioq_insert_head(struct bio_queue_head *head, struct bio *bp); void bioq_insert_tail(struct ...