--- zzzz-none-000/linux-2.6.13.1/fs/open.c 2005-09-10 02:42:58.000000000 +0000 +++ ohio-7170-487/linux-2.6.13.1/fs/open.c 2006-06-09 13:32:28.000000000 +0000 @@ -27,6 +27,19 @@ #include +/***************************************************************************** + * <<<< 20060608 =OS= -- sync-on-demand + *****************************************************************************/ + +#include +#include + +extern int file_io_controller(void); +extern int max_rest_dirty_pages; +extern atomic_t f_global_dirt; + +/*****************************************************************************/ + int vfs_statfs(struct super_block *sb, struct kstatfs *buf) { int retval = -ENODEV; @@ -790,6 +803,9 @@ goto cleanup_file; } + f->f_dirt = 0; /* <<<< 20060608 =OS= */ + file_io_controller(); + f->f_mapping = inode->i_mapping; f->f_dentry = dentry; f->f_vfsmnt = mnt; @@ -991,6 +1007,15 @@ retval = filp->f_op->flush(filp); dnotify_flush(filp, id); + + /* <<<< 20060608 =OS= */ + atomic_add (filp->f_dirt, &f_global_dirt); + if (atomic_read (&f_global_dirt) > max_rest_dirty_pages) { + atomic_set (&f_global_dirt, 0); + wakeup_pdflush(0); + } + file_io_controller(); + locks_remove_posix(filp, id); fput(filp); return retval;