1 #include "fs.h" 2 #include "inode.h" 3 #include "clean.h" 4 5 /*===========================================================================* 6 * fs_sync * 7 *===========================================================================*/ 8 void fs_sync(void) 9 { 10 /* Perform the sync() system call. Flush all the tables. 11 * The order in which the various tables are flushed is critical. The 12 * blocks must be flushed last, since rw_inode() leaves its results in 13 * the block cache. 14 */ 15 struct inode *rip; 16 17 /* Write all the dirty inodes to the disk. */ 18 for(rip = &inode[0]; rip < &inode[NR_INODES]; rip++) 19 if(rip->i_count > 0 && IN_ISDIRTY(rip)) rw_inode(rip, WRITING); 20 21 /* Write all the dirty blocks to the disk. */ 22 lmfs_flushall(); 23 } 24