Reads the specified block data into a buffer.
Item | Description |
---|---|
dev | Specifies the device containing the block to be read. |
blkno | Specifies the block to be read. |
The bread kernel service assigns a buffer to the given block. If the specified block is already in the buffer cache, then the block buffer header is returned. Otherwise, a free buffer is assigned to the specified block and the data is read into the buffer. The bread service waits for I/O to complete to return the buffer header.
The buffer is allocated to the caller and marked as busy.
The bread kernel service can be called from the process environment only.
The bread service returns the address of the selected buffer's header. A nonzero value for B_ERROR in the b_flags field of the buffer's header (buf structure) indicates an error. If this occurs, the caller should release the buffer associated with the block using the brelse kernel service.
On a platform that supports storage keys, the buffer header is allocated from the storage protected by the KKEY_BLOCK_DEV kernel key.