commit f8bd74f98e24305455c02b3b842acf79b3ad9738
Author: Erez Zadok <[EMAIL PROTECTED](none)>
Date:   Sun Mar 25 01:24:54 2007 -0400

    Merge unionfs_write with __unionfs_write.
    
    Merge the two functions because unionfs_write was a small function and the
    only one which called the __unionfs_write.  This saves on stack space and
    clarifies code a bit.

diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c
index 4da58e1..8817598 100644
--- a/fs/unionfs/file.c
+++ b/fs/unionfs/file.c
@@ -77,17 +77,20 @@ out:
        return err;
 }
 
-/* helper function to unionfs_write */
-static ssize_t __unionfs_write(struct file * file, const char __user * buf,
-                              size_t count, loff_t * ppos)
+static ssize_t unionfs_write(struct file * file, const char __user * buf,
+                            size_t count, loff_t *ppos)
 {
-       int err = -EINVAL;
+       int err;
        struct file *hidden_file = NULL;
        struct inode *inode;
        struct inode *hidden_inode;
        loff_t pos = *ppos;
        int bstart, bend;
 
+       unionfs_read_lock(file->f_dentry->d_sb);
+       if ((err = unionfs_file_revalidate(file, 1)))
+               goto out;
+
        inode = file->f_dentry->d_inode;
 
        bstart = fbstart(file);
@@ -98,8 +101,10 @@ static ssize_t __unionfs_write(struct file * file, const 
char __user * buf,
        hidden_file = unionfs_lower_file(file);
        hidden_inode = hidden_file->f_dentry->d_inode;
 
-       if (!hidden_file->f_op || !hidden_file->f_op->write)
+       if (!hidden_file->f_op || !hidden_file->f_op->write) {
+               err = -EINVAL;
                goto out;
+       }
 
        /* adjust for append -- seek to the end of the file */
        if (file->f_flags & O_APPEND)
@@ -120,21 +125,6 @@ static ssize_t __unionfs_write(struct file * file, const 
char __user * buf,
        if (pos > inode->i_size)
                inode->i_size = pos;
 out:
-       return err;
-}
-
-static ssize_t unionfs_write(struct file * file, const char __user * buf,
-                            size_t count, loff_t * ppos)
-{
-       int err = 0;
-
-       unionfs_read_lock(file->f_dentry->d_sb);
-       if ((err = unionfs_file_revalidate(file, 1)))
-               goto out;
-
-       err = __unionfs_write(file, buf, count, ppos);
-
-out:
        unionfs_read_unlock(file->f_dentry->d_sb);
        return err;
 }
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to