[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Kernel and Subsystems, Volume 1

blkflush Kernel Service

Purpose

Flushes the specified block if it is in the buffer cache.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/buf.h>


int blkflush ( dev, blkno)
dev_t dev;
daddr_t blkno;

Parameters

dev Specifies the device containing the block to be flushed.
blkno Specifies the block to be flushed.

Description

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.

Execution Environment

The blkflush kernel service can be called from the process environment only.

Return Values

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.

Related Information

The bwrite kernel service.

Block I/O Buffer Cache Kernel Services: Overview I/O Kernel Services in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]