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 11/25] Unionfs: add un/likely conditionals on debug ops
Date: Tue, 25 Sep 2007 23:09:50 -0400	[thread overview]
Message-ID: <11907762093651-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/debug.c |  108 +++++++++++++++++++++++++++------------------------
 1 files changed, 57 insertions(+), 51 deletions(-)

diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
index 9546a41..09b52ce 100644
--- a/fs/unionfs/debug.c
+++ b/fs/unionfs/debug.c
@@ -56,19 +56,19 @@ void __unionfs_check_inode(const struct inode *inode,
 	sb = inode->i_sb;
 	istart = ibstart(inode);
 	iend = ibend(inode);
-	if (istart > iend) {
+	if (unlikely(istart > iend)) {
 		PRINT_CALLER(fname, fxn, line);
 		printk(" Ci0: inode=%p istart/end=%d:%d\n",
 		       inode, istart, iend);
 	}
-	if ((istart == -1 && iend != -1) ||
-	    (istart != -1 && iend == -1)) {
+	if (unlikely((istart == -1 && iend != -1) ||
+		     (istart != -1 && iend == -1))) {
 		PRINT_CALLER(fname, fxn, line);
 		printk(" Ci1: inode=%p istart/end=%d:%d\n",
 		       inode, istart, iend);
 	}
 	if (!S_ISDIR(inode->i_mode)) {
-		if (iend != istart) {
+		if (unlikely(iend != istart)) {
 			PRINT_CALLER(fname, fxn, line);
 			printk(" Ci2: inode=%p istart=%d iend=%d\n",
 			       inode, istart, iend);
@@ -76,24 +76,24 @@ void __unionfs_check_inode(const struct inode *inode,
 	}
 
 	for (bindex = sbstart(sb); bindex < sbmax(sb); bindex++) {
-		if (!UNIONFS_I(inode)) {
+		if (unlikely(!UNIONFS_I(inode))) {
 			PRINT_CALLER(fname, fxn, line);
 			printk(" Ci3: no inode_info %p\n", inode);
 			return;
 		}
-		if (!UNIONFS_I(inode)->lower_inodes) {
+		if (unlikely(!UNIONFS_I(inode)->lower_inodes)) {
 			PRINT_CALLER(fname, fxn, line);
 			printk(" Ci4: no lower_inodes %p\n", inode);
 			return;
 		}
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (lower_inode) {
-			if (bindex < istart || bindex > iend) {
+			if (unlikely(bindex < istart || bindex > iend)) {
 				PRINT_CALLER(fname, fxn, line);
 				printk(" Ci5: inode/linode=%p:%p bindex=%d "
 				       "istart/end=%d:%d\n", inode,
 				       lower_inode, bindex, istart, iend);
-			} else if (lower_inode == POISONED_PTR) {
+			} else if (unlikely(lower_inode == POISONED_PTR)) {
 				/* freed inode! */
 				PRINT_CALLER(fname, fxn, line);
 				printk(" Ci6: inode/linode=%p:%p bindex=%d "
@@ -107,8 +107,9 @@ void __unionfs_check_inode(const struct inode *inode,
 				 * b/t start/end, but NOT if at the
 				 * start/end range.
 				 */
-				if (!(S_ISDIR(inode->i_mode) &&
-				      bindex > istart && bindex < iend)) {
+				if (unlikely(!(S_ISDIR(inode->i_mode) &&
+					       bindex > istart &&
+					       bindex < iend))) {
 					PRINT_CALLER(fname, fxn, line);
 					printk(" Ci7: inode/linode=%p:%p "
 					       "bindex=%d istart/end=%d:%d\n",
@@ -138,8 +139,8 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 	dend = dbend(dentry);
 	BUG_ON(dstart > dend);
 
-	if ((dstart == -1 && dend != -1) ||
-	    (dstart != -1 && dend == -1)) {
+	if (unlikely((dstart == -1 && dend != -1) ||
+		     (dstart != -1 && dend == -1))) {
 		PRINT_CALLER(fname, fxn, line);
 		printk(" CD0: dentry=%p dstart/end=%d:%d\n",
 		       dentry, dstart, dend);
@@ -151,7 +152,7 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 	for (bindex = sbstart(sb); bindex < sbmax(sb); bindex++) {
 		lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		if (lower_dentry) {
-			if (bindex < dstart || bindex > dend) {
+			if (unlikely(bindex < dstart || bindex > dend)) {
 				PRINT_CALLER(fname, fxn, line);
 				printk(" CD1: dentry/lower=%p:%p(%p) "
 				       "bindex=%d dstart/end=%d:%d\n",
@@ -169,10 +170,10 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 				 * however, if this is a NULL dentry or a
 				 * deleted dentry.
 				 */
-				if (!d_deleted((struct dentry *) dentry) &&
-				    inode &&
-				    !(inode && S_ISDIR(inode->i_mode) &&
-				      bindex > dstart && bindex < dend)) {
+				if (unlikely(!d_deleted((struct dentry *) dentry) &&
+					     inode &&
+					     !(inode && S_ISDIR(inode->i_mode) &&
+					       bindex > dstart && bindex < dend))) {
 					PRINT_CALLER(fname, fxn, line);
 					printk(" CD2: dentry/lower=%p:%p(%p) "
 					       "bindex=%d dstart/end=%d:%d\n",
@@ -190,7 +191,7 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 	for (bindex = sbstart(sb); bindex < sbmax(sb); bindex++) {
 		lower_mnt = unionfs_lower_mnt_idx(dentry, bindex);
 		if (lower_mnt) {
-			if (bindex < dstart || bindex > dend) {
+			if (unlikely(bindex < dstart || bindex > dend)) {
 				PRINT_CALLER(fname, fxn, line);
 				printk(" CM0: dentry/lmnt=%p:%p bindex=%d "
 				       "dstart/end=%d:%d\n", dentry,
@@ -204,9 +205,9 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 				 * start/end range.  Ignore this rule,
 				 * however, if this is a NULL dentry.
 				 */
-				if (inode &&
-				    !(inode && S_ISDIR(inode->i_mode) &&
-				      bindex > dstart && bindex < dend)) {
+				if (unlikely(inode &&
+					     !(inode && S_ISDIR(inode->i_mode) &&
+					       bindex > dstart && bindex < dend))) {
 					PRINT_CALLER(fname, fxn, line);
 					printk(" CM1: dentry/lmnt=%p:%p "
 					       "bindex=%d dstart/end=%d:%d\n",
@@ -223,30 +224,30 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 	istart = ibstart(inode);
 	iend = ibend(inode);
 	BUG_ON(istart > iend);
-	if ((istart == -1 && iend != -1) ||
-	    (istart != -1 && iend == -1)) {
+	if (unlikely((istart == -1 && iend != -1) ||
+		     (istart != -1 && iend == -1))) {
 		PRINT_CALLER(fname, fxn, line);
 		printk(" CI0: dentry/inode=%p:%p istart/end=%d:%d\n",
 		       dentry, inode, istart, iend);
 	}
-	if (istart != dstart) {
+	if (unlikely(istart != dstart)) {
 		PRINT_CALLER(fname, fxn, line);
 		printk(" CI1: dentry/inode=%p:%p istart=%d dstart=%d\n",
 		       dentry, inode, istart, dstart);
 	}
-	if (iend != dend) {
+	if (unlikely(iend != dend)) {
 		PRINT_CALLER(fname, fxn, line);
 		printk(" CI2: dentry/inode=%p:%p iend=%d dend=%d\n",
 		       dentry, inode, iend, dend);
 	}
 
 	if (!S_ISDIR(inode->i_mode)) {
-		if (dend != dstart) {
+		if (unlikely(dend != dstart)) {
 			PRINT_CALLER(fname, fxn, line);
 			printk(" CI3: dentry/inode=%p:%p dstart=%d dend=%d\n",
 			       dentry, inode, dstart, dend);
 		}
-		if (iend != istart) {
+		if (unlikely(iend != istart)) {
 			PRINT_CALLER(fname, fxn, line);
 			printk(" CI4: dentry/inode=%p:%p istart=%d iend=%d\n",
 			       dentry, inode, istart, iend);
@@ -256,12 +257,12 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 	for (bindex = sbstart(sb); bindex < sbmax(sb); bindex++) {
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (lower_inode) {
-			if (bindex < istart || bindex > iend) {
+			if (unlikely(bindex < istart || bindex > iend)) {
 				PRINT_CALLER(fname, fxn, line);
 				printk(" CI5: dentry/linode=%p:%p bindex=%d "
 				       "istart/end=%d:%d\n", dentry,
 				       lower_inode, bindex, istart, iend);
-			} else if (lower_inode == POISONED_PTR) {
+			} else if (unlikely(lower_inode == POISONED_PTR)) {
 				/* freed inode! */
 				PRINT_CALLER(fname, fxn, line);
 				printk(" CI6: dentry/linode=%p:%p bindex=%d "
@@ -275,8 +276,9 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 				 * b/t start/end, but NOT if at the
 				 * start/end range.
 				 */
-				if (!(S_ISDIR(inode->i_mode) &&
-				      bindex > istart && bindex < iend)) {
+				if (unlikely(!(S_ISDIR(inode->i_mode) &&
+					       bindex > istart &&
+					       bindex < iend))) {
 					PRINT_CALLER(fname, fxn, line);
 					printk(" CI7: dentry/linode=%p:%p "
 					       "bindex=%d istart/end=%d:%d\n",
@@ -298,8 +300,10 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 			lower_dentry = unionfs_lower_dentry_idx(dentry,
 								bindex);
 			lower_mnt = unionfs_lower_mnt_idx(dentry, bindex);
-			if (!((lower_inode && lower_dentry && lower_mnt) ||
-			      (!lower_inode && !lower_dentry && !lower_mnt))) {
+			if (unlikely(!((lower_inode && lower_dentry &&
+					lower_mnt) ||
+				       (!lower_inode &&
+					!lower_dentry && !lower_mnt)))) {
 				PRINT_CALLER(fname, fxn, line);
 				printk(" Cx: lmnt/ldentry/linode=%p:%p:%p "
 				       "bindex=%d dstart/end=%d:%d\n",
@@ -308,11 +312,11 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 			}
 		}
 	/* check if lower inode is newer than upper one (it shouldn't) */
-	if (is_newer_lower(dentry)) {
+	if (unlikely(is_newer_lower(dentry))) {
 		PRINT_CALLER(fname, fxn, line);
 		for (bindex=ibstart(inode); bindex <= ibend(inode); bindex++) {
 			lower_inode = unionfs_lower_inode_idx(inode, bindex);
-			if (!lower_inode)
+			if (unlikely(!lower_inode))
 				continue;
 			printk(" CI8: bindex=%d mtime/lmtime=%lu.%lu/%lu.%lu "
 			       "ctime/lctime=%lu.%lu/%lu.%lu\n",
@@ -350,30 +354,30 @@ void __unionfs_check_file(const struct file *file,
 	fend = fbend(file);
 	BUG_ON(fstart > fend);
 
-	if ((fstart == -1 && fend != -1) ||
-	    (fstart != -1 && fend == -1)) {
+	if (unlikely((fstart == -1 && fend != -1) ||
+		     (fstart != -1 && fend == -1))) {
 		PRINT_CALLER(fname, fxn, line);
 		printk(" CF0: file/dentry=%p:%p fstart/end=%d:%d\n",
 		       file, dentry, fstart, fend);
 	}
-	if (fstart != dstart) {
+	if (unlikely(fstart != dstart)) {
 		PRINT_CALLER(fname, fxn, line);
 		printk(" CF1: file/dentry=%p:%p fstart=%d dstart=%d\n",
 		       file, dentry, fstart, dstart);
 	}
-	if (fend != dend) {
+	if (unlikely(fend != dend)) {
 		PRINT_CALLER(fname, fxn, line);
 		printk(" CF2: file/dentry=%p:%p fend=%d dend=%d\n",
 		       file, dentry, fend, dend);
 	}
 	inode = dentry->d_inode;
 	if (!S_ISDIR(inode->i_mode)) {
-		if (fend != fstart) {
+		if (unlikely(fend != fstart)) {
 			PRINT_CALLER(fname, fxn, line);
 			printk(" CF3: file/inode=%p:%p fstart=%d fend=%d\n",
 			       file, inode, fstart, fend);
 		}
-		if (dend != dstart) {
+		if (unlikely(dend != dstart)) {
 			PRINT_CALLER(fname, fxn, line);
 			printk(" CF4: file/dentry=%p:%p dstart=%d dend=%d\n",
 			       file, dentry, dstart, dend);
@@ -387,7 +391,7 @@ void __unionfs_check_file(const struct file *file,
 	for (bindex = sbstart(sb); bindex < sbmax(sb); bindex++) {
 		lower_file = unionfs_lower_file_idx(file, bindex);
 		if (lower_file) {
-			if (bindex < fstart || bindex > fend) {
+			if (unlikely(bindex < fstart || bindex > fend)) {
 				PRINT_CALLER(fname, fxn, line);
 				printk(" CF5: file/lower=%p:%p bindex=%d "
 				       "fstart/end=%d:%d\n",
@@ -400,8 +404,9 @@ void __unionfs_check_file(const struct file *file,
 				 * b/t start/end, but NOT if at the
 				 * start/end range.
 				 */
-				if (!(S_ISDIR(inode->i_mode) &&
-				      bindex > fstart && bindex < fend)) {
+				if (unlikely(!(S_ISDIR(inode->i_mode) &&
+					       bindex > fstart &&
+					       bindex < fend))) {
 					PRINT_CALLER(fname, fxn, line);
 					printk(" CF6: file/lower=%p:%p "
 					       "bindex=%d fstart/end=%d:%d\n",
@@ -421,12 +426,13 @@ void __unionfs_check_nd(const struct nameidata *nd,
 	struct file *file;
 	int printed_caller = 0;
 
-	if (!nd)
+	if (unlikely(!nd))
 		return;
 	if (nd->flags & LOOKUP_OPEN) {
 		file = nd->intent.open.file;
-		if (file->f_path.dentry &&
-		    strcmp(file->f_dentry->d_sb->s_type->name, "unionfs")) {
+		if (unlikely(file->f_path.dentry &&
+			     strcmp(file->f_dentry->d_sb->s_type->name,
+				    "unionfs"))) {
 			PRINT_CALLER(fname, fxn, line);
 			printk(" CND1: lower_file of type %s\n",
 			       file->f_path.dentry->d_sb->s_type->name);
@@ -444,7 +450,7 @@ void __show_branch_counts(const struct super_block *sb,
 
 	printk("BC:");
 	for (i=0; i<sbmax(sb); i++) {
-		if (sb->s_root)
+		if (likely(sb->s_root))
 			mnt = UNIONFS_D(sb->s_root)->lower_paths[i].mnt;
 		else
 			mnt = NULL;
@@ -461,7 +467,7 @@ void __show_inode_times(const struct inode *inode,
 
 	for (bindex=ibstart(inode); bindex <= ibend(inode); bindex++) {
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
-		if (!lower_inode)
+		if (unlikely(!lower_inode))
 			continue;
 		printk("IT(%lu:%d): ", inode->i_ino, bindex);
 		printk("%s:%s:%d ",file,fxn,line);
@@ -507,14 +513,14 @@ void __show_inode_counts(const struct inode *inode,
 	struct inode *lower_inode;
 	int bindex;
 
-	if (!inode) {
+	if (unlikely(!inode)) {
 		printk("SiC: Null inode\n");
 		return;
 	}
 	for (bindex=sbstart(inode->i_sb); bindex <= sbend(inode->i_sb);
 	     bindex++) {
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
-		if (!lower_inode)
+		if (unlikely(!lower_inode))
 			continue;
 		printk("SIC(%lu:%d:%d): ", inode->i_ino, bindex,
 		       atomic_read(&(inode)->i_count));
-- 
1.5.2.2


  parent reply	other threads:[~2007-09-26  3:32 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 ` Erez Zadok [this message]
2007-09-26 21:34   ` [PATCH 11/25] Unionfs: add un/likely conditionals on debug ops 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 ` [PATCH 23/25] Unionfs: add un/likely conditionals on unlink ops Erez Zadok
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=11907762093651-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).