linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Halcrow <mhalcrow@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	Mike Halcrow <mhalcrow@us.ibm.com>,
	Mike Halcrow <mike@halcrow.us>
Subject: [PATCH 9/10] Rewrite ecryptfs_fsync()
Date: Fri, 26 May 2006 09:21:48 -0500	[thread overview]
Message-ID: <E1FjdCG-00033q-PJ@localhost.localdomain> (raw)
In-Reply-To: <20060526142117.GA2764@us.ibm.com>

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


  parent reply	other threads:[~2006-05-26 14:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-26 14:21 [PATCH 0/10] eCryptfs Updates Michael Halcrow
2006-05-26 14:21 ` [PATCH 2/10] Clean up #include's Mike Halcrow
2006-05-26 14:21 ` [PATCH 5/10] Remove unnecessary #ifndef's Mike Halcrow
2006-05-26 14:21 ` [PATCH 8/10] Remove unnecessary NULL checks Mike Halcrow
2006-05-26 14:21 ` [PATCH 10/10] Overhaul file locking Mike Halcrow
2006-05-26 14:21 ` [PATCH 4/10] uint16_t -> u16 Mike Halcrow
2006-05-26 14:21 ` Mike Halcrow [this message]
2006-05-26 14:21 ` [PATCH 3/10] Convert signed data types to unsigned data types Mike Halcrow
2006-05-26 14:21 ` [PATCH 1/10] Convert ASSERT to BUG_ON Mike Halcrow
2006-05-26 15:24   ` Adrian Bunk
2006-05-26 16:14     ` Michael Halcrow
2006-05-26 16:43       ` Adrian Bunk
2006-05-26 18:39     ` [PATCH] Remove ECRYPT_DEBUG from fs/Kconfig Michael Halcrow
2006-05-26 14:21 ` [PATCH 7/10] Remove extraneous read of inode size from header Mike Halcrow
2006-05-26 14:21 ` [PATCH 6/10] Remove ``NULL =='' syntax Mike Halcrow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1FjdCG-00033q-PJ@localhost.localdomain \
    --to=mhalcrow@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike@halcrow.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).