Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / fs / ext2 / misc.c
blob4f79cf931ef82df23456c477e7d14a517849d37d
1 /* Created (MFS based):
2 * February 2010 (Evgeniy Ivanov)
3 */
5 #include "fs.h"
6 #include "inode.h"
7 #include "super.h"
8 #include <assert.h>
10 /*===========================================================================*
11 * fs_sync *
12 *===========================================================================*/
13 void fs_sync(void)
15 /* Perform the sync() system call. Flush all the tables.
16 * The order in which the various tables are flushed is critical. The
17 * blocks must be flushed last, since rw_inode() leaves its results in
18 * the block cache.
20 struct inode *rip;
22 if (superblock->s_rd_only)
23 return; /* nothing to sync */
25 /* Write all the dirty inodes to the disk. */
26 for(rip = &inode[0]; rip < &inode[NR_INODES]; rip++)
27 if(rip->i_count > 0 && rip->i_dirt == IN_DIRTY) rw_inode(rip, WRITING);
29 lmfs_flushall();
31 if (superblock->s_dev != NO_DEV) {
32 superblock->s_wtime = clock_time(NULL);
33 write_super(superblock);