Block I/O Queues

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 ...

Get FreeBSD Device Drivers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.