17 Buffer Manipulation

In this chapter we look at the file “bio.c” in detail. It contains most of the basic routines used to manipulate buffer headers and buffers (4535, 4720).

Individual buffer headers are tagged by a device number “b_dev”, (4527) and a block number “b_blkno”, (4531). (Note the way in which the latter is declared as an unsigned integer.)

Buffer headers may be linked simultaneously into two lists:

the “b”-lists

are lists, one per device controller, which link together buffers associated with that device type;

the “av”-list

is a list of buffers which may be detached from their current use and converted to an alternate use.

Both the “av”-list and the various “b”-lists are doubly linked to facilitate insertion and deletion at any point.