4 #include <minix/vfsif.h>
10 /*===========================================================================*
12 *===========================================================================*/
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
20 register struct inode
*rip
;
21 register struct buf
*bp
;
23 /* Write all the dirty inodes to the disk. */
24 for (rip
= &inode
[0]; rip
< &inode
[NR_INODES
]; rip
++)
25 if (rip
->i_count
> 0 && rip
->i_dirt
== DIRTY
) rw_inode(rip
, WRITING
);
27 /* Write all the dirty blocks to the disk, one drive at a time. */
28 for (bp
= &buf
[0]; bp
< &buf
[NR_BUFS
]; bp
++)
29 if (bp
->b_dev
!= NO_DEV
&& bp
->b_dirt
== DIRTY
)
32 return(OK
); /* sync() can't fail */
36 /*===========================================================================*
38 *===========================================================================*/
41 /* Flush the blocks of a device from the cache after writing any dirty blocks