lkml.org 
[lkml]   [2006]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 9/10] Rewrite ecryptfs_fsync()
Date
Rewrite ecryptfs_fsync() to be more concise. Note that i_fop is always
valid.

Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>

---
fs/ecryptfs/file.c | 29 ++++++++---------------------
1 files changed, 8 insertions(+), 21 deletions(-)
fb9079aa454161fdbdc53021b987eec7513fec06
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index 3a9cd15..c984ea6 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -322,29 +322,16 @@ static int ecryptfs_release(struct inode
static int
ecryptfs_fsync(struct file *file, struct dentry *dentry, int datasync)
{
+ struct file *lower_file = ecryptfs_file_to_lower(file);
+ struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
+ struct inode *lower_inode = lower_dentry->d_inode;
int rc = -EINVAL;
- struct file *lower_file = NULL;
- struct dentry *lower_dentry;

- if (!file) {
- lower_dentry = ecryptfs_dentry_to_lower(dentry);
- if (lower_dentry->d_inode->i_fop
- && lower_dentry->d_inode->i_fop->fsync) {
- mutex_lock(&lower_dentry->d_inode->i_mutex);
- rc = lower_dentry->d_inode->i_fop->fsync(lower_file,
- lower_dentry,
- datasync);
- mutex_unlock(&lower_dentry->d_inode->i_mutex);
- }
- } else {
- lower_file = ecryptfs_file_to_lower(file);
- lower_dentry = ecryptfs_dentry_to_lower(dentry);
- if (lower_file->f_op && lower_file->f_op->fsync) {
- mutex_lock(&lower_dentry->d_inode->i_mutex);
- rc = lower_file->f_op->fsync(lower_file, lower_dentry,
- datasync);
- mutex_unlock(&lower_dentry->d_inode->i_mutex);
- }
+ if (lower_inode->i_fop->fsync) {
+ mutex_lock(&lower_inode->i_mutex);
+ rc = lower_inode->i_fop->fsync(lower_file, lower_dentry,
+ datasync);
+ mutex_unlock(&lower_inode->i_mutex);
}
return rc;
}
--
1.3.3
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-26 16:25    [from the cache]
©2003-2011 Jasper Spaans