The Linux Kernel/bread
struct buffer_head * __bread(struct block_device * bdev, sector_t block, unsigned size);
- bdev: the block device to read from
- block: the block number of the first block to be read
- size: the number of bytes to read.
Reads the specified block(s) and returns a buffer head to the data just read. On error, NULL will be returned.
The function obtains the buffer head by a call to the function __getblk(bdev,block,size) FIXME: Implications?. It then checks whether the data pointed to by the returned buffer head is up to date by a call to buffer_uptodate. If not, a call to __bread_slow(bh returned by __getblk) will bring the data up to date and return the bh on success. This call will suspend the calling thread putting it into the task state TASK_UNINTERRUPTIBLE.
The buffer head to the data, which was just read or already cached, or NULL on any error (i.e. I/O error).