3 #include <minix/vfsif.h>
8 /*===========================================================================*
10 *===========================================================================*/
13 /* Perform the sync() system call. Flush all the tables.
14 * The order in which the various tables are flushed is critical. The
15 * blocks must be flushed last, since rw_inode() leaves its results in
21 /* Write all the dirty inodes to the disk. */
22 for(rip
= &inode
[0]; rip
< &inode
[NR_INODES
]; rip
++)
23 if(rip
->i_count
> 0 && rip
->i_dirt
== DIRTY
) rw_inode(rip
, WRITING
);
25 /* Write all the dirty blocks to the disk, one drive at a time. */
26 for(bp
= &buf
[0]; bp
< &buf
[NR_BUFS
]; bp
++)
27 if(bp
->b_dev
!= NO_DEV
&& bp
->b_dirt
== DIRTY
)
30 return(OK
); /* sync() can't fail */
34 /*===========================================================================*
36 *===========================================================================*/
39 /* Flush the blocks of a device from the cache after writing any dirty blocks
44 dev
= fs_m_in
.REQ_DEV
;
45 if(dev
== fs_dev
) return(EBUSY
);