-int syncprt = 0;
-
-/*
- * Update is the internal name of 'sync'. It goes through the disk
- * queues to initiate sandbagged IO; goes through the inodes to write
- * modified nodes; and it goes through the mount table to initiate
- * the writing of the modified super blocks.
- */
-update()
-{
- register struct inode *ip;
- register struct mount *mp;
- struct fs *fs;
-
- if (syncprt)
- bufstats();
- if (updlock)
- return;
- updlock++;
- /*
- * Write back modified superblocks.
- * Consistency check that the superblock
- * of each file system is still in the buffer cache.
- */
- for (mp = &mount[0]; mp < &mount[NMOUNT]; mp++) {
- if (mp->m_fs == NULL || mp->m_fs == (struct fs *)1) /* XXX */
- continue;
- fs = mp->m_fs;
- if (fs->fs_fmod == 0)
- continue;
- if (fs->fs_ronly != 0) { /* XXX */
- printf("fs = %s\n", fs->fs_fsmnt);
- panic("update: rofs mod");
- }
- fs->fs_fmod = 0;
- fs->fs_time = time.tv_sec;
- sbupdate(mp);
- }
- /*
- * Write back each (modified) inode.
- */
- for (ip = inode; ip < inodeNINODE; ip++) {
- if ((ip->i_flag & ILOCKED) != 0 || ip->i_count == 0 ||
- (ip->i_flag & (IMOD|IACC|IUPD|ICHG)) == 0)
- continue;
- ip->i_flag |= ILOCKED;
- ip->i_count++;
- iupdat(ip, &time, &time, 0);
- iput(ip);
- }
- updlock = 0;
- /*
- * Force stale buffer cache information to be flushed,
- * for all devices.
- */
- bflush(NODEV);
-}
-