linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erez Zadok <ezk@cs.sunysb.edu>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	viro@ftp.linux.org.uk, hch@infradead.org,
	Erez Zadok <ezk@cs.sunysb.edu>
Subject: [PATCH 23/25] Unionfs: add un/likely conditionals on unlink ops
Date: Tue, 25 Sep 2007 23:10:02 -0400	[thread overview]
Message-ID: <1190776214844-git-send-email-ezk@cs.sunysb.edu> (raw)
In-Reply-To: <11907762042481-git-send-email-ezk@cs.sunysb.edu>

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/unlink.c |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/fs/unionfs/unlink.c b/fs/unionfs/unlink.c
index 3924f7f..33d08d9 100644
--- a/fs/unionfs/unlink.c
+++ b/fs/unionfs/unlink.c
@@ -26,13 +26,13 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)
 	int bindex;
 	int err = 0;
 
-	if ((err = unionfs_partial_lookup(dentry)))
+	if (unlikely((err = unionfs_partial_lookup(dentry))))
 		goto out;
 
 	bindex = dbstart(dentry);
 
 	lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
-	if (!lower_dentry)
+	if (unlikely(!lower_dentry))
 		goto out;
 
 	lower_dir_dentry = lock_parent(lower_dentry);
@@ -42,13 +42,13 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)
 	if (!(err = is_robranch_super(dentry->d_sb, bindex)))
 		err = vfs_unlink(lower_dir_dentry->d_inode, lower_dentry);
 	/* if vfs_unlink succeeded, update our inode's times */
-	if (!err)
+	if (likely(!err))
 		unionfs_copy_attr_times(dentry->d_inode);
 	dput(lower_dentry);
 	fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
 	unlock_dir(lower_dir_dentry);
 
-	if (err && !IS_COPYUP_ERR(err))
+	if (unlikely(err && !IS_COPYUP_ERR(err)))
 		goto out;
 
 	if (err) {
@@ -62,11 +62,11 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)
 		err = create_whiteout(dentry, dbstart(dentry));
 
 out:
-	if (!err)
+	if (likely(!err))
 		dentry->d_inode->i_nlink--;
 
 	/* We don't want to leave negative leftover dentries for revalidate. */
-	if (!err && (dbopaque(dentry) != -1))
+	if (likely(!err && (dbopaque(dentry) != -1)))
 		update_bstart(dentry);
 
 	return err;
@@ -79,7 +79,7 @@ int unionfs_unlink(struct inode *dir, struct dentry *dentry)
 	unionfs_read_lock(dentry->d_sb);
 	unionfs_lock_dentry(dentry);
 
-	if (!__unionfs_d_revalidate_chain(dentry, NULL, false)) {
+	if (unlikely(!__unionfs_d_revalidate_chain(dentry, NULL, false))) {
 		err = -ESTALE;
 		goto out;
 	}
@@ -87,7 +87,7 @@ int unionfs_unlink(struct inode *dir, struct dentry *dentry)
 
 	err = unionfs_unlink_whiteout(dir, dentry);
 	/* call d_drop so the system "forgets" about us */
-	if (!err) {
+	if (likely(!err)) {
 		if (!S_ISDIR(dentry->d_inode->i_mode))
 			unionfs_postcopyup_release(dentry);
 		d_drop(dentry);
@@ -99,7 +99,7 @@ int unionfs_unlink(struct inode *dir, struct dentry *dentry)
 	}
 
 out:
-	if (!err) {
+	if (likely(!err)) {
 		unionfs_check_dentry(dentry);
 		unionfs_check_inode(dir);
 	}
@@ -117,7 +117,7 @@ static int unionfs_rmdir_first(struct inode *dir, struct dentry *dentry,
 
 	/* Here we need to remove whiteout entries. */
 	err = delete_whiteouts(dentry, dbstart(dentry), namelist);
-	if (err)
+	if (unlikely(err))
 		goto out;
 
 	lower_dentry = unionfs_lower_dentry(dentry);
@@ -135,7 +135,7 @@ static int unionfs_rmdir_first(struct inode *dir, struct dentry *dentry,
 	dentry->d_inode->i_nlink = unionfs_get_nlinks(dentry->d_inode);
 
 out:
-	if (lower_dir_dentry)
+	if (likely(lower_dir_dentry))
 		unlock_dir(lower_dir_dentry);
 	return err;
 }
@@ -148,7 +148,7 @@ int unionfs_rmdir(struct inode *dir, struct dentry *dentry)
 	unionfs_read_lock(dentry->d_sb);
 	unionfs_lock_dentry(dentry);
 
-	if (!__unionfs_d_revalidate_chain(dentry, NULL, false)) {
+	if (unlikely(!__unionfs_d_revalidate_chain(dentry, NULL, false))) {
 		err = -ESTALE;
 		goto out;
 	}
@@ -156,7 +156,7 @@ int unionfs_rmdir(struct inode *dir, struct dentry *dentry)
 
 	/* check if this unionfs directory is empty or not */
 	err = check_empty(dentry, &namelist);
-	if (err)
+	if (unlikely(err))
 		goto out;
 
 	err = unionfs_rmdir_first(dir, dentry, namelist);
@@ -170,7 +170,7 @@ int unionfs_rmdir(struct inode *dir, struct dentry *dentry)
 			goto out;
 
 		/* exit if the error returned was NOT -EROFS */
-		if (!IS_COPYUP_ERR(err))
+		if (unlikely(!IS_COPYUP_ERR(err)))
 			goto out;
 
 		new_err = create_whiteout(dentry, dbstart(dentry) - 1);
@@ -180,10 +180,10 @@ int unionfs_rmdir(struct inode *dir, struct dentry *dentry)
 
 out:
 	/* call d_drop so the system "forgets" about us */
-	if (!err)
+	if (likely(!err))
 		d_drop(dentry);
 
-	if (namelist)
+	if (likely(namelist))
 		free_rdstate(namelist);
 
 	unionfs_unlock_dentry(dentry);
-- 
1.5.2.2


  parent reply	other threads:[~2007-09-26  3:30 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-26  3:09 [GIT PULL -mm] 00/25 Unionfs updates/cleanups/fixes Erez Zadok
2007-09-26  3:09 ` [PATCH 01/25] Unionfs: Simplify unionfs_get_nlinks Erez Zadok
2007-09-26  3:09 ` [PATCH 02/25] Unionfs: Remove unused #defines Erez Zadok
2007-09-26  3:09 ` [PATCH 03/25] Unionfs: display informational messages only if debug is on Erez Zadok
2007-09-26  8:36   ` Jan Engelhardt
2007-09-26 14:01     ` Erez Zadok
2007-09-26 15:24       ` Jan Engelhardt
2007-09-26 15:28         ` Erez Zadok
2007-09-26  3:09 ` [PATCH 04/25] Unionfs: cache-coherency fixes Erez Zadok
2007-09-26  3:09 ` [PATCH 05/25] Unionfs: cast page->index loff_t before shifting Erez Zadok
2007-09-26  8:31   ` Christoph Hellwig
2007-09-26 13:44     ` Erez Zadok
2007-09-26  3:09 ` [PATCH 06/25] Unionfs: minor coding style updates Erez Zadok
2007-09-26  3:09 ` [PATCH 07/25] Unionfs: add lower nameidata debugging support Erez Zadok
2007-09-26  3:09 ` [PATCH 08/25] Unionfs: lower nameidata support for nfsv4 Erez Zadok
2007-09-26  3:09 ` [PATCH 09/25] Unionfs: add un/likely conditionals on common fileops Erez Zadok
2007-09-26  3:09 ` [PATCH 10/25] Unionfs: add un/likely conditionals on copyup ops Erez Zadok
2007-09-26  4:32   ` Kok, Auke
2007-09-26 13:40     ` Erez Zadok
2007-09-26 15:23       ` Kyle Moffett
2007-09-26 15:43         ` Erez Zadok
2007-09-26 16:47           ` Jan Engelhardt
2007-09-26 16:51             ` Erez Zadok
2007-09-26 18:34       ` Adrian Bunk
2007-09-26  3:09 ` [PATCH 11/25] Unionfs: add un/likely conditionals on debug ops Erez Zadok
2007-09-26 21:34   ` roel
2007-09-26  3:09 ` [PATCH 12/25] Unionfs: add un/likely conditionals on dentry ops Erez Zadok
2007-09-26  3:09 ` [PATCH 13/25] Unionfs: add un/likely conditionals on dir ops Erez Zadok
2007-09-26 21:40   ` roel
2007-09-27 14:28     ` Erez Zadok
2007-09-26  3:09 ` [PATCH 14/25] Unionfs: add un/likely conditionals on headers Erez Zadok
2007-09-26  3:09 ` [PATCH 15/25] Unionfs: add un/likely conditionals on fileops Erez Zadok
2007-09-26  3:09 ` [PATCH 16/25] Unionfs: add un/likely conditionals on inode ops Erez Zadok
2007-09-26  3:09 ` [PATCH 17/25] Unionfs: add un/likely conditionals on lookup ops Erez Zadok
2007-09-26  3:09 ` [PATCH 18/25] Unionfs: add un/likely conditionals on super ops Erez Zadok
2007-09-26  3:09 ` [PATCH 19/25] Unionfs: add un/likely conditionals on mmap ops Erez Zadok
2007-09-26  3:09 ` [PATCH 20/25] Unionfs: add un/likely conditionals on rename ops Erez Zadok
2007-09-26  3:10 ` [PATCH 21/25] Unionfs: add un/likely conditionals on readdir ops Erez Zadok
2007-09-26  3:10 ` [PATCH 22/25] Unionfs: add un/likely conditionals on common subr Erez Zadok
2007-09-26  3:10 ` Erez Zadok [this message]
2007-09-26  3:10 ` [PATCH 24/25] Unionfs: add un/likely conditionals on xattr ops Erez Zadok
2007-09-26  3:10 ` [PATCH 25/25] Unionfs: use poison.h for safe poison pointers Erez Zadok

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=1190776214844-git-send-email-ezk@cs.sunysb.edu \
    --to=ezk@cs.sunysb.edu \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /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).