Пример #1
0
update()
{
    register struct inode *ip;
    register struct mount *mp;
    register *bp;

    if(updlock)
        return;
    updlock++;
    for(mp = &mount[0]; mp < &mount[NMOUNT]; mp++)
        if(mp->m_bufp != NULL) {
            ip = mp->m_bufp->b_addr;
            if(ip->s_fmod==0 || ip->s_ilock!=0 ||
                    ip->s_flock!=0 || ip->s_ronly!=0)
                continue;
            bp = getblk(mp->m_dev, 1);
            ip->s_fmod = 0;
            ip->s_time[0] = time[0];
            ip->s_time[1] = time[1];
            bcopy(ip, bp->b_addr, 256);
            bwrite(bp);
        }
    for(ip = &inode[0]; ip < &inode[NINODE]; ip++)
        if((ip->i_flag&ILOCK) == 0) {
            ip->i_flag =| ILOCK;
            iupdat(ip, time);
            prele(ip);
        }
    updlock = 0;
    bflush(NODEV);
}
Пример #2
0
smdate()
{
	register struct inode *ip;
	register int *tp;
	int tbuf[2];

	if ((ip = owner()) == NULL)
		return;
	ip->i_flag =| IUPD;
	tp = &tbuf[2];
	*--tp = u.u_ar0[R1];
	*--tp = u.u_ar0[R0];
	iupdat(ip, tp);
	ip->i_flag =& ~IUPD;
	iput(ip);
}
Пример #3
0
/*
 * update is the internal name of
 * 'sync'. It goes through the disk
 * queues to initiate sandbagged I/O;
 * goes through the I nodes to write
 * modified nodes; and it goes through
 * the mount table to initiate modified
 * super blocks.
 */
void update(void) {
	struct inode *ip;
	struct mount *mp;
	struct buf *bp;
	struct filsys *fp;

  if (debugUpdate) {
    printf("-----  update  -----\n");
  }
	if(updlock)
		return;
	updlock++;
	for(mp = &mount[0]; mp < &mount[NMOUNT]; mp++)
		if(mp->m_bufp != NULL) {
			fp = mp->m_bufp->b_un.b_filsys;
			if(fp->s_fmod==0 || fp->s_ilock!=0 ||
			   fp->s_flock!=0 || fp->s_ronly!=0)
				continue;
			bp = getblk(mp->m_dev, SUPERB);
			if (bp->b_flags & B_ERROR)
				continue;
			fp->s_fmod = 0;
			fp->s_time = time;
			bcopy((caddr_t)fp, bp->b_un.b_addr, BSIZE);
			bwrite(bp);
		}
	for(ip = &inode[0]; ip < &inode[NINODE]; ip++)
		if((ip->i_flag&ILOCK)==0 && ip->i_count) {
			ip->i_flag |= ILOCK;
			ip->i_count++;
			iupdat(ip, &time, &time);
			iput(ip);
		}
	updlock = 0;
	bflush(NODEV);
}