[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <11799669732061-git-send-email-jsipek@cs.sunysb.edu>
Date: Wed, 23 May 2007 20:36:01 -0400
From: "Josef 'Jeff' Sipek" <jsipek@...sunysb.edu>
To: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Cc: akpm@...ux-foundation.org,
"Josef 'Jeff' Sipek" <jsipek@...sunysb.edu>
Subject: [PATCH 11/21] Unionfs: Combine unionfs_write with __unionfs_write.
The __unionfs_write helper function was used only by unionfs_write, and
there is really no reason why they should not be combined.
Signed-off-by: Josef 'Jeff' Sipek <jsipek@...sunysb.edu>
---
fs/unionfs/file.c | 30 ++++++++++--------------------
1 files changed, 10 insertions(+), 20 deletions(-)
diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c
index 1dfcfcb..2e5ec42 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;
}
--
1.5.2.rc1.165.gaf9b
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists