minix/minix/fs/mfs/misc.c
David van Moolenbroek 4472b590c7 libminixfs: rework prefetch API
This patch changes the prefetch API so that file systems must now
provide a set of block numbers, rather than a set of buffers.  The
result is a leaner and more well-defined API; linear computation of
the range of blocks to prefetch; duplicates no longer interfering
with the prefetch process; guaranteed inclusion of the block needed
next into the prefetch range; and, limits and policy decisions better
established by libminixfs now actually being moved into libminixfs.

Change-Id: I7e44daf2d2d164bc5e2f1473ad717f3ff0f0a77f
2015-08-14 18:39:30 +00:00

25 lines
767 B
C

#include "fs.h"
#include "inode.h"
#include "clean.h"
#include <assert.h>
/*===========================================================================*
* fs_sync *
*===========================================================================*/
void fs_sync(void)
{
/* Perform the sync() system call. Flush all the tables.
* The order in which the various tables are flushed is critical. The
* blocks must be flushed last, since rw_inode() leaves its results in
* the block cache.
*/
struct inode *rip;
/* Write all the dirty inodes to the disk. */
for(rip = &inode[0]; rip < &inode[NR_INODES]; rip++)
if(rip->i_count > 0 && IN_ISDIRTY(rip)) rw_inode(rip, WRITING);
/* Write all the dirty blocks to the disk. */
lmfs_flushall();
}