Flushes the specified block if it is in the buffer cache.
Item | Description |
---|---|
dev | Specifies the device containing the block to be flushed. |
blkno | Specifies the block to be flushed. |
The blkflush kernel service checks to see if the specified buffer is in the buffer cache. If the buffer is not in the cache, then the blkflush service returns a value of 0. If the buffer is in the cache, but is busy, the blkflush service calls the e_sleep service to wait until the buffer is no longer in use. Upon waking, the blkflush service tries again to access the buffer.
If the buffer is in the cache and is not busy, but is dirty, then it is removed from the free list. The buffer is then marked as busy and synchronously written to the device. If the buffer is in the cache and is neither busy nor dirty (that is, the buffer is already clean and therefore does not need to be flushed), the blkflush service returns a value of 0.
The blkflush kernel service can be called from the process environment only.
Item | Description |
---|---|
1 | Indicates that the block was successfully flushed. |
0 | Indicates that the block was not flushed. The specified buffer is either not in the buffer cache or is in the buffer cache but neither busy nor dirty. |