summaryrefslogtreecommitdiffstats
path: root/fs/buffer.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-03 21:46:06 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-03 21:46:06 +0000
commit3e414096429d55fbc8116171bba3487647bbe638 (patch)
tree2b5fcfd9d16fa3a32c829fc2076f6e3785b43374 /fs/buffer.c
parent20b23bfcf36fcb2d16d8b844501072541970637c (diff)
Merge with Linux 2.4.0-test3-pre2.
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 47d690fa4..b1e1c33b7 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -323,7 +323,7 @@ asmlinkage long sys_sync(void)
* filp may be NULL if called via the msync of a vma.
*/
-int file_fsync(struct file *filp, struct dentry *dentry)
+int file_fsync(struct file *filp, struct dentry *dentry, int datasync)
{
struct inode * inode = dentry->d_inode;
struct super_block * sb;
@@ -332,7 +332,7 @@ int file_fsync(struct file *filp, struct dentry *dentry)
lock_kernel();
/* sync the inode to buffers */
- write_inode_now(inode);
+ write_inode_now(inode, 0);
/* sync the superblock to buffers */
sb = inode->i_sb;
@@ -360,12 +360,7 @@ asmlinkage long sys_fsync(unsigned int fd)
goto out;
dentry = file->f_dentry;
- if (!dentry)
- goto out_putf;
-
inode = dentry->d_inode;
- if (!inode)
- goto out_putf;
err = -EINVAL;
if (!file->f_op || !file->f_op->fsync)
@@ -373,7 +368,7 @@ asmlinkage long sys_fsync(unsigned int fd)
/* We need to protect against concurrent writers.. */
down(&inode->i_sem);
- err = file->f_op->fsync(file, dentry);
+ err = file->f_op->fsync(file, dentry, 0);
up(&inode->i_sem);
out_putf:
@@ -395,20 +390,14 @@ asmlinkage long sys_fdatasync(unsigned int fd)
goto out;
dentry = file->f_dentry;
- if (!dentry)
- goto out_putf;
-
inode = dentry->d_inode;
- if (!inode)
- goto out_putf;
err = -EINVAL;
if (!file->f_op || !file->f_op->fsync)
goto out_putf;
- /* this needs further work, at the moment it is identical to fsync() */
down(&inode->i_sem);
- err = file->f_op->fsync(file, dentry);
+ err = file->f_op->fsync(file, dentry, 1);
up(&inode->i_sem);
out_putf:
@@ -2101,6 +2090,7 @@ static int grow_buffers(int size)
spin_unlock(&free_list[isize].lock);
page->buffers = bh;
+ page->flags &= ~(1 << PG_referenced);
lru_cache_add(page);
atomic_inc(&buffermem_pages);
return 1;
@@ -2499,7 +2489,7 @@ asmlinkage long sys_bdflush(int func, long data)
* the syscall above, but now we launch it ourselves internally with
* kernel_thread(...) directly after the first thread in init/main.c
*/
-int bdflush(void * unused)
+int bdflush(void *sem)
{
struct task_struct *tsk = current;
int flushed;
@@ -2521,6 +2511,8 @@ int bdflush(void * unused)
recalc_sigpending(tsk);
spin_unlock_irq(&tsk->sigmask_lock);
+ up((struct semaphore *)sem);
+
for (;;) {
CHECK_EMERGENCY_SYNC
@@ -2555,7 +2547,7 @@ int bdflush(void * unused)
* You don't need to change your userspace configuration since
* the userspace `update` will do_exit(0) at the first sys_bdflush().
*/
-int kupdate(void * unused)
+int kupdate(void *sem)
{
struct task_struct * tsk = current;
int interval;
@@ -2571,6 +2563,8 @@ int kupdate(void * unused)
recalc_sigpending(tsk);
spin_unlock_irq(&tsk->sigmask_lock);
+ up((struct semaphore *)sem);
+
for (;;) {
/* update interval */
interval = bdf_prm.b_un.interval;
@@ -2604,8 +2598,11 @@ int kupdate(void * unused)
static int __init bdflush_init(void)
{
- kernel_thread(bdflush, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
- kernel_thread(kupdate, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ DECLARE_MUTEX_LOCKED(sem);
+ kernel_thread(bdflush, &sem, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ down(&sem);
+ kernel_thread(kupdate, &sem, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ down(&sem);
return 0;
}