Flushes the specified block if it is in the buffer cache.
#include <sys/types.h> #include <sys/errno.h> #include <sys/buf.h>
int blkflush (dev, blkno) dev_t dev; daddr_t blkno;
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.
The blkflush kernel service is part of Base Operating System (BOS) Runtime.
The bwrite kernel service.
Block I/O Buffer Cache Kernel Services: Overview I/O Kernel Services in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.