/* * Perform a flush request on a block device, flushing and invalidating all * blocks associated with this device, both in the local cache and in VM. * This operation is called after a block device is closed and must prevent * that stale copies of blocks remain in any cache. */ void lmfs_bflush(dev_t dev) { /* First flush any dirty blocks on this device to disk. */ lmfs_flushdev(dev); /* Then purge any blocks associated with the device. */ lmfs_invalidate(dev); }
/*===========================================================================* * fs_flush * *===========================================================================*/ int fs_flush() { /* Flush the blocks of a device from the cache after writing any dirty blocks * to disk. */ dev_t dev = (dev_t) fs_m_in.REQ_DEV; if(dev == fs_dev) return(EBUSY); lmfs_flushall(); lmfs_invalidate(dev); return(OK); }