new helper: iterate_supers()
[safe/jmp/linux-2.6] / fs / coda / file.c
index 466303d..4c813f2 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/errno.h>
 #include <linux/smp_lock.h>
 #include <linux/string.h>
+#include <linux/slab.h>
 #include <asm/uaccess.h>
 
 #include <linux/coda.h>
@@ -47,6 +48,8 @@ coda_file_splice_read(struct file *coda_file, loff_t *ppos,
                      struct pipe_inode_info *pipe, size_t count,
                      unsigned int flags)
 {
+       ssize_t (*splice_read)(struct file *, loff_t *,
+                              struct pipe_inode_info *, size_t, unsigned int);
        struct coda_file_info *cfi;
        struct file *host_file;
 
@@ -54,10 +57,11 @@ coda_file_splice_read(struct file *coda_file, loff_t *ppos,
        BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
        host_file = cfi->cfi_container;
 
-       if (!host_file->f_op || !host_file->f_op->splice_read)
-               return -EINVAL;
+       splice_read = host_file->f_op->splice_read;
+       if (!splice_read)
+               splice_read = default_file_splice_read;
 
-       return host_file->f_op->splice_read(host_file, ppos, pipe, count,flags);
+       return splice_read(host_file, ppos, pipe, count, flags);
 }
 
 static ssize_t
@@ -201,8 +205,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file)
 int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
 {
        struct file *host_file;
-       struct dentry *host_dentry;
-       struct inode *host_inode, *coda_inode = coda_dentry->d_inode;
+       struct inode *coda_inode = coda_dentry->d_inode;
        struct coda_file_info *cfi;
        int err = 0;
 
@@ -214,14 +217,7 @@ int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
        BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
        host_file = cfi->cfi_container;
 
-       if (host_file->f_op && host_file->f_op->fsync) {
-               host_dentry = host_file->f_path.dentry;
-               host_inode = host_dentry->d_inode;
-               mutex_lock(&host_inode->i_mutex);
-               err = host_file->f_op->fsync(host_file, host_dentry, datasync);
-               mutex_unlock(&host_inode->i_mutex);
-       }
-
+       err = vfs_fsync(host_file, host_file->f_path.dentry, datasync);
        if ( !err && !datasync ) {
                lock_kernel();
                err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode));