BRELSE(K) UNIX System V BRELSE(K)
Name
brelse - releases a block buffer
Syntax
int
brelse(bp)
struct buf *bp;
Description
The brelse routine releases a block buffer to the free pool
of buffers. This routine is called by a block device driver
to release a buffer. The contents of the buffer are lost and
the driver is not allowed to make any further reference to
the buffer. This routine is called by iodone(K) at the
completion of a block I/O request.
When the routine is first called, bp->b_flags is checked for
an error (B_ERROR is set). If it is, the following occurs:
+ The B_STALE flag is set in bp->b_flags.
+ The B_ERROR and B_DELWRI flags are removed from
bp->b_flags.
+ The bp->b_error field is set to zero.
All processes asssociated with bp that are sleeping waiting
for a buffer header or a free buffer are awakened. On
completion of brelse, b_proc is set to zero to release the
process's ownership of the buffer.
Parameters
The bp argument is a pointer to the buffer header relating
to the buffer to be released.
Return Value
The buffer addressed by bp is returned to the free buffer
pool. No errors are possible.
Notes
Note that this routine can only be called from block device
drivers.
(printed 7/6/89)