Пример #1
0
/*
 * sync everything.  Start out by waking pdflush, because that writes back
 * all queues in parallel.
 */
static void do_sync(unsigned long wait)
{
	wakeup_pdflush(0);
	sync_inodes(0);		/* All mappings, inodes and their blockdevs */
	DQUOT_SYNC(NULL);
	sync_supers();		/* Write the superblocks */
	sync_filesystems(0);	/* Start syncing the filesystems */
	sync_filesystems(wait);	/* Waitingly sync the filesystems */
	sync_inodes(wait);	/* Mappings, inodes and blockdevs, again. */
	if (!wait)
		printk("Emergency Sync complete\n");
	if (unlikely(laptop_mode))
		laptop_sync_completion();
}
Пример #2
0
//// 对指定设备进行高速缓冲数据与设备上数据的同步操作。
int
sync_dev( int dev )
{
	int					i;
	struct buffer_head	*bh;

	bh = start_buffer;
	for( i = 0; i < NR_BUFFERS; i++, bh++ )
	{
		if( bh->b_dev != dev )
		{
			continue;
		}
		wait_on_buffer( bh );
		if( bh->b_dev == dev && bh->b_dirt )
		{
			ll_rw_block( WRITE, bh );
		}
	}
	sync_inodes( ); // 将i 节点数据写入高速缓冲。
	bh = start_buffer;
	for( i = 0; i < NR_BUFFERS; i++, bh++ )
	{
		if( bh->b_dev != dev )
		{
			continue;
		}
		wait_on_buffer( bh );
		if( bh->b_dev == dev && bh->b_dirt )
		{
			ll_rw_block( WRITE, bh );
		}
	}
	return 0;
}
Пример #3
0
int sync_dev(int dev)
{
	sync_buffers(dev);
	sync_inodes();
	sync_buffers(dev);
	return 0;
}
Пример #4
0
void sync_dev(kdev_t dev)
{
    sync_buffers(dev, 0);
    sync_supers(dev);
    sync_inodes(dev);
    sync_buffers(dev, 0);
}
Пример #5
0
int fsync_dev(dev_t dev)
{
	sync_buffers(dev, 0);
	sync_supers(dev);
	sync_inodes(dev);
	return sync_buffers(dev, 1);
}
Пример #6
0
/*
 * struct fs32_flushbuf_parms {
 *     unsigned short flag;
 *     unsigned short hVPB;
 * };
 */
int FS32ENTRY fs32_flushbuf(struct fs32_flushbuf_parms *parms)
{
    int rc;
    struct super_block *sb;


    if (trace_FS_FLUSHBUF)
    {
        kernel_printf("FS_FLUSHBUF - flag = %d, hVPB = 0x%0X", (int)(parms->flag), (int)(parms->hVPB));
    }

    if (Read_Write)
    {
        sb = getvolume(parms->hVPB);

        if ((sb) && (sb->s_magic_internal == SUPER_MAGIC))
        {
            if (sb->s_status == VOL_STATUS_MOUNTED)
            {
                kernel_printf("\tmedia is present");
                switch (parms->flag)
                {
                    case FLUSH_RETAIN:
                    case FLUSH_DISCARD:
                        sync_buffers(sb->s_dev, 1);
                        if ((sb->s_op) && (sb->s_op->write_super))
                            sb->s_op->write_super(sb);
                        sync_inodes(sb->s_dev);
                        sync_buffers(sb->s_dev, 1);
                        rc = NO_ERROR;
                        break;


                    default:
                        rc = ERROR_INVALID_PARAMETER;
                        break;
                }
            }
            else
            {
                rc = NO_ERROR;
            }
        }
        else
        {
            rc = ERROR_INVALID_PARAMETER;
        }
    }
    else
    {
        rc = NO_ERROR;
    }

    if (trace_FS_FLUSHBUF)
    {
        kernel_printf("FS_FLUSHBUF - flag = %d, hVPB = 0x%0X, rc = %d", (int)(parms->flag), (int)(parms->hVPB), rc);
    }

    return rc;
}
Пример #7
0
int sync_dev(int dev)
{
	struct super_block * sb;

	if (sb = get_super (dev))
		if (sb->s_op && sb->s_op->write_super && sb->s_dirt)
			sb->s_op->write_super (sb);
	sync_buffers(dev);
	sync_inodes();
	sync_buffers(dev);
	return 0;
}
Пример #8
0
int sys_sync(void)
{
	int i;
	struct buffer_head * bh;

	sync_inodes();		/* write out inodes into buffers */
	bh = start_buffer;
	for (i=0 ; i<NR_BUFFERS ; i++,bh++) {
		wait_on_buffer(bh);
		if (bh->b_dirt)
			ll_rw_block(WRITE,bh);
	}
	return 0;
}
Пример #9
0
int sys_sync(void)
{
	int i;

	for (i=0 ; i<NR_SUPER ; i++)
		if (super_block[i].s_dev
		    && super_block[i].s_op 
		    && super_block[i].s_op->write_super 
		    && super_block[i].s_dirt)
			super_block[i].s_op->write_super(&super_block[i]);
	sync_inodes();		/* write out inodes into buffers */
	sync_buffers(0);
	return 0;
}
Пример #10
0
//// 系统调用。同步设备和内存高速缓冲中数据。
int sys_sync(void)//passed
{
	int i;
	struct buffer_head * bh;

	sync_inodes();		/* 将i 节点写入高速缓冲 */
// 扫描所有高速缓冲区,对于已被修改的缓冲块产生写盘请求,将缓冲中数据与设备中同步。
	bh = start_buffer;
	for (i=0 ; i<NR_BUFFERS ; i++,bh++) {
		wait_on_buffer(bh);		// 等待缓冲区解锁(如果已上锁的话)。
		if (bh->b_dirt)
			ll_rw_block(WRITE,bh);	// 产生写设备块请求。
	}
	return 0;
}
Пример #11
0
//同步设备和内存高速缓冲中的数据, sync_inodes()定义在inode.c中
int sys_sync(void)
{
	int i;
	struct buffer_head * bh;
	
	//首先调用i节点同步函数,把内存i节点表中所有修改过的i节点写入高速缓冲中。然后扫描所有高速
	//缓冲区,对已被修改的缓冲块产生写盘请求,将缓冲中数据写入盘中,做到高速缓冲中的数据与设备
	//中的同步。
	sync_inodes();		/* write out inodes into buffers */
	bh = start_buffer;
	for (i=0 ; i<NR_BUFFERS ; i++,bh++) {
		wait_on_buffer(bh);
		if (bh->b_dirt)
			ll_rw_block(WRITE,bh);
	}
	return 0;
}
Пример #12
0
int sys_sync(void)
{
	sync_inodes();		/* write out inodes into buffers */
	sync_buffers(0);
	return 0;
}