linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes
@ 2007-10-01  5:50 Erez Zadok
  2007-10-01  5:50 ` [PATCH 01/19] Unionfs: compile if debug is off Erez Zadok
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch


The following is a series of patches related to Unionfs.  The main changes
here are compliance with coding style and assorted cleanups, based on lkml
comments and advise.  Specifically, the un/likely updates from the previous
series of patches was completely redone; the number of un/likely instances
was reduced from 546 to 163 and what's left are considered highly unlikely
(99% or higher threshold).

These patches were tested (where appropriate) on our 2.6.23-rc8 latest code,
as well as the backports to 2.6.{22,21,20,19,18,9} on ext2/3/4, xfs,
reiserfs, nfs2/3/4, jffs2, ramfs, tmpfs, cramfs, and squashfs (where
available).  See http://unionfs.filesystems.org/ to download backported
unionfs code.

Please pull from the 'master' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/ezk/unionfs.git

to receive the following:

Erez Zadok (19):
      Unionfs: compile if debug is off
      Unionfs: add un/likely on conditionals
      Unionfs: minor comment cleanups
      Unionfs: use consistent printk prefixes
      Unionfs: use UNIONFS_NAME macro
      Unionfs: properly indent static struct
      Unionfs: remove unnecessary if condition
      Unionfs: use page_offset() helper
      Unionfs: use pr_debug() instead of custom dprintk()
      Unionfs: convert all appropriate printk's to pr_debug calls
      Unionfs: add missing newlines in printk's
      Unionfs: update/assign a KERN_* level to all printk statements
      Unionfs: remove periods from the end of printk strings
      Unionfs: use braces in both branches of conditionals
      Unionfs: coding style: proper spacing
      Unionfs: coding style: take assignments out of "if" conditions
      Unionfs: coding style: avoid multiple assignments on same line
      Unionfs: coding style: miscellaneous fixes
      Unionfs: coding style: avoid lines longer than 80 chars

 Makefile     |    4 
 commonfops.c |   86 ++++++------
 copyup.c     |   31 ++--
 debug.c      |  406 +++++++++++++++++++++++++++++------------------------------
 dentry.c     |   66 ++++-----
 dirfops.c    |   32 ++--
 dirhelper.c  |   13 +
 fanout.h     |   11 +
 file.c       |   29 ++--
 inode.c      |   82 ++++++-----
 lookup.c     |   29 ++--
 main.c       |   80 ++++++-----
 mmap.c       |   18 +-
 rdstate.c    |   18 +-
 rename.c     |   59 ++++----
 subr.c       |   13 +
 super.c      |  102 +++++++-------
 union.h      |   52 +++----
 unlink.c     |   22 +--
 xattr.c      |   16 +-
 20 files changed, 622 insertions(+), 547 deletions(-)

---
Erez Zadok
ezk@cs.sunysb.edu

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 01/19] Unionfs: compile if debug is off
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 02/19] Unionfs: add un/likely on conditionals Erez Zadok
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Signed-of-by: John Johansen <jjohansen@suse.de>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/union.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 824bb67..7ce4771 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -556,6 +556,7 @@ extern void __show_inode_counts(const struct inode *inode,
 #define unionfs_check_inode(i)		do { } while(0)
 #define unionfs_check_dentry(d)		do { } while(0)
 #define unionfs_check_file(f)		do { } while(0)
+#define unionfs_check_nd(n)		do { } while(0)
 #define show_branch_counts(sb)		do { } while(0)
 #define show_inode_times(i)		do { } while(0)
 #define show_dinode_times(d)		do { } while(0)
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 02/19] Unionfs: add un/likely on conditionals
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
  2007-10-01  5:50 ` [PATCH 01/19] Unionfs: compile if debug is off Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 03/19] Unionfs: minor comment cleanups Erez Zadok
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/commonfops.c |   34 +++++++-------
 fs/unionfs/copyup.c     |   18 ++++----
 fs/unionfs/debug.c      |  108 +++++++++++++++++++++++++----------------------
 fs/unionfs/dentry.c     |   25 ++++++-----
 fs/unionfs/dirfops.c    |    6 +-
 fs/unionfs/dirhelper.c  |    6 +-
 fs/unionfs/fanout.h     |    6 +-
 fs/unionfs/file.c       |   16 ++++----
 fs/unionfs/inode.c      |   42 +++++++++---------
 fs/unionfs/lookup.c     |   12 +++---
 fs/unionfs/main.c       |   26 ++++++------
 fs/unionfs/mmap.c       |    4 +-
 fs/unionfs/rdstate.c    |    8 ++--
 fs/unionfs/rename.c     |   14 +++---
 fs/unionfs/subr.c       |    8 ++--
 fs/unionfs/super.c      |   24 +++++-----
 fs/unionfs/unlink.c     |    4 +-
 fs/unionfs/xattr.c      |   10 ++--
 18 files changed, 189 insertions(+), 182 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index e69ccf6..8550a34 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -74,7 +74,7 @@ retry:
 	err = copyup_named_file(dentry->d_parent->d_inode, file, name, bstart,
 				bindex, file->f_path.dentry->d_inode->i_size);
 	if (err) {
-		if (err == -EEXIST)
+		if (unlikely(err == -EEXIST))
 			goto retry;
 		goto out;
 	}
@@ -126,7 +126,7 @@ static void cleanup_file(struct file *file)
 		 */
 		old_bid = UNIONFS_F(file)->saved_branch_ids[bindex];
 		i = branch_id_to_idx(sb, old_bid);
-		if (i < 0) {
+		if (unlikely(i < 0)) {
 			printk(KERN_ERR "unionfs: no superblock for "
 			       "file %p\n", file);
 			continue;
@@ -317,8 +317,8 @@ int unionfs_file_revalidate(struct file *file, bool willwrite)
 	 * First revalidate the dentry inside struct file,
 	 * but not unhashed dentries.
 	 */
-	if (!d_deleted(dentry) &&
-	    !__unionfs_d_revalidate_chain(dentry, NULL, willwrite)) {
+	if (unlikely(!d_deleted(dentry) &&
+		     !__unionfs_d_revalidate_chain(dentry, NULL, willwrite))) {
 		err = -ESTALE;
 		goto out_nofree;
 	}
@@ -335,8 +335,8 @@ int unionfs_file_revalidate(struct file *file, bool willwrite)
 	 * someone has copied up this file from underneath us, we also need
 	 * to refresh things.
 	 */
-	if (!d_deleted(dentry) &&
-	    (sbgen > fgen || dbstart(dentry) != fbstart(file))) {
+	if (unlikely(!d_deleted(dentry) &&
+		     (sbgen > fgen || dbstart(dentry) != fbstart(file)))) {
 		/* save orig branch ID */
 		int orig_brid =	UNIONFS_F(file)->saved_branch_ids[fbstart(file)];
 
@@ -349,13 +349,13 @@ int unionfs_file_revalidate(struct file *file, bool willwrite)
 
 		size = sizeof(struct file *) * sbmax(sb);
 		UNIONFS_F(file)->lower_files = kzalloc(size, GFP_KERNEL);
-		if (!UNIONFS_F(file)->lower_files) {
+		if (unlikely(!UNIONFS_F(file)->lower_files)) {
 			err = -ENOMEM;
 			goto out;
 		}
 		size = sizeof(int) * sbmax(sb);
 		UNIONFS_F(file)->saved_branch_ids = kzalloc(size, GFP_KERNEL);
-		if (!UNIONFS_F(file)->saved_branch_ids) {
+		if (unlikely(!UNIONFS_F(file)->saved_branch_ids)) {
 			err = -ENOMEM;
 			goto out;
 		}
@@ -373,7 +373,7 @@ int unionfs_file_revalidate(struct file *file, bool willwrite)
 				goto out;
 			new_brid = UNIONFS_F(file)->
 			  saved_branch_ids[fbstart(file)];
-			if (new_brid != orig_brid && sbgen > fgen) {
+			if (unlikely(new_brid != orig_brid && sbgen > fgen)) {
 				/*
 				 * If we re-opened the file on a different
 				 * branch than the original one, and this
@@ -520,7 +520,7 @@ int unionfs_open(struct inode *inode, struct file *file)
 
 	file->private_data =
 		kzalloc(sizeof(struct unionfs_file_info), GFP_KERNEL);
-	if (!UNIONFS_F(file)) {
+	if (unlikely(!UNIONFS_F(file))) {
 		err = -ENOMEM;
 		goto out_nofree;
 	}
@@ -531,13 +531,13 @@ int unionfs_open(struct inode *inode, struct file *file)
 
 	size = sizeof(struct file *) * sbmax(inode->i_sb);
 	UNIONFS_F(file)->lower_files = kzalloc(size, GFP_KERNEL);
-	if (!UNIONFS_F(file)->lower_files) {
+	if (unlikely(!UNIONFS_F(file)->lower_files)) {
 		err = -ENOMEM;
 		goto out;
 	}
 	size = sizeof(int) * sbmax(inode->i_sb);
 	UNIONFS_F(file)->saved_branch_ids = kzalloc(size, GFP_KERNEL);
-	if (!UNIONFS_F(file)->saved_branch_ids) {
+	if (unlikely(!UNIONFS_F(file)->saved_branch_ids)) {
 		err = -ENOMEM;
 		goto out;
 	}
@@ -612,7 +612,7 @@ int unionfs_file_release(struct inode *inode, struct file *file)
 	 * This is important for open-but-unlinked files, as well as mmap
 	 * support.
 	 */
-	if ((err = unionfs_file_revalidate(file, true)))
+	if (unlikely((err = unionfs_file_revalidate(file, true))))
 		goto out;
 	unionfs_check_file(file);
 	fileinfo = UNIONFS_F(file);
@@ -716,7 +716,7 @@ static int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd,
 		lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		if (!lower_dentry)
 			continue;
-		if (lower_dentry->d_inode)
+		if (likely(lower_dentry->d_inode))
 			FD_SET(bindex, &branchlist);
 		/* purge any lower objects after partial_lookup */
 		if (bindex < orig_bstart || bindex > orig_bend) {
@@ -739,7 +739,7 @@ static int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd,
 	ibend(dentry->d_inode) = orig_bend;
 
 	err = copy_to_user((void __user *)arg, &branchlist, sizeof(fd_set));
-	if (err)
+	if (unlikely(err))
 		err = -EFAULT;
 
 out:
@@ -753,7 +753,7 @@ long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
 
-	if ((err = unionfs_file_revalidate(file, true)))
+	if (unlikely((err = unionfs_file_revalidate(file, true))))
 		goto out;
 
 	/* check if asked for local commands */
@@ -791,7 +791,7 @@ int unionfs_flush(struct file *file, fl_owner_t id)
 
 	unionfs_read_lock(dentry->d_sb);
 
-	if ((err = unionfs_file_revalidate(file, true)))
+	if (unlikely((err = unionfs_file_revalidate(file, true))))
 		goto out;
 	unionfs_check_file(file);
 
diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
index 23ac4c8..4eb5f82 100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@ -43,7 +43,7 @@ static int copyup_xattrs(struct dentry *old_lower_dentry,
 
 	/* allocate space for the actual list */
 	name_list = unionfs_xattr_alloc(list_size + 1, XATTR_LIST_MAX);
-	if (!name_list || IS_ERR(name_list)) {
+	if (unlikely(!name_list || IS_ERR(name_list))) {
 		err = PTR_ERR(name_list);
 		goto out;
 	}
@@ -59,7 +59,7 @@ static int copyup_xattrs(struct dentry *old_lower_dentry,
 
 	/* allocate space to hold each xattr's value */
 	attr_value = unionfs_xattr_alloc(XATTR_SIZE_MAX, XATTR_SIZE_MAX);
-	if (!attr_value || IS_ERR(attr_value)) {
+	if (unlikely(!attr_value || IS_ERR(attr_value))) {
 		err = PTR_ERR(name_list);
 		goto out;
 	}
@@ -198,7 +198,7 @@ static int __copyup_ndentry(struct dentry *old_lower_dentry,
 	} else if (S_ISREG(old_mode)) {
 		struct nameidata nd;
 		err = init_lower_nd(&nd, LOOKUP_CREATE);
-		if (err < 0)
+		if (unlikely(err < 0))
 			goto out;
 		args.create.nd = &nd;
 		args.create.parent = new_lower_parent_dentry->d_inode;
@@ -245,7 +245,7 @@ static int __copyup_reg_data(struct dentry *dentry,
 		err = PTR_ERR(input_file);
 		goto out;
 	}
-	if (!input_file->f_op || !input_file->f_op->read) {
+	if (unlikely(!input_file->f_op || !input_file->f_op->read)) {
 		err = -EINVAL;
 		goto out_close_in;
 	}
@@ -260,14 +260,14 @@ static int __copyup_reg_data(struct dentry *dentry,
 		err = PTR_ERR(output_file);
 		goto out_close_in2;
 	}
-	if (!output_file->f_op || !output_file->f_op->write) {
+	if (unlikely(!output_file->f_op || !output_file->f_op->write)) {
 		err = -EINVAL;
 		goto out_close_out;
 	}
 
 	/* allocating a buffer */
 	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
-	if (!buf) {
+	if (unlikely(!buf)) {
 		err = -ENOMEM;
 		goto out_close_out;
 	}
@@ -412,7 +412,7 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,
 	if (S_ISLNK(old_lower_dentry->d_inode->i_mode)) {
 
 		symbuf = kmalloc(PATH_MAX, GFP_KERNEL);
-		if (!symbuf) {
+		if (unlikely(!symbuf)) {
 			__clear(dentry, old_lower_dentry,
 				old_bstart, old_bend,
 				new_lower_dentry, new_bindex);
@@ -692,7 +692,7 @@ struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
 	/* There is no sense allocating any less than the minimum. */
 	nr_dentry = 1;
 	path = kmalloc(nr_dentry * sizeof(struct dentry *), GFP_KERNEL);
-	if (!path)
+	if (unlikely(!path))
 		goto out;
 
 	/* assume the negative dentry of unionfs as the parent dentry */
@@ -725,7 +725,7 @@ struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
 			nr_dentry *= 2;
 			p = krealloc(path, nr_dentry * sizeof(struct dentry *),
 				     GFP_KERNEL);
-			if (!p) {
+			if (unlikely(!p)) {
 				lower_dentry = ERR_PTR(-ENOMEM);
 				goto out;
 			}
diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
index 224773e..b103eb9 100644
--- a/fs/unionfs/debug.c
+++ b/fs/unionfs/debug.c
@@ -49,19 +49,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);
@@ -69,12 +69,12 @@ 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;
@@ -82,12 +82,12 @@ void __unionfs_check_inode(const struct inode *inode,
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (lower_inode) {
 			memset(&poison_ptr, POISON_INUSE, sizeof(void *));
-			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 == poison_ptr) {
+			} else if (unlikely(lower_inode == poison_ptr)) {
 				/* freed inode! */
 				PRINT_CALLER(fname, fxn, line);
 				printk(" Ci6: inode/linode=%p:%p bindex=%d "
@@ -101,8 +101,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",
@@ -133,8 +134,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);
@@ -146,7 +147,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",
@@ -164,10 +165,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",
@@ -185,7 +186,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,
@@ -199,9 +200,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",
@@ -218,30 +219,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);
@@ -252,12 +253,12 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (lower_inode) {
 			memset(&poison_ptr, POISON_INUSE, sizeof(void *));
-			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 == poison_ptr) {
+			} else if (unlikely(lower_inode == poison_ptr)) {
 				/* freed inode! */
 				PRINT_CALLER(fname, fxn, line);
 				printk(" CI6: dentry/linode=%p:%p bindex=%d "
@@ -271,8 +272,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",
@@ -294,8 +296,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",
@@ -304,11 +308,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",
@@ -346,30 +350,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);
@@ -383,7 +387,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",
@@ -396,8 +400,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",
@@ -417,12 +422,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);
@@ -440,7 +446,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;
@@ -457,7 +463,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);
@@ -503,14 +509,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));
diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 52bcb18..89f6a91 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -62,7 +62,7 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry,
 	 * revalidation to be done, because this file does not exist within
 	 * the namespace, and Unionfs operates on the namespace, not data.
 	 */
-	if (sbgen != dgen) {
+	if (unlikely(sbgen != dgen)) {
 		struct dentry *result;
 		int pdgen;
 
@@ -138,7 +138,7 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry,
 			dentry = result;
 		}
 
-		if (positive && UNIONFS_I(dentry->d_inode)->stale) {
+		if (unlikely(positive && UNIONFS_I(dentry->d_inode)->stale)) {
 			make_bad_inode(dentry->d_inode);
 			d_drop(dentry);
 			valid = false;
@@ -216,16 +216,16 @@ bool is_newer_lower(const struct dentry *dentry)
 		 * lower inode's data has changed, but checking for changed
 		 * ctime and mtime on the lower inode should be enough.
 		 */
-		if (timespec_compare(&inode->i_mtime,
-				     &lower_inode->i_mtime) < 0) {
+		if (unlikely(timespec_compare(&inode->i_mtime,
+					      &lower_inode->i_mtime) < 0)) {
 			printk("unionfs: new lower inode mtime "
 			       "(bindex=%d, name=%s)\n", bindex,
 			       dentry->d_name.name);
 			show_dinode_times(dentry);
 			return true; /* mtime changed! */
 		}
-		if (timespec_compare(&inode->i_ctime,
-				     &lower_inode->i_ctime) < 0) {
+		if (unlikely(timespec_compare(&inode->i_ctime,
+					      &lower_inode->i_ctime) < 0)) {
 			printk("unionfs: new lower inode ctime "
 			       "(bindex=%d, name=%s)\n", bindex,
 			       dentry->d_name.name);
@@ -293,7 +293,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,
 	dtmp = dentry->d_parent;
 	dgen = atomic_read(&UNIONFS_D(dtmp)->generation);
 	/* XXX: should we check if is_newer_lower all the way up? */
-	if (is_newer_lower(dtmp)) {
+	if (unlikely(is_newer_lower(dtmp))) {
 		/*
 		 * Special case: the root dentry's generation number must
 		 * always be valid, but its lower inode times don't have to
@@ -327,7 +327,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,
 	 * and short lived, so locality will be better.
 	 */
 	chain = kzalloc(chain_len * sizeof(struct dentry *), GFP_KERNEL);
-	if (!chain) {
+	if (unlikely(!chain)) {
 		printk("unionfs: no more memory in %s\n", __FUNCTION__);
 		goto out;
 	}
@@ -364,7 +364,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,
 		}
 		unionfs_unlock_dentry(chain[i]);
 
-		if (!valid)
+		if (unlikely(!valid))
 			goto out_free;
 	}
 
@@ -373,7 +373,8 @@ out_this:
 	/* finally, lock this dentry and revalidate it */
 	verify_locked(dentry);
 	dgen = atomic_read(&UNIONFS_D(dentry)->generation);
-	if (is_newer_lower(dentry)) {
+
+	if (unlikely(is_newer_lower(dentry))) {
 		/* root dentry special case as aforementioned */
 		if (IS_ROOT(dentry))
 			unionfs_copy_attr_times(dentry->d_inode);
@@ -425,7 +426,7 @@ static int unionfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
 	unionfs_lock_dentry(dentry);
 	err = __unionfs_d_revalidate_chain(dentry, nd, false);
 	unionfs_unlock_dentry(dentry);
-	if (err > 0) { /* true==1: dentry is valid */
+	if (likely(err > 0)) { /* true==1: dentry is valid */
 		unionfs_check_dentry(dentry);
 		unionfs_check_nd(nd);
 	}
@@ -447,7 +448,7 @@ static void unionfs_d_release(struct dentry *dentry)
 
 	unionfs_check_dentry(dentry);
 	/* this could be a negative dentry, so check first */
-	if (!UNIONFS_D(dentry)) {
+	if (unlikely(!UNIONFS_D(dentry))) {
 		printk(KERN_DEBUG "unionfs: dentry without private data: %.*s\n",
 		       dentry->d_name.len, dentry->d_name.name);
 		goto out;
diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index c923e58..200fb55 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -99,7 +99,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
 
-	if ((err = unionfs_file_revalidate(file, false)))
+	if (unlikely((err = unionfs_file_revalidate(file, false))))
 		goto out;
 
 	inode = file->f_path.dentry->d_inode;
@@ -110,7 +110,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
 			goto out;
 		} else if (file->f_pos > 0) {
 			uds = find_rdstate(inode, file->f_pos);
-			if (!uds) {
+			if (unlikely(!uds)) {
 				err = -ESTALE;
 				goto out;
 			}
@@ -201,7 +201,7 @@ static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
 
-	if ((err = unionfs_file_revalidate(file, false)))
+	if (unlikely((err = unionfs_file_revalidate(file, false))))
 		goto out;
 
 	rdstate = UNIONFS_F(file)->rdstate;
diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index a72f711..f0e1fee 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -43,7 +43,7 @@ int do_delete_whiteouts(struct dentry *dentry, int bindex,
 
 	err = -ENOMEM;
 	name = __getname();
-	if (!name)
+	if (unlikely(!name))
 		goto out;
 	strcpy(name, UNIONFS_WHPFX);
 	p = name + UNIONFS_WHLEN;
@@ -204,14 +204,14 @@ int check_empty(struct dentry *dentry, struct unionfs_dir_state **namelist)
 		bend = bopaque;
 
 	buf = kmalloc(sizeof(struct unionfs_rdutil_callback), GFP_KERNEL);
-	if (!buf) {
+	if (unlikely(!buf)) {
 		err = -ENOMEM;
 		goto out;
 	}
 	buf->err = 0;
 	buf->mode = RD_CHECK_EMPTY;
 	buf->rdstate = alloc_rdstate(dentry->d_inode, bstart);
-	if (!buf->rdstate) {
+	if (unlikely(!buf->rdstate)) {
 		err = -ENOMEM;
 		goto out;
 	}
diff --git a/fs/unionfs/fanout.h b/fs/unionfs/fanout.h
index 51aa0de..536a51f 100644
--- a/fs/unionfs/fanout.h
+++ b/fs/unionfs/fanout.h
@@ -314,11 +314,11 @@ static inline void unionfs_copy_attr_times(struct inode *upper)
 		lower = unionfs_lower_inode_idx(upper, bindex);
 		if (!lower)
 			continue; /* not all lower dir objects may exist */
-		if (timespec_compare(&upper->i_mtime, &lower->i_mtime) < 0)
+		if (unlikely(timespec_compare(&upper->i_mtime, &lower->i_mtime) < 0))
 			upper->i_mtime = lower->i_mtime;
-		if (timespec_compare(&upper->i_ctime, &lower->i_ctime) < 0)
+		if (unlikely(timespec_compare(&upper->i_ctime, &lower->i_ctime) < 0))
 			upper->i_ctime = lower->i_ctime;
-		if (timespec_compare(&upper->i_atime, &lower->i_atime) < 0)
+		if (unlikely(timespec_compare(&upper->i_atime, &lower->i_atime) < 0))
 			upper->i_atime = lower->i_atime;
 	}
 }
diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c
index d8eaaa5..82959d1 100644
--- a/fs/unionfs/file.c
+++ b/fs/unionfs/file.c
@@ -24,7 +24,7 @@ static ssize_t unionfs_read(struct file *file, char __user *buf,
 	int err;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if ((err = unionfs_file_revalidate(file, false)))
+	if (unlikely((err = unionfs_file_revalidate(file, false))))
 		goto out;
 	unionfs_check_file(file);
 
@@ -47,7 +47,7 @@ static ssize_t unionfs_aio_read(struct kiocb *iocb, const struct iovec *iov,
 	struct file *file = iocb->ki_filp;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if ((err = unionfs_file_revalidate(file, false)))
+	if (unlikely((err = unionfs_file_revalidate(file, false))))
 		goto out;
 	unionfs_check_file(file);
 
@@ -72,7 +72,7 @@ static ssize_t unionfs_write(struct file *file, const char __user *buf,
 	int err = 0;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if ((err = unionfs_file_revalidate(file, true)))
+	if (unlikely((err = unionfs_file_revalidate(file, true))))
 		goto out;
 	unionfs_check_file(file);
 
@@ -104,7 +104,7 @@ static int unionfs_mmap(struct file *file, struct vm_area_struct *vma)
 
 	/* This might be deferred to mmap's writepage */
 	willwrite = ((vma->vm_flags | VM_SHARED | VM_WRITE) == vma->vm_flags);
-	if ((err = unionfs_file_revalidate(file, willwrite)))
+	if (unlikely((err = unionfs_file_revalidate(file, willwrite))))
 		goto out;
 	unionfs_check_file(file);
 
@@ -149,7 +149,7 @@ int unionfs_fsync(struct file *file, struct dentry *dentry, int datasync)
 	int err = -EINVAL;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if ((err = unionfs_file_revalidate(file, true)))
+	if (unlikely((err = unionfs_file_revalidate(file, true))))
 		goto out;
 	unionfs_check_file(file);
 
@@ -159,7 +159,7 @@ int unionfs_fsync(struct file *file, struct dentry *dentry, int datasync)
 		goto out;
 
 	inode = dentry->d_inode;
-	if (!inode) {
+	if (unlikely(!inode)) {
 		printk(KERN_ERR
 		       "unionfs: null lower inode in unionfs_fsync\n");
 		goto out;
@@ -196,7 +196,7 @@ int unionfs_fasync(int fd, struct file *file, int flag)
 	int err = 0;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if ((err = unionfs_file_revalidate(file, true)))
+	if (unlikely((err = unionfs_file_revalidate(file, true))))
 		goto out;
 	unionfs_check_file(file);
 
@@ -207,7 +207,7 @@ int unionfs_fasync(int fd, struct file *file, int flag)
 
 	dentry = file->f_path.dentry;
 	inode = dentry->d_inode;
-	if (!inode) {
+	if (unlikely(!inode)) {
 		printk(KERN_ERR
 		       "unionfs: null lower inode in unionfs_fasync\n");
 		goto out;
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 7ee4760..021e206 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -35,7 +35,7 @@ static int unionfs_create(struct inode *parent, struct dentry *dentry,
 	unionfs_lock_dentry(dentry->d_parent);
 	valid = __unionfs_d_revalidate_chain(dentry->d_parent, nd, false);
 	unionfs_unlock_dentry(dentry->d_parent);
-	if (!valid) {
+	if (unlikely(!valid)) {
 		err = -ESTALE;	/* same as what real_lookup does */
 		goto out;
 	}
@@ -66,7 +66,7 @@ static int unionfs_create(struct inode *parent, struct dentry *dentry,
 		 * first.
 		 */
 		name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
-		if (IS_ERR(name)) {
+		if (unlikely(IS_ERR(name))) {
 			err = PTR_ERR(name);
 			goto out;
 		}
@@ -115,7 +115,7 @@ static int unionfs_create(struct inode *parent, struct dentry *dentry,
 	}
 
 	err = init_lower_nd(&lower_nd, LOOKUP_CREATE);
-	if (err < 0)
+	if (unlikely(err < 0))
 		goto out;
 	err = vfs_create(lower_parent_dentry->d_inode, lower_dentry, mode,
 			 &lower_nd);
@@ -213,12 +213,12 @@ static int unionfs_link(struct dentry *old_dentry, struct inode *dir,
 	unionfs_read_lock(old_dentry->d_sb);
 	unionfs_double_lock_dentry(new_dentry, old_dentry);
 
-	if (!__unionfs_d_revalidate_chain(old_dentry, NULL, false)) {
+	if (unlikely(!__unionfs_d_revalidate_chain(old_dentry, NULL, false))) {
 		err = -ESTALE;
 		goto out;
 	}
-	if (new_dentry->d_inode &&
-	    !__unionfs_d_revalidate_chain(new_dentry, NULL, false)) {
+	if (unlikely(new_dentry->d_inode &&
+		     !__unionfs_d_revalidate_chain(new_dentry, NULL, false))) {
 		err = -ESTALE;
 		goto out;
 	}
@@ -230,7 +230,7 @@ static int unionfs_link(struct dentry *old_dentry, struct inode *dir,
 	 * .wh.foo first. If present, delete it
 	 */
 	name = alloc_whname(new_dentry->d_name.name, new_dentry->d_name.len);
-	if (IS_ERR(name)) {
+	if (unlikely(IS_ERR(name))) {
 		err = PTR_ERR(name);
 		goto out;
 	}
@@ -362,8 +362,8 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,
 	unionfs_read_lock(dentry->d_sb);
 	unionfs_lock_dentry(dentry);
 
-	if (dentry->d_inode &&
-	    !__unionfs_d_revalidate_chain(dentry, NULL, false)) {
+	if (unlikely(dentry->d_inode &&
+		     !__unionfs_d_revalidate_chain(dentry, NULL, false))) {
 		err = -ESTALE;
 		goto out;
 	}
@@ -378,7 +378,7 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,
 	 * first. If present, delete it
 	 */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
-	if (IS_ERR(name)) {
+	if (unlikely(IS_ERR(name))) {
 		err = PTR_ERR(name);
 		goto out;
 	}
@@ -522,8 +522,8 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode)
 	unionfs_read_lock(dentry->d_sb);
 	unionfs_lock_dentry(dentry);
 
-	if (dentry->d_inode &&
-	    !__unionfs_d_revalidate_chain(dentry, NULL, false)) {
+	if (unlikely(dentry->d_inode &&
+		     !__unionfs_d_revalidate_chain(dentry, NULL, false))) {
 		err = -ESTALE;
 		goto out;
 	}
@@ -537,7 +537,7 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode)
 	 * first.
 	 */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
-	if (IS_ERR(name)) {
+	if (unlikely(IS_ERR(name))) {
 		err = PTR_ERR(name);
 		goto out;
 	}
@@ -672,8 +672,8 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
 	unionfs_read_lock(dentry->d_sb);
 	unionfs_lock_dentry(dentry);
 
-	if (dentry->d_inode &&
-	    !__unionfs_d_revalidate_chain(dentry, NULL, false)) {
+	if (unlikely(dentry->d_inode &&
+		     !__unionfs_d_revalidate_chain(dentry, NULL, false))) {
 		err = -ESTALE;
 		goto out;
 	}
@@ -687,7 +687,7 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
 	 * first.
 	 */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
-	if (IS_ERR(name)) {
+	if (unlikely(IS_ERR(name))) {
 		err = PTR_ERR(name);
 		goto out;
 	}
@@ -797,7 +797,7 @@ static int unionfs_readlink(struct dentry *dentry, char __user *buf,
 	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;
 	}
@@ -844,7 +844,7 @@ static void *unionfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 
 	/* This is freed by the put_link method assuming a successful call. */
 	buf = kmalloc(len, GFP_KERNEL);
-	if (!buf) {
+	if (unlikely(!buf)) {
 		err = -ENOMEM;
 		goto out;
 	}
@@ -877,7 +877,7 @@ static void unionfs_put_link(struct dentry *dentry, struct nameidata *nd,
 	unionfs_read_lock(dentry->d_sb);
 
 	unionfs_lock_dentry(dentry);
-	if (!__unionfs_d_revalidate_chain(dentry, nd, false))
+	if (unlikely(!__unionfs_d_revalidate_chain(dentry, nd, false)))
 		printk("unionfs: put_link failed to revalidate dentry\n");
 	unionfs_unlock_dentry(dentry);
 
@@ -959,7 +959,7 @@ static int unionfs_permission(struct inode *inode, int mask,
 
 	bstart = ibstart(inode);
 	bend = ibend(inode);
-	if (bstart < 0 || bend < 0) {
+	if (unlikely(bstart < 0 || bend < 0)) {
 		/*
 		 * With branch-management, we can get a stale inode here.
 		 * If so, we return ESTALE back to link_path_walk, which
@@ -1030,7 +1030,7 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia)
 	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;
 	}
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 2109714..94e4c8e 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -119,12 +119,12 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
 	case INTERPOSE_PARTIAL:
 		break;
 	case INTERPOSE_LOOKUP:
-		if ((err = new_dentry_private_data(dentry)))
+		if (unlikely((err = new_dentry_private_data(dentry))))
 			goto out;
 		break;
 	default:
 		/* default: can only be INTERPOSE_REVAL/REVAL_NEG */
-		if ((err = realloc_dentry_private_data(dentry)))
+		if (unlikely((err = realloc_dentry_private_data(dentry))))
 			goto out;
 		break;
 	}
@@ -189,7 +189,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
 		/* Reuse the whiteout name because its value doesn't change. */
 		if (!whname) {
 			whname = alloc_whname(name, namelen);
-			if (IS_ERR(whname)) {
+			if (unlikely(IS_ERR(whname))) {
 				err = PTR_ERR(whname);
 				goto out_free;
 			}
@@ -498,7 +498,7 @@ static inline int __realloc_dentry_private_data(struct dentry *dentry)
 
 	size = sizeof(struct path) * sbmax(dentry->d_sb);
 	p = krealloc(info->lower_paths, size, GFP_ATOMIC);
-	if (!p)
+	if (unlikely(!p))
 		return -ENOMEM;
 
 	info->lower_paths = p;
@@ -534,7 +534,7 @@ int new_dentry_private_data(struct dentry *dentry)
 	BUG_ON(info);
 
 	info = kmem_cache_alloc(unionfs_dentry_cachep, GFP_ATOMIC);
-	if (!info)
+	if (unlikely(!info))
 		return -ENOMEM;
 
 	mutex_init(&info->lock);
@@ -614,7 +614,7 @@ int init_lower_nd(struct nameidata *nd, unsigned int flags)
 		nd->intent.open.flags |= (FMODE_READ | FMODE_WRITE);
 #ifdef ALLOC_LOWER_ND_FILE
 		file = kzalloc(sizeof(struct file), GFP_KERNEL);
-		if (!file) {
+		if (unlikely(!file)) {
 			err = -ENOMEM;
 			break; /* exit switch statement and thus return */
 		}
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 8595750..72438fb 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -122,7 +122,7 @@ struct dentry *unionfs_interpose(struct dentry *dentry, struct super_block *sb,
 
 		UNIONFS_I(inode)->lower_inodes =
 			kcalloc(sbmax(sb), sizeof(struct inode *), GFP_KERNEL);
-		if (!UNIONFS_I(inode)->lower_inodes) {
+		if (unlikely(!UNIONFS_I(inode)->lower_inodes)) {
 			err = -ENOMEM;
 			goto out;
 		}
@@ -319,14 +319,14 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info
 	/* allocate space for underlying pointers to lower dentry */
 	UNIONFS_SB(sb)->data =
 		kcalloc(branches, sizeof(struct unionfs_data), GFP_KERNEL);
-	if (!UNIONFS_SB(sb)->data) {
+	if (unlikely(!UNIONFS_SB(sb)->data)) {
 		err = -ENOMEM;
 		goto out;
 	}
 
 	lower_root_info->lower_paths =
 		kcalloc(branches, sizeof(struct path), GFP_KERNEL);
-	if (!lower_root_info->lower_paths) {
+	if (unlikely(!lower_root_info->lower_paths)) {
 		err = -ENOMEM;
 		goto out;
 	}
@@ -462,7 +462,7 @@ static struct unionfs_dentry_info *unionfs_parse_options(
 	err = -ENOMEM;
 	lower_root_info =
 		kzalloc(sizeof(struct unionfs_dentry_info), GFP_KERNEL);
-	if (!lower_root_info)
+	if (unlikely(!lower_root_info))
 		goto out_error;
 	lower_root_info->bstart = -1;
 	lower_root_info->bend = -1;
@@ -567,7 +567,7 @@ static struct dentry *unionfs_d_alloc_root(struct super_block *sb)
 		static const struct qstr name = {.name = "/",.len = 1 };
 
 		ret = d_alloc(NULL, &name);
-		if (ret) {
+		if (likely(ret)) {
 			ret->d_op = &unionfs_dops;
 			ret->d_sb = sb;
 			ret->d_parent = ret;
@@ -596,7 +596,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,
 
 	/* Allocate superblock private data */
 	sb->s_fs_info = kzalloc(sizeof(struct unionfs_sb_info), GFP_KERNEL);
-	if (!UNIONFS_SB(sb)) {
+	if (unlikely(!UNIONFS_SB(sb))) {
 		printk(KERN_WARNING "unionfs: read_super: out of memory\n");
 		err = -ENOMEM;
 		goto out;
@@ -637,14 +637,14 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,
 
 	/* See comment next to the definition of unionfs_d_alloc_root */
 	sb->s_root = unionfs_d_alloc_root(sb);
-	if (!sb->s_root) {
+	if (unlikely(!sb->s_root)) {
 		err = -ENOMEM;
 		goto out_dput;
 	}
 
 	/* link the upper and lower dentries */
 	sb->s_root->d_fsdata = NULL;
-	if ((err = new_dentry_private_data(sb->s_root)))
+	if (unlikely((err = new_dentry_private_data(sb->s_root))))
 		goto out_freedpd;
 
 	/* Set the lower dentries for s_root */
@@ -734,17 +734,17 @@ static int __init init_unionfs_fs(void)
 
 	printk("Registering unionfs " UNIONFS_VERSION "\n");
 
-	if ((err = unionfs_init_filldir_cache()))
+	if (unlikely((err = unionfs_init_filldir_cache())))
 		goto out;
-	if ((err = unionfs_init_inode_cache()))
+	if (unlikely((err = unionfs_init_inode_cache())))
 		goto out;
-	if ((err = unionfs_init_dentry_cache()))
+	if (unlikely((err = unionfs_init_dentry_cache())))
 		goto out;
-	if ((err = init_sioq()))
+	if (unlikely((err = init_sioq())))
 		goto out;
 	err = register_filesystem(&unionfs_fs_type);
 out:
-	if (err) {
+	if (unlikely(err)) {
 		stop_sioq();
 		unionfs_destroy_filldir_cache();
 		unionfs_destroy_inode_cache();
diff --git a/fs/unionfs/mmap.c b/fs/unionfs/mmap.c
index 37af979..bcd4267 100644
--- a/fs/unionfs/mmap.c
+++ b/fs/unionfs/mmap.c
@@ -212,7 +212,7 @@ static int unionfs_readpage(struct file *file, struct page *page)
 	int err;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if ((err = unionfs_file_revalidate(file, false)))
+	if (unlikely((err = unionfs_file_revalidate(file, false))))
 		goto out;
 	unionfs_check_file(file);
 
@@ -276,7 +276,7 @@ static int unionfs_commit_write(struct file *file, struct page *page,
 	BUG_ON(file == NULL);
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if ((err = unionfs_file_revalidate(file, true)))
+	if (unlikely((err = unionfs_file_revalidate(file, true))))
 		goto out;
 	unionfs_check_file(file);
 
diff --git a/fs/unionfs/rdstate.c b/fs/unionfs/rdstate.c
index 0a18d5c..0fdd364 100644
--- a/fs/unionfs/rdstate.c
+++ b/fs/unionfs/rdstate.c
@@ -136,7 +136,7 @@ struct unionfs_dir_state *alloc_rdstate(struct inode *inode, int bindex)
 		sizeof(struct list_head);
 
 	rdstate = kmalloc(mallocsize, GFP_KERNEL);
-	if (!rdstate)
+	if (unlikely(!rdstate))
 		return NULL;
 
 	spin_lock(&UNIONFS_I(inode)->rdlock);
@@ -217,7 +217,7 @@ struct filldir_node *find_filldir_node(struct unionfs_dir_state *rdstate,
 			 * if the duplicate is in this branch, then the file
 			 * system is corrupted.
 			 */
-			if (cursor->bindex == rdstate->bindex) {
+			if (unlikely(cursor->bindex == rdstate->bindex)) {
 				printk(KERN_DEBUG "unionfs: filldir: possible "
 				       "I/O error: a file is duplicated "
 				       "in the same branch %d: %s\n",
@@ -249,7 +249,7 @@ int add_filldir_node(struct unionfs_dir_state *rdstate, const char *name,
 	head = &(rdstate->list[index]);
 
 	new = kmem_cache_alloc(unionfs_filldir_cachep, GFP_KERNEL);
-	if (!new) {
+	if (unlikely(!new)) {
 		err = -ENOMEM;
 		goto out;
 	}
@@ -264,7 +264,7 @@ int add_filldir_node(struct unionfs_dir_state *rdstate, const char *name,
 		new->name = new->iname;
 	else {
 		new->name = kmalloc(namelen + 1, GFP_KERNEL);
-		if (!new->name) {
+		if (unlikely(!new->name)) {
 			kmem_cache_free(unionfs_filldir_cachep, new);
 			new = NULL;
 			goto out;
diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index 7b8fe39..226bcea 100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -50,7 +50,7 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 
 	wh_name = alloc_whname(new_dentry->d_name.name,
 			       new_dentry->d_name.len);
-	if (IS_ERR(wh_name)) {
+	if (unlikely(IS_ERR(wh_name))) {
 		err = PTR_ERR(wh_name);
 		goto out;
 	}
@@ -105,7 +105,7 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		whname = alloc_whname(old_dentry->d_name.name,
 				      old_dentry->d_name.len);
 		err = PTR_ERR(whname);
-		if (IS_ERR(whname))
+		if (unlikely(IS_ERR(whname)))
 			goto out_unlock;
 		*wh_old = lookup_one_len(whname, lower_old_dir_dentry,
 					 old_dentry->d_name.len +
@@ -265,7 +265,7 @@ static int do_unionfs_rename(struct inode *old_dir,
 			goto out;
 		}
 		err = init_lower_nd(&nd, LOOKUP_CREATE);
-		if (err < 0)
+		if (unlikely(err < 0))
 			goto out;
 		lower_parent = lock_parent(wh_old);
 		local_err = vfs_create(lower_parent->d_inode, wh_old, S_IRUGO,
@@ -351,7 +351,7 @@ static struct dentry *lookup_whiteout(struct dentry *dentry)
 	struct dentry *parent, *lower_parent, *wh_dentry;
 
 	whname = alloc_whname(dentry->d_name.name, dentry->d_name.len);
-	if (IS_ERR(whname))
+	if (unlikely(IS_ERR(whname)))
 		return (void *)whname;
 
 	parent = dget_parent(dentry);
@@ -416,12 +416,12 @@ int unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	unionfs_read_lock(old_dentry->d_sb);
 	unionfs_double_lock_dentry(old_dentry, new_dentry);
 
-	if (!__unionfs_d_revalidate_chain(old_dentry, NULL, false)) {
+	if (unlikely(!__unionfs_d_revalidate_chain(old_dentry, NULL, false))) {
 		err = -ESTALE;
 		goto out;
 	}
-	if (!d_deleted(new_dentry) && new_dentry->d_inode &&
-	    !__unionfs_d_revalidate_chain(new_dentry, NULL, false)) {
+	if (unlikely(!d_deleted(new_dentry) && new_dentry->d_inode &&
+		     !__unionfs_d_revalidate_chain(new_dentry, NULL, false))) {
 		err = -ESTALE;
 		goto out;
 	}
diff --git a/fs/unionfs/subr.c b/fs/unionfs/subr.c
index 6b93b64..3183678 100644
--- a/fs/unionfs/subr.c
+++ b/fs/unionfs/subr.c
@@ -40,7 +40,7 @@ int create_whiteout(struct dentry *dentry, int start)
 
 	/* create dentry's whiteout equivalent */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
-	if (IS_ERR(name)) {
+	if (unlikely(IS_ERR(name))) {
 		err = PTR_ERR(name);
 		goto out;
 	}
@@ -84,7 +84,7 @@ int create_whiteout(struct dentry *dentry, int start)
 		}
 
 		err = init_lower_nd(&nd, LOOKUP_CREATE);
-		if (err < 0)
+		if (unlikely(err < 0))
 			goto out;
 		lower_dir_dentry = lock_parent(lower_wh_dentry);
 		if (!(err = is_robranch_super(dentry->d_sb, bindex)))
@@ -172,7 +172,7 @@ int make_dir_opaque(struct dentry *dentry, int bindex)
 	}
 
 	err = init_lower_nd(&nd, LOOKUP_CREATE);
-	if (err < 0)
+	if (unlikely(err < 0))
 		goto out;
 	if (!diropq->d_inode)
 		err = vfs_create(lower_dir, diropq, S_IRUGO, &nd);
@@ -213,7 +213,7 @@ char *alloc_whname(const char *name, int len)
 	char *buf;
 
 	buf = kmalloc(len + UNIONFS_WHLEN + 1, GFP_KERNEL);
-	if (!buf)
+	if (unlikely(!buf))
 		return ERR_PTR(-ENOMEM);
 
 	strcpy(buf, UNIONFS_WHPFX);
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 4e0fe7c..1279df6 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -44,7 +44,7 @@ static void unionfs_read_inode(struct inode *inode)
 
 	size = sbmax(inode->i_sb) * sizeof(struct inode *);
 	info->lower_inodes = kzalloc(size, GFP_KERNEL);
-	if (!info->lower_inodes) {
+	if (unlikely(!info->lower_inodes)) {
 		printk(KERN_ERR "unionfs: no kernel memory when allocating "
 		       "lower-pointer array!\n");
 		BUG();
@@ -98,7 +98,7 @@ static void unionfs_put_super(struct super_block *sb)
 
 	/* Make sure we have no leaks of branchget/branchput. */
 	for (bindex = bstart; bindex <= bend; bindex++)
-		if (branch_count(sb, bindex) != 0) {
+		if (unlikely(branch_count(sb, bindex) != 0)) {
 			printk("unionfs: branch %d has %d references left!\n",
 			       bindex, branch_count(sb, bindex));
 			leaks = 1;
@@ -126,7 +126,7 @@ static int unionfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 	unionfs_read_lock(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;
 	}
@@ -474,7 +474,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,
 	 * strsep modifies the string and we need it later.
 	 */
 	optionstmp = tmp_to_free = kstrdup(options, GFP_KERNEL);
-	if (!optionstmp) {
+	if (unlikely(!optionstmp)) {
 		err = -ENOMEM;
 		goto out_free;
 	}
@@ -521,14 +521,14 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,
 	/* allocate space for new pointers to lower dentry */
 	tmp_data = kcalloc(max_branches,
 			   sizeof(struct unionfs_data), GFP_KERNEL);
-	if (!tmp_data) {
+	if (unlikely(!tmp_data)) {
 		err = -ENOMEM;
 		goto out_free;
 	}
 	/* allocate space for new pointers to lower paths */
 	tmp_lower_paths = kcalloc(max_branches,
 				  sizeof(struct path), GFP_KERNEL);
-	if (!tmp_lower_paths) {
+	if (unlikely(!tmp_lower_paths)) {
 		err = -ENOMEM;
 		goto out_free;
 	}
@@ -662,7 +662,7 @@ out_no_change:
 	/* (re)allocate space for new pointers to lower dentry */
 	size = new_branches * sizeof(struct unionfs_data);
 	new_data = krealloc(tmp_data, size, GFP_KERNEL);
-	if (!new_data) {
+	if (unlikely(!new_data)) {
 		err = -ENOMEM;
 		goto out_release;
 	}
@@ -670,7 +670,7 @@ out_no_change:
 	/* allocate space for new pointers to lower paths */
 	size = new_branches * sizeof(struct path);
 	new_lower_paths = krealloc(tmp_lower_paths, size, GFP_KERNEL);
-	if (!new_lower_paths) {
+	if (unlikely(!new_lower_paths)) {
 		err = -ENOMEM;
 		goto out_release;
 	}
@@ -678,7 +678,7 @@ out_no_change:
 	/* allocate space for new pointers to lower inodes */
 	new_lower_inodes = kcalloc(new_branches,
 				   sizeof(struct inode *), GFP_KERNEL);
-	if (!new_lower_inodes) {
+	if (unlikely(!new_lower_inodes)) {
 		err = -ENOMEM;
 		goto out_release;
 	}
@@ -841,7 +841,7 @@ static struct inode *unionfs_alloc_inode(struct super_block *sb)
 	struct unionfs_inode_info *i;
 
 	i = kmem_cache_alloc(unionfs_inode_cachep, GFP_KERNEL);
-	if (!i)
+	if (unlikely(!i))
 		return NULL;
 
 	/* memset everything up to the inode to 0 */
@@ -872,7 +872,7 @@ int unionfs_init_inode_cache(void)
 		kmem_cache_create("unionfs_inode_cache",
 				  sizeof(struct unionfs_inode_info), 0,
 				  SLAB_RECLAIM_ACCOUNT, init_once);
-	if (!unionfs_inode_cachep)
+	if (unlikely(!unionfs_inode_cachep))
 		err = -ENOMEM;
 	return err;
 }
@@ -959,7 +959,7 @@ static int unionfs_show_options(struct seq_file *m, struct vfsmount *mnt)
 	unionfs_lock_dentry(sb->s_root);
 
 	tmp_page = (char*) __get_free_page(GFP_KERNEL);
-	if (!tmp_page) {
+	if (unlikely(!tmp_page)) {
 		ret = -ENOMEM;
 		goto out;
 	}
diff --git a/fs/unionfs/unlink.c b/fs/unionfs/unlink.c
index 3924f7f..c5f6ed5 100644
--- a/fs/unionfs/unlink.c
+++ b/fs/unionfs/unlink.c
@@ -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;
 	}
@@ -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;
 	}
diff --git a/fs/unionfs/xattr.c b/fs/unionfs/xattr.c
index 7f77d7d..71ff7d0 100644
--- a/fs/unionfs/xattr.c
+++ b/fs/unionfs/xattr.c
@@ -30,7 +30,7 @@ void *unionfs_xattr_alloc(size_t size, size_t limit)
 		return NULL;
 
 	ptr = kmalloc(size, GFP_KERNEL);
-	if (!ptr)
+	if (unlikely(!ptr))
 		return ERR_PTR(-ENOMEM);
 	return ptr;
 }
@@ -48,7 +48,7 @@ ssize_t unionfs_getxattr(struct dentry *dentry, const char *name, void *value,
 	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;
 	}
@@ -77,7 +77,7 @@ int unionfs_setxattr(struct dentry *dentry, const char *name,
 	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;
 	}
@@ -106,7 +106,7 @@ int unionfs_removexattr(struct dentry *dentry, const char *name)
 	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;
 	}
@@ -135,7 +135,7 @@ ssize_t unionfs_listxattr(struct dentry *dentry, char *list, size_t size)
 	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;
 	}
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 03/19] Unionfs: minor comment cleanups
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
  2007-10-01  5:50 ` [PATCH 01/19] Unionfs: compile if debug is off Erez Zadok
  2007-10-01  5:50 ` [PATCH 02/19] Unionfs: add un/likely on conditionals Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 04/19] Unionfs: use consistent printk prefixes Erez Zadok
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

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

diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 94e4c8e..53668d6 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -206,7 +206,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
 		}
 
 		if (wh_lower_dentry->d_inode) {
-			/* We found a whiteout so lets give up. */
+			/* We found a whiteout so let's give up. */
 			if (S_ISREG(wh_lower_dentry->d_inode->i_mode)) {
 				set_dbend(dentry, bindex);
 				set_dbopaque(dentry, bindex);
diff --git a/fs/unionfs/mmap.c b/fs/unionfs/mmap.c
index bcd4267..cf9545e 100644
--- a/fs/unionfs/mmap.c
+++ b/fs/unionfs/mmap.c
@@ -293,7 +293,7 @@ static int unionfs_commit_write(struct file *file, struct page *page,
 	lower_file->f_pos = ((loff_t) page->index << PAGE_CACHE_SHIFT) + from;
 
 	/*
-	 * SP: I use vfs_write instead of copying page data and the
+	 * We use vfs_write instead of copying page data and the
 	 * prepare_write/commit_write combo because file system's like
 	 * GFS/OCFS2 don't like things touching those directly,
 	 * calling the underlying write op, while a little bit slower, will
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 04/19] Unionfs: use consistent printk prefixes
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (2 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 03/19] Unionfs: minor comment cleanups Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 05/19] Unionfs: use UNIONFS_NAME macro Erez Zadok
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/inode.c |    4 ++--
 fs/unionfs/union.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 021e206..ba85a67 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -90,7 +90,7 @@ static int unionfs_create(struct inode *parent, struct dentry *dentry,
 			unlock_dir(lower_dir_dentry);
 
 			if (err) {
-				printk("unionfs_create: could not unlink "
+				printk("unionfs: create: could not unlink "
 				       "whiteout, err = %d\n", err);
 				goto out;
 			}
@@ -1088,7 +1088,7 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia)
 		if (ia->ia_size != i_size_read(inode)) {
 			err = vmtruncate(inode, ia->ia_size);
 			if (err)
-				printk("unionfs_setattr: vmtruncate failed\n");
+				printk("unionfs: setattr: vmtruncate failed\n");
 		}
 	}
 
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 7ce4771..91f7f1e 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -474,7 +474,7 @@ static inline struct vfsmount *unionfs_mntget(struct dentry *dentry,
 	mnt = mntget(unionfs_lower_mnt_idx(dentry, bindex));
 #ifdef CONFIG_UNION_FS_DEBUG
 	if (!mnt)
-		printk(KERN_DEBUG "unionfs_mntget: mnt=%p bindex=%d\n",
+		printk(KERN_DEBUG "unionfs: mntget: mnt=%p bindex=%d\n",
 		       mnt, bindex);
 #endif /* CONFIG_UNION_FS_DEBUG */
 
@@ -500,7 +500,7 @@ static inline void unionfs_mntput(struct dentry *dentry, int bindex)
 	 */
 	if (!mnt && !(bindex > dbstart(dentry) && bindex < dbend(dentry)))
 		printk(KERN_WARNING
-		       "unionfs_mntput: mnt=%p bindex=%d\n",
+		       "unionfs: mntput: mnt=%p bindex=%d\n",
 		       mnt, bindex);
 #endif /* CONFIG_UNION_FS_DEBUG */
 	mntput(mnt);
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 05/19] Unionfs: use UNIONFS_NAME macro
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (3 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 04/19] Unionfs: use consistent printk prefixes Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 06/19] Unionfs: properly indent static struct Erez Zadok
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/debug.c |    2 +-
 fs/unionfs/main.c  |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
index b103eb9..da82a47 100644
--- a/fs/unionfs/debug.c
+++ b/fs/unionfs/debug.c
@@ -428,7 +428,7 @@ void __unionfs_check_nd(const struct nameidata *nd,
 		file = nd->intent.open.file;
 		if (unlikely(file->f_path.dentry &&
 			     strcmp(file->f_dentry->d_sb->s_type->name,
-				    "unionfs"))) {
+				    UNIONFS_NAME))) {
 			PRINT_CALLER(fname, fxn, line);
 			printk(" CND1: lower_file of type %s\n",
 			       file->f_path.dentry->d_sb->s_type->name);
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 72438fb..615617a 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -227,7 +227,7 @@ void unionfs_reinterpose(struct dentry *dentry)
 int check_branch(struct nameidata *nd)
 {
 	/* XXX: remove in ODF code -- stacking unions allowed there */
-	if (!strcmp(nd->dentry->d_sb->s_type->name, "unionfs"))
+	if (!strcmp(nd->dentry->d_sb->s_type->name, UNIONFS_NAME))
 		return -EINVAL;
 	if (!nd->dentry->d_inode)
 		return -ENOENT;
@@ -722,7 +722,7 @@ static int unionfs_get_sb(struct file_system_type *fs_type,
 
 static struct file_system_type unionfs_fs_type = {
 	.owner		= THIS_MODULE,
-	.name		= "unionfs",
+	.name		= UNIONFS_NAME,
 	.get_sb		= unionfs_get_sb,
 	.kill_sb	= generic_shutdown_super,
 	.fs_flags	= FS_REVAL_DOT,
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 06/19] Unionfs: properly indent static struct
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (4 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 05/19] Unionfs: use UNIONFS_NAME macro Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 07/19] Unionfs: remove unnecessary if condition Erez Zadok
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

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

diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 615617a..5c7f672 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -564,7 +564,10 @@ static struct dentry *unionfs_d_alloc_root(struct super_block *sb)
 	struct dentry *ret = NULL;
 
 	if (sb) {
-		static const struct qstr name = {.name = "/",.len = 1 };
+		static const struct qstr name = {
+			.name = "/",
+			.len = 1
+		};
 
 		ret = d_alloc(NULL, &name);
 		if (likely(ret)) {
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 07/19] Unionfs: remove unnecessary if condition
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (5 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 06/19] Unionfs: properly indent static struct Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 08/19] Unionfs: use page_offset() helper Erez Zadok
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

The condition is always true there.

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

diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index 200fb55..da0fcdb 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -63,12 +63,10 @@ static int unionfs_filldir(void *dirent, const char *name, int namelen,
 		off_t pos = rdstate2offset(buf->rdstate);
 		u64 unionfs_ino = ino;
 
-		if (!err) {
-			err = buf->filldir(buf->dirent, name, namelen, pos,
-					   unionfs_ino, d_type);
-			buf->rdstate->offset++;
-			verify_rdstate_offset(buf->rdstate);
-		}
+		err = buf->filldir(buf->dirent, name, namelen, pos,
+				   unionfs_ino, d_type);
+		buf->rdstate->offset++;
+		verify_rdstate_offset(buf->rdstate);
 	}
 	/*
 	 * If we did fill it, stuff it in our hash, otherwise return an
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 08/19] Unionfs: use page_offset() helper
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (6 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 07/19] Unionfs: remove unnecessary if condition Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 09/19] Unionfs: use pr_debug() instead of custom dprintk() Erez Zadok
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

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

diff --git a/fs/unionfs/mmap.c b/fs/unionfs/mmap.c
index cf9545e..8928e99 100644
--- a/fs/unionfs/mmap.c
+++ b/fs/unionfs/mmap.c
@@ -179,8 +179,7 @@ static int unionfs_do_readpage(struct file *file, struct page *page)
 	 * may be a little slower, but a lot safer, as the VFS does a lot of
 	 * the necessary magic for us.
 	 */
-	offset = lower_file->f_pos =
-		((loff_t) page->index << PAGE_CACHE_SHIFT);
+	offset = lower_file->f_pos = page_offset(page);
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
 	err = vfs_read(lower_file, page_data, PAGE_CACHE_SIZE,
@@ -290,7 +289,7 @@ static int unionfs_commit_write(struct file *file, struct page *page,
 	BUG_ON(lower_file == NULL);
 
 	page_data = (char *)kmap(page);
-	lower_file->f_pos = ((loff_t) page->index << PAGE_CACHE_SHIFT) + from;
+	lower_file->f_pos = page_offset(page) + from;
 
 	/*
 	 * We use vfs_write instead of copying page data and the
@@ -312,7 +311,7 @@ static int unionfs_commit_write(struct file *file, struct page *page,
 
 	inode->i_blocks = lower_inode->i_blocks;
 	/* we may have to update i_size */
-	pos = ((loff_t) page->index << PAGE_CACHE_SHIFT) + to;
+	pos = page_offset(page) + to;
 	if (pos > i_size_read(inode))
 		i_size_write(inode, pos);
 	/* if vfs_write succeeded above, sync up our times */
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 09/19] Unionfs: use pr_debug() instead of custom dprintk()
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (7 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 08/19] Unionfs: use page_offset() helper Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 10/19] Unionfs: convert all appropriate printk's to pr_debug calls Erez Zadok
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Also turn on DEBUG if CONFIG_UNION_FS_DEBUG is on

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/Makefile     |    4 ++++
 fs/unionfs/commonfops.c |    4 ++--
 fs/unionfs/dentry.c     |    6 +++---
 fs/unionfs/lookup.c     |    2 +-
 fs/unionfs/union.h      |    6 +-----
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/fs/unionfs/Makefile b/fs/unionfs/Makefile
index 38fed90..17ca4a7 100644
--- a/fs/unionfs/Makefile
+++ b/fs/unionfs/Makefile
@@ -7,3 +7,7 @@ unionfs-y := subr.o dentry.o file.o inode.o main.o super.o \
 unionfs-$(CONFIG_UNION_FS_XATTR) += xattr.o
 
 unionfs-$(CONFIG_UNION_FS_DEBUG) += debug.o
+
+ifeq ($(CONFIG_UNION_FS_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 8550a34..16df572 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -394,8 +394,8 @@ int unionfs_file_revalidate(struct file *file, bool willwrite)
 	if (willwrite && IS_WRITE_FLAG(file->f_flags) &&
 	    !IS_WRITE_FLAG(unionfs_lower_file(file)->f_flags) &&
 	    is_robranch(dentry)) {
-		dprintk(KERN_DEBUG "unionfs: do delay copyup of \"%s\"\n",
-			dentry->d_name.name);
+		pr_debug("unionfs: do delay copyup of \"%s\"\n",
+			 dentry->d_name.name);
 		err = do_delayed_copyup(file);
 	}
 
diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 89f6a91..5dde6af 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -46,9 +46,9 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry,
 
 	/* if the dentry is unhashed, do NOT revalidate */
 	if (d_deleted(dentry)) {
-		dprintk(KERN_DEBUG "unionfs: unhashed dentry being "
-			"revalidated: %*s\n",
-			dentry->d_name.len, dentry->d_name.name);
+		pr_debug("unionfs: unhashed dentry being "
+			 "revalidated: %*s\n",
+			 dentry->d_name.len, dentry->d_name.name);
 		goto out;
 	}
 
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 53668d6..9c6fd56 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -629,7 +629,7 @@ int init_lower_nd(struct nameidata *nd, unsigned int flags)
 		 * We should never get here, for now.
 		 * We can add new cases here later on.
 		 */
-		dprintk("unionfs: unknown nameidata flag 0x%x\n", flags);
+		pr_debug("unionfs: unknown nameidata flag 0x%x\n", flags);
 		BUG();
 		break;
 	}
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 91f7f1e..4e3cb53 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -508,10 +508,8 @@ static inline void unionfs_mntput(struct dentry *dentry, int bindex)
 
 #ifdef CONFIG_UNION_FS_DEBUG
 
-#define dprintk(args...)		printk(args)
-
 /* useful for tracking code reachability */
-#define UDBG printk("DBG:%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__)
+#define UDBG pr_debug("DBG:%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__)
 
 #define unionfs_check_inode(i)	__unionfs_check_inode((i),	\
 	__FILE__,__FUNCTION__,__LINE__)
@@ -550,8 +548,6 @@ extern void __show_inode_counts(const struct inode *inode,
 
 #else /* not CONFIG_UNION_FS_DEBUG */
 
-#define dprintk(args...)		do { } while (0)
-
 /* we leave useful hooks for these check functions throughout the code */
 #define unionfs_check_inode(i)		do { } while(0)
 #define unionfs_check_dentry(d)		do { } while(0)
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 10/19] Unionfs: convert all appropriate printk's to pr_debug calls
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (8 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 09/19] Unionfs: use pr_debug() instead of custom dprintk() Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 11/19] Unionfs: add missing newlines in printk's Erez Zadok
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/commonfops.c |   14 ++--
 fs/unionfs/debug.c      |  248 +++++++++++++++++++++++-----------------------
 fs/unionfs/union.h      |    8 +-
 3 files changed, 134 insertions(+), 136 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 16df572..278aa5d 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -59,8 +59,8 @@ retry:
 		counter++;
 		sprintf(suffix, "%*.*x", countersize, countersize, counter);
 
-		printk(KERN_DEBUG "unionfs: trying to rename %s to %s\n",
-		       dentry->d_name.name, name);
+		pr_debug("unionfs: trying to rename %s to %s\n",
+			 dentry->d_name.name, name);
 
 		tmp_dentry = lookup_one_len(name, lower_dentry->d_parent,
 					    nlen);
@@ -637,11 +637,11 @@ int unionfs_file_release(struct inode *inode, struct file *file)
 
 	if (fileinfo->rdstate) {
 		fileinfo->rdstate->access = jiffies;
-		printk(KERN_DEBUG "unionfs: saving rdstate with cookie "
-		       "%u [%d.%lld]\n",
-		       fileinfo->rdstate->cookie,
-		       fileinfo->rdstate->bindex,
-		       (long long)fileinfo->rdstate->dirpos);
+		pr_debug("unionfs: saving rdstate with cookie "
+			 "%u [%d.%lld]\n",
+			 fileinfo->rdstate->cookie,
+			 fileinfo->rdstate->bindex,
+			 (long long)fileinfo->rdstate->dirpos);
 		spin_lock(&inodeinfo->rdlock);
 		inodeinfo->rdcount++;
 		list_add_tail(&fileinfo->rdstate->cache,
diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
index da82a47..984f940 100644
--- a/fs/unionfs/debug.c
+++ b/fs/unionfs/debug.c
@@ -20,7 +20,7 @@
 #define PRINT_CALLER(fname, fxn, line)					\
 	do {								\
 		if (!printed_caller) {					\
-			printk("PC:%s:%s:%d\n",(fname),(fxn),(line));	\
+			pr_debug("PC:%s:%s:%d\n",(fname),(fxn),(line));	\
 			printed_caller = 1;				\
 		}							\
 	} while (0)
@@ -51,32 +51,32 @@ void __unionfs_check_inode(const struct inode *inode,
 	iend = ibend(inode);
 	if (unlikely(istart > iend)) {
 		PRINT_CALLER(fname, fxn, line);
-		printk(" Ci0: inode=%p istart/end=%d:%d\n",
-		       inode, istart, iend);
+		pr_debug(" Ci0: inode=%p istart/end=%d:%d\n",
+			 inode, istart, iend);
 	}
 	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);
+		pr_debug(" Ci1: inode=%p istart/end=%d:%d\n",
+			 inode, istart, iend);
 	}
 	if (!S_ISDIR(inode->i_mode)) {
 		if (unlikely(iend != istart)) {
 			PRINT_CALLER(fname, fxn, line);
-			printk(" Ci2: inode=%p istart=%d iend=%d\n",
-			       inode, istart, iend);
+			pr_debug(" Ci2: inode=%p istart=%d iend=%d\n",
+				 inode, istart, iend);
 		}
 	}
 
 	for (bindex = sbstart(sb); bindex < sbmax(sb); bindex++) {
 		if (unlikely(!UNIONFS_I(inode))) {
 			PRINT_CALLER(fname, fxn, line);
-			printk(" Ci3: no inode_info %p\n", inode);
+			pr_debug(" Ci3: no inode_info %p\n", inode);
 			return;
 		}
 		if (unlikely(!UNIONFS_I(inode)->lower_inodes)) {
 			PRINT_CALLER(fname, fxn, line);
-			printk(" Ci4: no lower_inodes %p\n", inode);
+			pr_debug(" Ci4: no lower_inodes %p\n", inode);
 			return;
 		}
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
@@ -84,15 +84,15 @@ void __unionfs_check_inode(const struct inode *inode,
 			memset(&poison_ptr, POISON_INUSE, sizeof(void *));
 			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);
+				pr_debug(" Ci5: inode/linode=%p:%p bindex=%d "
+					 "istart/end=%d:%d\n", inode,
+					 lower_inode, bindex, istart, iend);
 			} else if (unlikely(lower_inode == poison_ptr)) {
 				/* freed inode! */
 				PRINT_CALLER(fname, fxn, line);
-				printk(" Ci6: inode/linode=%p:%p bindex=%d "
-				       "istart/end=%d:%d\n", inode,
-				       lower_inode, bindex, istart, iend);
+				pr_debug(" Ci6: inode/linode=%p:%p bindex=%d "
+					 "istart/end=%d:%d\n", inode,
+					 lower_inode, bindex, istart, iend);
 			}
 		} else {	/* lower_inode == NULL */
 			if (bindex >= istart && bindex <= iend) {
@@ -105,10 +105,10 @@ void __unionfs_check_inode(const struct inode *inode,
 					       bindex > istart &&
 					       bindex < iend))) {
 					PRINT_CALLER(fname, fxn, line);
-					printk(" Ci7: inode/linode=%p:%p "
-					       "bindex=%d istart/end=%d:%d\n",
-					       inode, lower_inode, bindex,
-					       istart, iend);
+					pr_debug(" Ci7: inode/linode=%p:%p "
+						 "bindex=%d istart/end=%d:%d\n",
+						 inode, lower_inode, bindex,
+						 istart, iend);
 				}
 			}
 		}
@@ -137,8 +137,8 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 	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);
+		pr_debug(" CD0: dentry=%p dstart/end=%d:%d\n",
+			 dentry, dstart, dend);
 	}
 	/*
 	 * check for NULL dentries inside the start/end range, or
@@ -149,12 +149,12 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 		if (lower_dentry) {
 			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",
-				       dentry, lower_dentry,
-				       (lower_dentry ? lower_dentry->d_inode :
-					(void *) -1L),
-				       bindex, dstart, dend);
+				pr_debug(" CD1: dentry/lower=%p:%p(%p) "
+					 "bindex=%d dstart/end=%d:%d\n",
+					 dentry, lower_dentry,
+					 (lower_dentry ? lower_dentry->d_inode :
+					  (void *) -1L),
+					 bindex, dstart, dend);
 			}
 		} else {	/* lower_dentry == NULL */
 			if (bindex >= dstart && bindex <= dend) {
@@ -170,13 +170,13 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 					     !(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",
-					       dentry, lower_dentry,
-					       (lower_dentry ?
-						lower_dentry->d_inode :
-						(void *) -1L),
-					       bindex, dstart, dend);
+					pr_debug(" CD2: dentry/lower=%p:%p(%p) "
+						 "bindex=%d dstart/end=%d:%d\n",
+						 dentry, lower_dentry,
+						 (lower_dentry ?
+						  lower_dentry->d_inode :
+						  (void *) -1L),
+						 bindex, dstart, dend);
 				}
 			}
 		}
@@ -188,9 +188,9 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 		if (lower_mnt) {
 			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,
-				       lower_mnt, bindex, dstart, dend);
+				pr_debug(" CM0: dentry/lmnt=%p:%p bindex=%d "
+					 "dstart/end=%d:%d\n", dentry,
+					 lower_mnt, bindex, dstart, dend);
 			}
 		} else {	/* lower_mnt == NULL */
 			if (bindex >= dstart && bindex <= dend) {
@@ -204,10 +204,10 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 					     !(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",
-					       dentry, lower_mnt, bindex,
-					       dstart, dend);
+					pr_debug(" CM1: dentry/lmnt=%p:%p "
+						 "bindex=%d dstart/end=%d:%d\n",
+						 dentry, lower_mnt, bindex,
+						 dstart, dend);
 				}
 			}
 		}
@@ -222,30 +222,30 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 	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);
+		pr_debug(" CI0: dentry/inode=%p:%p istart/end=%d:%d\n",
+			 dentry, inode, istart, iend);
 	}
 	if (unlikely(istart != dstart)) {
 		PRINT_CALLER(fname, fxn, line);
-		printk(" CI1: dentry/inode=%p:%p istart=%d dstart=%d\n",
-		       dentry, inode, istart, dstart);
+		pr_debug(" CI1: dentry/inode=%p:%p istart=%d dstart=%d\n",
+			 dentry, inode, istart, dstart);
 	}
 	if (unlikely(iend != dend)) {
 		PRINT_CALLER(fname, fxn, line);
-		printk(" CI2: dentry/inode=%p:%p iend=%d dend=%d\n",
-		       dentry, inode, iend, dend);
+		pr_debug(" CI2: dentry/inode=%p:%p iend=%d dend=%d\n",
+			 dentry, inode, iend, dend);
 	}
 
 	if (!S_ISDIR(inode->i_mode)) {
 		if (unlikely(dend != dstart)) {
 			PRINT_CALLER(fname, fxn, line);
-			printk(" CI3: dentry/inode=%p:%p dstart=%d dend=%d\n",
-			       dentry, inode, dstart, dend);
+			pr_debug(" CI3: dentry/inode=%p:%p dstart=%d dend=%d\n",
+				 dentry, inode, dstart, dend);
 		}
 		if (unlikely(iend != istart)) {
 			PRINT_CALLER(fname, fxn, line);
-			printk(" CI4: dentry/inode=%p:%p istart=%d iend=%d\n",
-			       dentry, inode, istart, iend);
+			pr_debug(" CI4: dentry/inode=%p:%p istart=%d iend=%d\n",
+				 dentry, inode, istart, iend);
 		}
 	}
 
@@ -255,15 +255,15 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 			memset(&poison_ptr, POISON_INUSE, sizeof(void *));
 			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);
+				pr_debug(" CI5: dentry/linode=%p:%p bindex=%d "
+					 "istart/end=%d:%d\n", dentry,
+					 lower_inode, bindex, istart, iend);
 			} else if (unlikely(lower_inode == poison_ptr)) {
 				/* freed inode! */
 				PRINT_CALLER(fname, fxn, line);
-				printk(" CI6: dentry/linode=%p:%p bindex=%d "
-				       "istart/end=%d:%d\n", dentry,
-				       lower_inode, bindex, istart, iend);
+				pr_debug(" CI6: dentry/linode=%p:%p bindex=%d "
+					 "istart/end=%d:%d\n", dentry,
+					 lower_inode, bindex, istart, iend);
 			}
 		} else {	/* lower_inode == NULL */
 			if (bindex >= istart && bindex <= iend) {
@@ -276,10 +276,10 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 					       bindex > istart &&
 					       bindex < iend))) {
 					PRINT_CALLER(fname, fxn, line);
-					printk(" CI7: dentry/linode=%p:%p "
-					       "bindex=%d istart/end=%d:%d\n",
-					       dentry, lower_inode, bindex,
-					       istart, iend);
+					pr_debug(" CI7: dentry/linode=%p:%p "
+						 "bindex=%d istart/end=%d:%d\n",
+						 dentry, lower_inode, bindex,
+						 istart, iend);
 				}
 			}
 		}
@@ -301,10 +301,10 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 				       (!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",
-				       lower_mnt, lower_dentry, lower_inode,
-				       bindex, dstart, dend);
+				pr_debug(" Cx: lmnt/ldentry/linode=%p:%p:%p "
+					 "bindex=%d dstart/end=%d:%d\n",
+					 lower_mnt, lower_dentry, lower_inode,
+					 bindex, dstart, dend);
 			}
 		}
 	/* check if lower inode is newer than upper one (it shouldn't) */
@@ -314,17 +314,17 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 			lower_inode = unionfs_lower_inode_idx(inode, bindex);
 			if (unlikely(!lower_inode))
 				continue;
-			printk(" CI8: bindex=%d mtime/lmtime=%lu.%lu/%lu.%lu "
-			       "ctime/lctime=%lu.%lu/%lu.%lu\n",
-			       bindex,
-			       inode->i_mtime.tv_sec,
-			       inode->i_mtime.tv_nsec,
-			       lower_inode->i_mtime.tv_sec,
-			       lower_inode->i_mtime.tv_nsec,
-			       inode->i_ctime.tv_sec,
-			       inode->i_ctime.tv_nsec,
-			       lower_inode->i_ctime.tv_sec,
-			       lower_inode->i_ctime.tv_nsec);
+			pr_debug(" CI8: bindex=%d mtime/lmtime=%lu.%lu/%lu.%lu "
+				 "ctime/lctime=%lu.%lu/%lu.%lu\n",
+				 bindex,
+				 inode->i_mtime.tv_sec,
+				 inode->i_mtime.tv_nsec,
+				 lower_inode->i_mtime.tv_sec,
+				 lower_inode->i_mtime.tv_nsec,
+				 inode->i_ctime.tv_sec,
+				 inode->i_ctime.tv_nsec,
+				 lower_inode->i_ctime.tv_sec,
+				 lower_inode->i_ctime.tv_nsec);
 		}
 	}
 }
@@ -353,30 +353,30 @@ void __unionfs_check_file(const struct file *file,
 	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);
+		pr_debug(" CF0: file/dentry=%p:%p fstart/end=%d:%d\n",
+			 file, dentry, fstart, fend);
 	}
 	if (unlikely(fstart != dstart)) {
 		PRINT_CALLER(fname, fxn, line);
-		printk(" CF1: file/dentry=%p:%p fstart=%d dstart=%d\n",
-		       file, dentry, fstart, dstart);
+		pr_debug(" CF1: file/dentry=%p:%p fstart=%d dstart=%d\n",
+			 file, dentry, fstart, dstart);
 	}
 	if (unlikely(fend != dend)) {
 		PRINT_CALLER(fname, fxn, line);
-		printk(" CF2: file/dentry=%p:%p fend=%d dend=%d\n",
-		       file, dentry, fend, dend);
+		pr_debug(" 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 (unlikely(fend != fstart)) {
 			PRINT_CALLER(fname, fxn, line);
-			printk(" CF3: file/inode=%p:%p fstart=%d fend=%d\n",
-			       file, inode, fstart, fend);
+			pr_debug(" CF3: file/inode=%p:%p fstart=%d fend=%d\n",
+				 file, inode, fstart, fend);
 		}
 		if (unlikely(dend != dstart)) {
 			PRINT_CALLER(fname, fxn, line);
-			printk(" CF4: file/dentry=%p:%p dstart=%d dend=%d\n",
-			       file, dentry, dstart, dend);
+			pr_debug(" CF4: file/dentry=%p:%p dstart=%d dend=%d\n",
+				 file, dentry, dstart, dend);
 		}
 	}
 
@@ -389,9 +389,9 @@ void __unionfs_check_file(const struct file *file,
 		if (lower_file) {
 			if (unlikely(bindex < fstart || bindex > fend)) {
 				PRINT_CALLER(fname, fxn, line);
-				printk(" CF5: file/lower=%p:%p bindex=%d "
-				       "fstart/end=%d:%d\n",
-				       file, lower_file, bindex, fstart, fend);
+				pr_debug(" CF5: file/lower=%p:%p bindex=%d "
+					 "fstart/end=%d:%d\n",
+					 file, lower_file, bindex, fstart, fend);
 			}
 		} else {	/* lower_file == NULL */
 			if (bindex >= fstart && bindex <= fend) {
@@ -404,10 +404,10 @@ void __unionfs_check_file(const struct file *file,
 					       bindex > fstart &&
 					       bindex < fend))) {
 					PRINT_CALLER(fname, fxn, line);
-					printk(" CF6: file/lower=%p:%p "
-					       "bindex=%d fstart/end=%d:%d\n",
-					       file, lower_file, bindex,
-					       fstart, fend);
+					pr_debug(" CF6: file/lower=%p:%p "
+						 "bindex=%d fstart/end=%d:%d\n",
+						 file, lower_file, bindex,
+						 fstart, fend);
 				}
 			}
 		}
@@ -430,8 +430,8 @@ void __unionfs_check_nd(const struct nameidata *nd,
 			     strcmp(file->f_dentry->d_sb->s_type->name,
 				    UNIONFS_NAME))) {
 			PRINT_CALLER(fname, fxn, line);
-			printk(" CND1: lower_file of type %s\n",
-			       file->f_path.dentry->d_sb->s_type->name);
+			pr_debug(" CND1: lower_file of type %s\n",
+				 file->f_path.dentry->d_sb->s_type->name);
 			BUG();
 		}
 	}
@@ -444,15 +444,15 @@ void __show_branch_counts(const struct super_block *sb,
 	int i;
 	struct vfsmount *mnt;
 
-	printk("BC:");
+	pr_debug("BC:");
 	for (i=0; i<sbmax(sb); i++) {
 		if (likely(sb->s_root))
 			mnt = UNIONFS_D(sb->s_root)->lower_paths[i].mnt;
 		else
 			mnt = NULL;
-		printk("%d:", (mnt ? atomic_read(&mnt->mnt_count) : -99));
+		pr_debug("%d:", (mnt ? atomic_read(&mnt->mnt_count) : -99));
 	}
-	printk("%s:%s:%d\n",file,fxn,line);
+	pr_debug("%s:%s:%d\n",file,fxn,line);
 }
 
 void __show_inode_times(const struct inode *inode,
@@ -465,16 +465,16 @@ void __show_inode_times(const struct inode *inode,
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (unlikely(!lower_inode))
 			continue;
-		printk("IT(%lu:%d): ", inode->i_ino, bindex);
-		printk("%s:%s:%d ",file,fxn,line);
-		printk("um=%lu/%lu lm=%lu/%lu ",
-		       inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
-		       lower_inode->i_mtime.tv_sec,
-		       lower_inode->i_mtime.tv_nsec);
-		printk("uc=%lu/%lu lc=%lu/%lu\n",
-		       inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
-		       lower_inode->i_ctime.tv_sec,
-		       lower_inode->i_ctime.tv_nsec);
+		pr_debug("IT(%lu:%d): ", inode->i_ino, bindex);
+		pr_debug("%s:%s:%d ",file,fxn,line);
+		pr_debug("um=%lu/%lu lm=%lu/%lu ",
+			 inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
+			 lower_inode->i_mtime.tv_sec,
+			 lower_inode->i_mtime.tv_nsec);
+		pr_debug("uc=%lu/%lu lc=%lu/%lu\n",
+			 inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
+			 lower_inode->i_ctime.tv_sec,
+			 lower_inode->i_ctime.tv_nsec);
 	}
 }
 
@@ -489,17 +489,17 @@ void __show_dinode_times(const struct dentry *dentry,
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (!lower_inode)
 			continue;
-		printk("DT(%s:%lu:%d): ", dentry->d_name.name, inode->i_ino,
-		       bindex);
-		printk("%s:%s:%d ",file,fxn,line);
-		printk("um=%lu/%lu lm=%lu/%lu ",
-		       inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
-		       lower_inode->i_mtime.tv_sec,
-		       lower_inode->i_mtime.tv_nsec);
-		printk("uc=%lu/%lu lc=%lu/%lu\n",
-		       inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
-		       lower_inode->i_ctime.tv_sec,
-		       lower_inode->i_ctime.tv_nsec);
+		pr_debug("DT(%s:%lu:%d): ", dentry->d_name.name, inode->i_ino,
+			 bindex);
+		pr_debug("%s:%s:%d ",file,fxn,line);
+		pr_debug("um=%lu/%lu lm=%lu/%lu ",
+			 inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
+			 lower_inode->i_mtime.tv_sec,
+			 lower_inode->i_mtime.tv_nsec);
+		pr_debug("uc=%lu/%lu lc=%lu/%lu\n",
+			 inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
+			 lower_inode->i_ctime.tv_sec,
+			 lower_inode->i_ctime.tv_nsec);
 	}
 }
 
@@ -510,7 +510,7 @@ void __show_inode_counts(const struct inode *inode,
 	int bindex;
 
 	if (unlikely(!inode)) {
-		printk("SiC: Null inode\n");
+		pr_debug("SiC: Null inode\n");
 		return;
 	}
 	for (bindex=sbstart(inode->i_sb); bindex <= sbend(inode->i_sb);
@@ -518,9 +518,9 @@ void __show_inode_counts(const struct inode *inode,
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (unlikely(!lower_inode))
 			continue;
-		printk("SIC(%lu:%d:%d): ", inode->i_ino, bindex,
-		       atomic_read(&(inode)->i_count));
-		printk("lc=%d ", atomic_read(&(lower_inode)->i_count));
-		printk("%s:%s:%d\n",file,fxn,line);
+		pr_debug("SIC(%lu:%d:%d): ", inode->i_ino, bindex,
+			 atomic_read(&(inode)->i_count));
+		pr_debug("lc=%d ", atomic_read(&(lower_inode)->i_count));
+		pr_debug("%s:%s:%d\n",file,fxn,line);
 	}
 }
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 4e3cb53..bd1a0f3 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -474,8 +474,8 @@ static inline struct vfsmount *unionfs_mntget(struct dentry *dentry,
 	mnt = mntget(unionfs_lower_mnt_idx(dentry, bindex));
 #ifdef CONFIG_UNION_FS_DEBUG
 	if (!mnt)
-		printk(KERN_DEBUG "unionfs: mntget: mnt=%p bindex=%d\n",
-		       mnt, bindex);
+		pr_debug("unionfs: mntget: mnt=%p bindex=%d\n",
+			 mnt, bindex);
 #endif /* CONFIG_UNION_FS_DEBUG */
 
 	return mnt;
@@ -499,9 +499,7 @@ static inline void unionfs_mntput(struct dentry *dentry, int bindex)
 	 * been a regular file: it had to have been a directory.
 	 */
 	if (!mnt && !(bindex > dbstart(dentry) && bindex < dbend(dentry)))
-		printk(KERN_WARNING
-		       "unionfs: mntput: mnt=%p bindex=%d\n",
-		       mnt, bindex);
+		pr_debug("unionfs: mntput: mnt=%p bindex=%d\n", mnt, bindex);
 #endif /* CONFIG_UNION_FS_DEBUG */
 	mntput(mnt);
 }
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 11/19] Unionfs: add missing newlines in printk's
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (9 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 10/19] Unionfs: convert all appropriate printk's to pr_debug calls Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 12/19] Unionfs: update/assign a KERN_* level to all printk statements Erez Zadok
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

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

diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 5c7f672..185ddb8 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -175,7 +175,7 @@ skip:
 		/* Do nothing. */
 		break;
 	default:
-		printk(KERN_ERR "unionfs: invalid interpose flag passed!");
+		printk(KERN_ERR "unionfs: invalid interpose flag passed!\n");
 		BUG();
 	}
 	goto out;
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 12/19] Unionfs: update/assign a KERN_* level to all printk statements
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (10 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 11/19] Unionfs: add missing newlines in printk's Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 13/19] Unionfs: remove periods from the end of printk strings Erez Zadok
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Also use pr_info() instead of printk(KERN_INFO ...)

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/commonfops.c |    4 ++--
 fs/unionfs/copyup.c     |    2 +-
 fs/unionfs/dentry.c     |   18 +++++++++---------
 fs/unionfs/file.c       |    7 ++++---
 fs/unionfs/inode.c      |   16 +++++++++-------
 fs/unionfs/lookup.c     |    2 +-
 fs/unionfs/main.c       |   33 +++++++++++++++++----------------
 fs/unionfs/mmap.c       |    2 +-
 fs/unionfs/rdstate.c    |    2 +-
 fs/unionfs/rename.c     |   14 +++++++-------
 fs/unionfs/subr.c       |    2 +-
 fs/unionfs/super.c      |   45 ++++++++++++++++++++++++---------------------
 12 files changed, 77 insertions(+), 70 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 278aa5d..b42a6f4 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -760,8 +760,8 @@ long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	switch (cmd) {
 	case UNIONFS_IOCTL_INCGEN:
 		/* Increment the superblock generation count */
-		printk("unionfs: incgen ioctl deprecated; "
-		       "use \"-o remount,incgen\"\n");
+		pr_info("unionfs: incgen ioctl deprecated; "
+			"use \"-o remount,incgen\"\n");
 		err = -ENOSYS;
 		break;
 
diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
index 4eb5f82..fb6fcae 100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@ -209,7 +209,7 @@ static int __copyup_ndentry(struct dentry *old_lower_dentry,
 		err = args.err;
 		release_lower_nd(&nd, err);
 	} else {
-		printk(KERN_ERR "unionfs: unknown inode type %d\n",
+		printk(KERN_CRIT "unionfs: unknown inode type %d\n",
 		       old_mode);
 		BUG();
 	}
diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 5dde6af..248c79d 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -218,17 +218,17 @@ bool is_newer_lower(const struct dentry *dentry)
 		 */
 		if (unlikely(timespec_compare(&inode->i_mtime,
 					      &lower_inode->i_mtime) < 0)) {
-			printk("unionfs: new lower inode mtime "
-			       "(bindex=%d, name=%s)\n", bindex,
-			       dentry->d_name.name);
+			pr_info("unionfs: new lower inode mtime "
+				"(bindex=%d, name=%s)\n", bindex,
+				dentry->d_name.name);
 			show_dinode_times(dentry);
 			return true; /* mtime changed! */
 		}
 		if (unlikely(timespec_compare(&inode->i_ctime,
 					      &lower_inode->i_ctime) < 0)) {
-			printk("unionfs: new lower inode ctime "
-			       "(bindex=%d, name=%s)\n", bindex,
-			       dentry->d_name.name);
+			pr_info("unionfs: new lower inode ctime "
+				"(bindex=%d, name=%s)\n", bindex,
+				dentry->d_name.name);
 			show_dinode_times(dentry);
 			return true; /* ctime changed! */
 		}
@@ -328,7 +328,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,
 	 */
 	chain = kzalloc(chain_len * sizeof(struct dentry *), GFP_KERNEL);
 	if (unlikely(!chain)) {
-		printk("unionfs: no more memory in %s\n", __FUNCTION__);
+		printk(KERN_CRIT "unionfs: no more memory in %s\n", __FUNCTION__);
 		goto out;
 	}
 
@@ -449,12 +449,12 @@ static void unionfs_d_release(struct dentry *dentry)
 	unionfs_check_dentry(dentry);
 	/* this could be a negative dentry, so check first */
 	if (unlikely(!UNIONFS_D(dentry))) {
-		printk(KERN_DEBUG "unionfs: dentry without private data: %.*s\n",
+		printk(KERN_ERR "unionfs: dentry without private data: %.*s\n",
 		       dentry->d_name.len, dentry->d_name.name);
 		goto out;
 	} else if (dbstart(dentry) < 0) {
 		/* this is due to a failed lookup */
-		printk(KERN_DEBUG "unionfs: dentry without lower "
+		printk(KERN_ERR "unionfs: dentry without lower "
 		       "dentries: %.*s\n",
 		       dentry->d_name.len, dentry->d_name.name);
 		goto out_free;
diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c
index 82959d1..923f134 100644
--- a/fs/unionfs/file.c
+++ b/fs/unionfs/file.c
@@ -121,12 +121,13 @@ static int unionfs_mmap(struct file *file, struct vm_area_struct *vma)
 	lower_file = unionfs_lower_file(file);
 	if (willwrite && !lower_file->f_mapping->a_ops->writepage) {
 		err = -EINVAL;
-		printk("unionfs: branch %d file system does not support "
-		       "writeable mmap\n", fbstart(file));
+		printk(KERN_ERR "unionfs: branch %d file system does not "
+		       "support writeable mmap\n", fbstart(file));
 	} else {
 		err = generic_file_mmap(file, vma);
 		if (err)
-			printk("unionfs: generic_file_mmap failed %d\n", err);
+			printk(KERN_ERR
+			       "unionfs: generic_file_mmap failed %d\n", err);
 	}
 
 out:
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index ba85a67..49b5baf 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -90,8 +90,8 @@ static int unionfs_create(struct inode *parent, struct dentry *dentry,
 			unlock_dir(lower_dir_dentry);
 
 			if (err) {
-				printk("unionfs: create: could not unlink "
-				       "whiteout, err = %d\n", err);
+				printk(KERN_ERR "unionfs: create: could not "
+				       "unlink whiteout, err = %d\n", err);
 				goto out;
 			}
 		}
@@ -446,7 +446,7 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,
 				if (IS_ERR(lower_dentry))
 					err = PTR_ERR(lower_dentry);
 
-				printk(KERN_DEBUG "unionfs: lower dentry "
+				printk(KERN_ERR "unionfs: lower dentry "
 				       "NULL (or error) for bindex = %d\n",
 				       bindex);
 				continue;
@@ -588,7 +588,7 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode)
 						      dentry->d_name.name,
 						      bindex);
 			if (!lower_dentry || IS_ERR(lower_dentry)) {
-				printk(KERN_DEBUG "unionfs: lower dentry "
+				printk(KERN_ERR "unionfs: lower dentry "
 				       " NULL for bindex = %d\n", bindex);
 				continue;
 			}
@@ -732,7 +732,7 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
 						      dentry->d_name.name,
 						      bindex);
 			if (IS_ERR(lower_dentry)) {
-				printk(KERN_DEBUG "unionfs: failed to create "
+				printk(KERN_ERR "unionfs: failed to create "
 				       "parents on %d, err = %ld\n",
 				       bindex, PTR_ERR(lower_dentry));
 				continue;
@@ -878,7 +878,8 @@ static void unionfs_put_link(struct dentry *dentry, struct nameidata *nd,
 
 	unionfs_lock_dentry(dentry);
 	if (unlikely(!__unionfs_d_revalidate_chain(dentry, nd, false)))
-		printk("unionfs: put_link failed to revalidate dentry\n");
+		printk(KERN_ERR
+		       "unionfs: put_link failed to revalidate dentry\n");
 	unionfs_unlock_dentry(dentry);
 
 	unionfs_check_dentry(dentry);
@@ -1088,7 +1089,8 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia)
 		if (ia->ia_size != i_size_read(inode)) {
 			err = vmtruncate(inode, ia->ia_size);
 			if (err)
-				printk("unionfs: setattr: vmtruncate failed\n");
+				printk(KERN_ERR
+				       "unionfs: setattr: vmtruncate failed\n");
 		}
 	}
 
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 9c6fd56..981c0d9 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -214,7 +214,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
 				break;
 			}
 			err = -EIO;
-			printk(KERN_NOTICE "unionfs: EIO: invalid whiteout "
+			printk(KERN_ERR "unionfs: EIO: invalid whiteout "
 			       "entry type %d.\n",
 			       wh_lower_dentry->d_inode->i_mode);
 			dput(wh_lower_dentry);
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 185ddb8..25d1461 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -175,7 +175,7 @@ skip:
 		/* Do nothing. */
 		break;
 	default:
-		printk(KERN_ERR "unionfs: invalid interpose flag passed!\n");
+		printk(KERN_CRIT "unionfs: invalid interpose flag passed!\n");
 		BUG();
 	}
 	goto out;
@@ -303,7 +303,7 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info
 	struct dentry *dent2;
 
 	if (options[0] == '\0') {
-		printk(KERN_WARNING "unionfs: no branches specified\n");
+		printk(KERN_ERR "unionfs: no branches specified\n");
 		err = -EINVAL;
 		goto out;
 	}
@@ -358,14 +358,14 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info
 
 		err = path_lookup(name, LOOKUP_FOLLOW, &nd);
 		if (err) {
-			printk(KERN_WARNING "unionfs: error accessing "
+			printk(KERN_ERR "unionfs: error accessing "
 			       "lower directory '%s' (error %d)\n",
 			       name, err);
 			goto out;
 		}
 
 		if ((err = check_branch(&nd))) {
-			printk(KERN_WARNING "unionfs: lower directory "
+			printk(KERN_ERR "unionfs: lower directory "
 			       "'%s' is not a valid branch\n", name);
 			path_release(&nd);
 			goto out;
@@ -385,7 +385,7 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info
 	}
 
 	if (branches == 0) {
-		printk(KERN_WARNING "unionfs: no branches specified\n");
+		printk(KERN_ERR "unionfs: no branches specified\n");
 		err = -EINVAL;
 		goto out;
 	}
@@ -412,7 +412,7 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info
 		for (j = i + 1; j < branches; j++) {
 			dent2 = lower_root_info->lower_paths[j].dentry;
 			if (is_branch_overlap(dent1, dent2)) {
-				printk(KERN_WARNING "unionfs: branches %d and "
+				printk(KERN_ERR "unionfs: branches %d and "
 				       "%d overlap\n", i, j);
 				err = -EINVAL;
 				goto out;
@@ -485,14 +485,15 @@ static struct unionfs_dentry_info *unionfs_parse_options(
 		 * don't, above this check.
 		 */
 		if (!optarg) {
-			printk("unionfs: %s requires an argument.\n", optname);
+			printk(KERN_ERR "unionfs: %s requires an argument.\n",
+			       optname);
 			err = -EINVAL;
 			goto out_error;
 		}
 
 		if (!strcmp("dirs", optname)) {
 			if (++dirsfound > 1) {
-				printk(KERN_WARNING
+				printk(KERN_ERR
 				       "unionfs: multiple dirs specified\n");
 				err = -EINVAL;
 				goto out_error;
@@ -506,7 +507,7 @@ static struct unionfs_dentry_info *unionfs_parse_options(
 		/* All of these options require an integer argument. */
 		intval = simple_strtoul(optarg, &endptr, 0);
 		if (*endptr) {
-			printk(KERN_WARNING
+			printk(KERN_ERR
 			       "unionfs: invalid %s option '%s'\n",
 			       optname, optarg);
 			err = -EINVAL;
@@ -514,12 +515,12 @@ static struct unionfs_dentry_info *unionfs_parse_options(
 		}
 
 		err = -EINVAL;
-		printk(KERN_WARNING
+		printk(KERN_ERR
 		       "unionfs: unrecognized option '%s'\n", optname);
 		goto out_error;
 	}
 	if (dirsfound != 1) {
-		printk(KERN_WARNING "unionfs: dirs option required\n");
+		printk(KERN_ERR "unionfs: dirs option required\n");
 		err = -EINVAL;
 		goto out_error;
 	}
@@ -591,7 +592,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,
 	int bindex, bstart, bend;
 
 	if (!raw_data) {
-		printk(KERN_WARNING
+		printk(KERN_ERR
 		       "unionfs: read_super: missing data argument\n");
 		err = -EINVAL;
 		goto out;
@@ -600,7 +601,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,
 	/* Allocate superblock private data */
 	sb->s_fs_info = kzalloc(sizeof(struct unionfs_sb_info), GFP_KERNEL);
 	if (unlikely(!UNIONFS_SB(sb))) {
-		printk(KERN_WARNING "unionfs: read_super: out of memory\n");
+		printk(KERN_CRIT "unionfs: read_super: out of memory\n");
 		err = -ENOMEM;
 		goto out;
 	}
@@ -612,7 +613,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,
 
 	lower_root_info = unionfs_parse_options(sb, raw_data);
 	if (IS_ERR(lower_root_info)) {
-		printk(KERN_WARNING
+		printk(KERN_ERR
 		       "unionfs: read_super: error while parsing options "
 		       "(err = %ld)\n", PTR_ERR(lower_root_info));
 		err = PTR_ERR(lower_root_info);
@@ -735,7 +736,7 @@ static int __init init_unionfs_fs(void)
 {
 	int err;
 
-	printk("Registering unionfs " UNIONFS_VERSION "\n");
+	pr_info("Registering unionfs " UNIONFS_VERSION "\n");
 
 	if (unlikely((err = unionfs_init_filldir_cache())))
 		goto out;
@@ -763,7 +764,7 @@ static void __exit exit_unionfs_fs(void)
 	unionfs_destroy_inode_cache();
 	unionfs_destroy_dentry_cache();
 	unregister_filesystem(&unionfs_fs_type);
-	printk("Completed unionfs module unload.\n");
+	pr_info("Completed unionfs module unload\n");
 }
 
 MODULE_AUTHOR("Erez Zadok, Filesystems and Storage Lab, Stony Brook University"
diff --git a/fs/unionfs/mmap.c b/fs/unionfs/mmap.c
index 8928e99..37ad761 100644
--- a/fs/unionfs/mmap.c
+++ b/fs/unionfs/mmap.c
@@ -347,7 +347,7 @@ static void unionfs_sync_page(struct page *page)
 	 */
 	lower_page = find_lock_page(lower_inode->i_mapping, page->index);
 	if (!lower_page) {
-		printk(KERN_DEBUG "unionfs: find_lock_page failed\n");
+		printk(KERN_ERR "unionfs: find_lock_page failed\n");
 		goto out;
 	}
 
diff --git a/fs/unionfs/rdstate.c b/fs/unionfs/rdstate.c
index 0fdd364..46cf2df 100644
--- a/fs/unionfs/rdstate.c
+++ b/fs/unionfs/rdstate.c
@@ -218,7 +218,7 @@ struct filldir_node *find_filldir_node(struct unionfs_dir_state *rdstate,
 			 * system is corrupted.
 			 */
 			if (unlikely(cursor->bindex == rdstate->bindex)) {
-				printk(KERN_DEBUG "unionfs: filldir: possible "
+				printk(KERN_ERR "unionfs: filldir: possible "
 				       "I/O error: a file is duplicated "
 				       "in the same branch %d: %s\n",
 				       rdstate->bindex, cursor->name);
diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index 226bcea..c90405d 100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -40,7 +40,7 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 				       new_dentry, new_dentry->d_name.name,
 				       bindex);
 		if (IS_ERR(lower_new_dentry)) {
-			printk(KERN_DEBUG "unionfs: error creating directory "
+			printk(KERN_ERR "unionfs: error creating directory "
 			       "tree for rename, bindex = %d, err = %ld\n",
 			       bindex, PTR_ERR(lower_new_dentry));
 			err = PTR_ERR(lower_new_dentry);
@@ -66,7 +66,7 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (lower_wh_dentry->d_inode) {
 		/* get rid of the whiteout that is existing */
 		if (lower_new_dentry->d_inode) {
-			printk(KERN_WARNING "unionfs: both a whiteout and a "
+			printk(KERN_ERR "unionfs: both a whiteout and a "
 			       "dentry exist when doing a rename!\n");
 			err = -EIO;
 
@@ -293,14 +293,14 @@ revert:
 	/* Do revert here. */
 	local_err = unionfs_refresh_lower_dentry(new_dentry, old_bstart);
 	if (local_err) {
-		printk(KERN_WARNING "unionfs: revert failed in rename: "
+		printk(KERN_ERR "unionfs: revert failed in rename: "
 		       "the new refresh failed.\n");
 		eio = -EIO;
 	}
 
 	local_err = unionfs_refresh_lower_dentry(old_dentry, old_bstart);
 	if (local_err) {
-		printk(KERN_WARNING "unionfs: revert failed in rename: "
+		printk(KERN_ERR "unionfs: revert failed in rename: "
 		       "the old refresh failed.\n");
 		eio = -EIO;
 		goto revert_out;
@@ -308,7 +308,7 @@ revert:
 
 	if (!unionfs_lower_dentry_idx(new_dentry, bindex) ||
 	    !unionfs_lower_dentry_idx(new_dentry, bindex)->d_inode) {
-		printk(KERN_WARNING "unionfs: revert failed in rename: "
+		printk(KERN_ERR "unionfs: revert failed in rename: "
 		       "the object disappeared from under us!\n");
 		eio = -EIO;
 		goto revert_out;
@@ -316,7 +316,7 @@ revert:
 
 	if (unionfs_lower_dentry_idx(old_dentry, bindex) &&
 	    unionfs_lower_dentry_idx(old_dentry, bindex)->d_inode) {
-		printk(KERN_WARNING "unionfs: revert failed in rename: "
+		printk(KERN_ERR "unionfs: revert failed in rename: "
 		       "the object was created underneath us!\n");
 		eio = -EIO;
 		goto revert_out;
@@ -327,7 +327,7 @@ revert:
 
 	/* If we can't fix it, then we cop-out with -EIO. */
 	if (local_err) {
-		printk(KERN_WARNING "unionfs: revert failed in rename!\n");
+		printk(KERN_ERR "unionfs: revert failed in rename!\n");
 		eio = -EIO;
 	}
 
diff --git a/fs/unionfs/subr.c b/fs/unionfs/subr.c
index 3183678..ab409ce 100644
--- a/fs/unionfs/subr.c
+++ b/fs/unionfs/subr.c
@@ -61,7 +61,7 @@ int create_whiteout(struct dentry *dentry, int start)
 						      dentry->d_name.name,
 						      bindex);
 			if (!lower_dentry || IS_ERR(lower_dentry)) {
-				printk(KERN_DEBUG "unionfs: create_parents "
+				printk(KERN_ERR "unionfs: create_parents "
 				       "failed for bindex = %d\n", bindex);
 				continue;
 			}
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 1279df6..798def9 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -45,7 +45,7 @@ static void unionfs_read_inode(struct inode *inode)
 	size = sbmax(inode->i_sb) * sizeof(struct inode *);
 	info->lower_inodes = kzalloc(size, GFP_KERNEL);
 	if (unlikely(!info->lower_inodes)) {
-		printk(KERN_ERR "unionfs: no kernel memory when allocating "
+		printk(KERN_CRIT "unionfs: no kernel memory when allocating "
 		       "lower-pointer array!\n");
 		BUG();
 	}
@@ -99,7 +99,8 @@ static void unionfs_put_super(struct super_block *sb)
 	/* Make sure we have no leaks of branchget/branchput. */
 	for (bindex = bstart; bindex <= bend; bindex++)
 		if (unlikely(branch_count(sb, bindex) != 0)) {
-			printk("unionfs: branch %d has %d references left!\n",
+			printk(KERN_CRIT
+			       "unionfs: branch %d has %d references left!\n",
 			       bindex, branch_count(sb, bindex));
 			leaks = 1;
 		}
@@ -171,17 +172,19 @@ static noinline int do_remount_mode_option(char *optarg, int cur_branches,
 
 	/* by now, optarg contains the branch name */
 	if (!*optarg) {
-		printk("unionfs: no branch specified for mode change.\n");
+		printk(KERN_ERR
+		       "unionfs: no branch specified for mode change.\n");
 		goto out;
 	}
 	if (!modename) {
-		printk("unionfs: branch \"%s\" requires a mode.\n", optarg);
+		printk(KERN_ERR "unionfs: branch \"%s\" requires a mode.\n",
+		       optarg);
 		goto out;
 	}
 	*modename++ = '\0';
 	perms = __parse_branch_mode(modename);
 	if (perms == 0) {
-		printk("unionfs: invalid mode \"%s\" for \"%s\".\n",
+		printk(KERN_ERR "unionfs: invalid mode \"%s\" for \"%s\".\n",
 		       modename, optarg);
 		goto out;
 	}
@@ -194,7 +197,7 @@ static noinline int do_remount_mode_option(char *optarg, int cur_branches,
 	 */
 	err = path_lookup(optarg, LOOKUP_FOLLOW, &nd);
 	if (err) {
-		printk(KERN_WARNING "unionfs: error accessing "
+		printk(KERN_ERR "unionfs: error accessing "
 		       "lower directory \"%s\" (error %d)\n",
 		       optarg, err);
 		goto out;
@@ -206,7 +209,7 @@ static noinline int do_remount_mode_option(char *optarg, int cur_branches,
 	path_release(&nd);	/* no longer needed */
 	if (idx == cur_branches) {
 		err = -ENOENT;	/* err may have been reset above */
-		printk(KERN_WARNING "unionfs: branch \"%s\" "
+		printk(KERN_ERR "unionfs: branch \"%s\" "
 		       "not found\n", optarg);
 		goto out;
 	}
@@ -237,7 +240,7 @@ static noinline int do_remount_del_option(char *optarg, int cur_branches,
 	 */
 	err = path_lookup(optarg, LOOKUP_FOLLOW, &nd);
 	if (err) {
-		printk(KERN_WARNING "unionfs: error accessing "
+		printk(KERN_ERR "unionfs: error accessing "
 		       "lower directory \"%s\" (error %d)\n",
 		       optarg, err);
 		goto out;
@@ -248,7 +251,7 @@ static noinline int do_remount_del_option(char *optarg, int cur_branches,
 			break;
 	path_release(&nd);	/* no longer needed */
 	if (idx == cur_branches) {
-		printk(KERN_WARNING "unionfs: branch \"%s\" "
+		printk(KERN_ERR "unionfs: branch \"%s\" "
 		       "not found\n", optarg);
 		err = -ENOENT;
 		goto out;
@@ -321,7 +324,7 @@ static noinline int do_remount_add_option(char *optarg, int cur_branches,
 	 */
 	err = path_lookup(optarg, LOOKUP_FOLLOW, &nd);
 	if (err) {
-		printk(KERN_WARNING "unionfs: error accessing "
+		printk(KERN_ERR "unionfs: error accessing "
 		       "lower directory \"%s\" (error %d)\n",
 		       optarg, err);
 		goto out;
@@ -332,7 +335,7 @@ static noinline int do_remount_add_option(char *optarg, int cur_branches,
 			break;
 	path_release(&nd);	/* no longer needed */
 	if (idx == cur_branches) {
-		printk(KERN_WARNING "unionfs: branch \"%s\" "
+		printk(KERN_ERR "unionfs: branch \"%s\" "
 		       "not found\n", optarg);
 		err = -ENOENT;
 		goto out;
@@ -351,13 +354,13 @@ found_insertion_point:
 	perms = parse_branch_mode(modename);
 
 	if (!new_branch || !*new_branch) {
-		printk(KERN_WARNING "unionfs: null new branch\n");
+		printk(KERN_ERR "unionfs: null new branch\n");
 		err = -EINVAL;
 		goto out;
 	}
 	err = path_lookup(new_branch, LOOKUP_FOLLOW, &nd);
 	if (err) {
-		printk(KERN_WARNING "unionfs: error accessing "
+		printk(KERN_ERR "unionfs: error accessing "
 		       "lower directory \"%s\" (error %d)\n",
 		       new_branch, err);
 		goto out;
@@ -370,7 +373,7 @@ found_insertion_point:
 	 * code base supports that correctly.
 	 */
 	if ((err = check_branch(&nd))) {
-		printk(KERN_WARNING "unionfs: lower directory "
+		printk(KERN_ERR "unionfs: lower directory "
 		       "\"%s\" is not a valid branch\n", optarg);
 		path_release(&nd);
 		goto out;
@@ -454,7 +457,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,
 	 * allowed/supported as of now).
 	 */
 	if ((*flags & ~(MS_RDONLY | MS_SILENT)) != 0) {
-		printk(KERN_WARNING
+		printk(KERN_ERR
 		       "unionfs: remount flags 0x%x unsupported\n", *flags);
 		err = -EINVAL;
 		goto out_error;
@@ -499,7 +502,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,
 	kfree(tmp_to_free);
 	/* after all changes, will we have at least one branch left? */
 	if ((new_branches + add_branches - del_branches) < 1) {
-		printk(KERN_WARNING
+		printk(KERN_ERR
 		       "unionfs: no branches left after remount\n");
 		err = -EINVAL;
 		goto out_free;
@@ -580,7 +583,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,
 		 * contains the CMD part and optarg contains the ARG part.
 		 */
 		if (!optarg || !*optarg) {
-			printk("unionfs: all remount options require "
+			printk(KERN_ERR "unionfs: all remount options require "
 			       "an argument (%s).\n", optname);
 			err = -EINVAL;
 			goto out_release;
@@ -595,7 +598,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,
 				goto out_release;
 			new_branches++;
 			if (new_branches > UNIONFS_MAX_BRANCHES) {
-				printk("unionfs: command exceeds "
+				printk(KERN_ERR "unionfs: command exceeds "
 				       "%d branches\n", UNIONFS_MAX_BRANCHES);
 				err = -E2BIG;
 				goto out_release;
@@ -637,7 +640,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,
 		}
 
 		err = -EINVAL;
-		printk(KERN_WARNING
+		printk(KERN_ERR
 		       "unionfs: unrecognized option \"%s\"\n", optname);
 		goto out_release;
 	}
@@ -653,7 +656,7 @@ out_no_change:
 	 *******************************************************************/
 
 	if (!(tmp_data[0].branchperms & MAY_WRITE)) {
-		printk("unionfs: leftmost branch cannot be read-only "
+		printk(KERN_ERR "unionfs: leftmost branch cannot be read-only "
 		       "(use \"remount,ro\" to create a read-only union)\n");
 		err = -EINVAL;
 		goto out_release;
@@ -766,7 +769,7 @@ out_no_change:
 	atomic_set(&UNIONFS_D(sb->s_root)->generation, i);
 	atomic_set(&UNIONFS_I(sb->s_root->d_inode)->generation, i);
 	if (!(*flags & MS_SILENT))
-		printk("unionfs: new generation number %d\n", i);
+		pr_info("unionfs: new generation number %d\n", i);
 	/* finally, update the root dentry's times */
 	unionfs_copy_attr_times(sb->s_root->d_inode);
 	err = 0;		/* reset to success */
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 13/19] Unionfs: remove periods from the end of printk strings
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (11 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 12/19] Unionfs: update/assign a KERN_* level to all printk statements Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 14/19] Unionfs: use braces in both branches of conditionals Erez Zadok
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/lookup.c |    2 +-
 fs/unionfs/main.c   |    2 +-
 fs/unionfs/rename.c |    4 ++--
 fs/unionfs/super.c  |   10 +++++-----
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 981c0d9..929f15b 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -215,7 +215,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
 			}
 			err = -EIO;
 			printk(KERN_ERR "unionfs: EIO: invalid whiteout "
-			       "entry type %d.\n",
+			       "entry type %d\n",
 			       wh_lower_dentry->d_inode->i_mode);
 			dput(wh_lower_dentry);
 			dput(first_lower_dentry);
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 25d1461..25ac851 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -485,7 +485,7 @@ static struct unionfs_dentry_info *unionfs_parse_options(
 		 * don't, above this check.
 		 */
 		if (!optarg) {
-			printk(KERN_ERR "unionfs: %s requires an argument.\n",
+			printk(KERN_ERR "unionfs: %s requires an argument\n",
 			       optname);
 			err = -EINVAL;
 			goto out_error;
diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index c90405d..81121f0 100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -294,14 +294,14 @@ revert:
 	local_err = unionfs_refresh_lower_dentry(new_dentry, old_bstart);
 	if (local_err) {
 		printk(KERN_ERR "unionfs: revert failed in rename: "
-		       "the new refresh failed.\n");
+		       "the new refresh failed\n");
 		eio = -EIO;
 	}
 
 	local_err = unionfs_refresh_lower_dentry(old_dentry, old_bstart);
 	if (local_err) {
 		printk(KERN_ERR "unionfs: revert failed in rename: "
-		       "the old refresh failed.\n");
+		       "the old refresh failed\n");
 		eio = -EIO;
 		goto revert_out;
 	}
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 798def9..647b08c 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -173,18 +173,18 @@ static noinline int do_remount_mode_option(char *optarg, int cur_branches,
 	/* by now, optarg contains the branch name */
 	if (!*optarg) {
 		printk(KERN_ERR
-		       "unionfs: no branch specified for mode change.\n");
+		       "unionfs: no branch specified for mode change\n");
 		goto out;
 	}
 	if (!modename) {
-		printk(KERN_ERR "unionfs: branch \"%s\" requires a mode.\n",
+		printk(KERN_ERR "unionfs: branch \"%s\" requires a mode\n",
 		       optarg);
 		goto out;
 	}
 	*modename++ = '\0';
 	perms = __parse_branch_mode(modename);
 	if (perms == 0) {
-		printk(KERN_ERR "unionfs: invalid mode \"%s\" for \"%s\".\n",
+		printk(KERN_ERR "unionfs: invalid mode \"%s\" for \"%s\"\n",
 		       modename, optarg);
 		goto out;
 	}
@@ -584,7 +584,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,
 		 */
 		if (!optarg || !*optarg) {
 			printk(KERN_ERR "unionfs: all remount options require "
-			       "an argument (%s).\n", optname);
+			       "an argument (%s)\n", optname);
 			err = -EINVAL;
 			goto out_release;
 		}
@@ -634,7 +634,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,
 		 */
 		if (!strcmp("dirs", optname)) {
 			printk(KERN_WARNING
-			       "unionfs: remount ignoring option \"%s\".\n",
+			       "unionfs: remount ignoring option \"%s\"\n",
 			       optname);
 			continue;
 		}
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 14/19] Unionfs: use braces in both branches of conditionals
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (12 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 13/19] Unionfs: remove periods from the end of printk strings Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 15/19] Unionfs: coding style: proper spacing Erez Zadok
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

As per CodingStyle, if one branch of an if-then-else has braces because it
has multiple statements, then the other branch should have braces too, even
if the other branch has only one statement in it.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/commonfops.c |    6 ++++--
 fs/unionfs/dentry.c     |    8 ++++----
 fs/unionfs/dirfops.c    |    6 ++++--
 fs/unionfs/dirhelper.c  |    4 ++--
 fs/unionfs/inode.c      |    6 ++++--
 fs/unionfs/lookup.c     |    7 ++++---
 fs/unionfs/main.c       |    4 ++--
 fs/unionfs/rdstate.c    |    4 ++--
 fs/unionfs/rename.c     |   21 ++++++++++++---------
 fs/unionfs/unlink.c     |    9 +++++----
 10 files changed, 43 insertions(+), 32 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index b42a6f4..f7da687 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -182,8 +182,9 @@ static int open_all_files(struct file *file)
 		if (IS_ERR(lower_file)) {
 			err = PTR_ERR(lower_file);
 			goto out;
-		} else
+		} else {
 			unionfs_set_lower_file_idx(file, bindex, lower_file);
+		}
 	}
 out:
 	return err;
@@ -484,8 +485,9 @@ static int __open_file(struct inode *inode, struct file *file)
 					break;
 			}
 			return err;
-		} else
+		} else {
 			lower_flags &= ~(OPEN_WRITE_FLAGS);
+		}
 	}
 
 	dget(lower_dentry);
diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 248c79d..8891c53 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -299,9 +299,9 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,
 		 * always be valid, but its lower inode times don't have to
 		 * be, so sync up the times only.
 		 */
-		if (IS_ROOT(dtmp))
+		if (IS_ROOT(dtmp)) {
 			unionfs_copy_attr_times(dtmp->d_inode);
-		else {
+		} else {
 			/*
 			 * reset generation number to zero, guaranteed to be
 			 * "old"
@@ -376,9 +376,9 @@ out_this:
 
 	if (unlikely(is_newer_lower(dentry))) {
 		/* root dentry special case as aforementioned */
-		if (IS_ROOT(dentry))
+		if (IS_ROOT(dentry)) {
 			unionfs_copy_attr_times(dentry->d_inode);
-		else {
+		} else {
 			/*
 			 * reset generation number to zero, guaranteed to be
 			 * "old"
diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index da0fcdb..ed51540 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -174,8 +174,9 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
 		free_rdstate(uds);
 		UNIONFS_F(file)->rdstate = NULL;
 		file->f_pos = DIREOF;
-	} else
+	} else {
 		file->f_pos = rdstate2offset(uds);
+	}
 
 out:
 	unionfs_read_unlock(file->f_path.dentry->d_sb);
@@ -242,8 +243,9 @@ static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)
 				if (rdstate) {
 					UNIONFS_F(file)->rdstate = rdstate;
 					err = rdstate->offset;
-				} else
+				} else {
 					err = -EINVAL;
+				}
 			}
 			break;
 		case SEEK_CUR:
diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index f0e1fee..8f4a304 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -111,9 +111,9 @@ int delete_whiteouts(struct dentry *dentry, int bindex,
 	BUG_ON(!S_ISDIR(lower_dir->i_mode));
 
 	mutex_lock(&lower_dir->i_mutex);
-	if (!permission(lower_dir, MAY_WRITE | MAY_EXEC, NULL))
+	if (!permission(lower_dir, MAY_WRITE | MAY_EXEC, NULL)) {
 		err = do_delete_whiteouts(dentry, bindex, namelist);
-	else {
+	} else {
 		args.deletewh.namelist = namelist;
 		args.deletewh.dentry = dentry;
 		args.deletewh.bindex = bindex;
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 49b5baf..3b58277 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -571,8 +571,9 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode)
 			if (!IS_COPYUP_ERR(err))
 				goto out;
 			bstart--;
-		} else
+		} else {
 			whiteout_unlinked = 1;
+		}
 	}
 
 	for (bindex = bstart; bindex >= 0; bindex--) {
@@ -718,8 +719,9 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
 			if (!IS_COPYUP_ERR(err))
 				goto out;
 			bstart--;
-		} else
+		} else {
 			whiteout_unlinked = 1;
+		}
 	}
 
 	for (bindex = bstart; bindex >= 0; bindex--) {
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 929f15b..a2c046b 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -47,11 +47,11 @@ static noinline int is_opaque_dir(struct dentry *dentry, int bindex)
 
 	mutex_lock(&lower_inode->i_mutex);
 
-	if (!permission(lower_inode, MAY_EXEC, NULL))
+	if (!permission(lower_inode, MAY_EXEC, NULL)) {
 		wh_lower_dentry =
 			lookup_one_len(UNIONFS_DIR_OPAQUE, lower_dentry,
 				       sizeof(UNIONFS_DIR_OPAQUE) - 1);
-	else {
+	} else {
 		args.is_opaque.dentry = lower_dentry;
 		run_sioq(__is_opaque_dir, &args);
 		wh_lower_dentry = args.ret;
@@ -250,8 +250,9 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
 				first_lower_mnt =
 					unionfs_mntget(parent_dentry, bindex);
 				first_dentry_offset = bindex;
-			} else
+			} else {
 				dput(lower_dentry);
+			}
 
 			continue;
 		}
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 25ac851..2fe6aaa 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -149,9 +149,9 @@ skip:
 		break;
 	case INTERPOSE_LOOKUP:
 		spliced = d_splice_alias(inode, dentry);
-		if (IS_ERR(spliced))
+		if (IS_ERR(spliced)) {
 			err = PTR_ERR(spliced);
-		else if (spliced && spliced != dentry) {
+		} else if (spliced && spliced != dentry) {
 			/*
 			 * d_splice can return a dentry if it was
 			 * disconnected and had to be moved.  We must ensure
diff --git a/fs/unionfs/rdstate.c b/fs/unionfs/rdstate.c
index 46cf2df..e96b6bc 100644
--- a/fs/unionfs/rdstate.c
+++ b/fs/unionfs/rdstate.c
@@ -260,9 +260,9 @@ int add_filldir_node(struct unionfs_dir_state *rdstate, const char *name,
 	new->bindex = bindex;
 	new->whiteout = whiteout;
 
-	if (namelen < DNAME_INLINE_LEN_MIN)
+	if (namelen < DNAME_INLINE_LEN_MIN) {
 		new->name = new->iname;
-	else {
+	} else {
 		new->name = kmalloc(namelen + 1, GFP_KERNEL);
 		if (unlikely(!new->name)) {
 			kmem_cache_free(unionfs_filldir_cachep, new);
diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index 81121f0..e6a2a3c 100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -83,8 +83,9 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		unlock_dir(lower_wh_dir_dentry);
 		if (err)
 			goto out;
-	} else
+	} else {
 		dput(lower_wh_dentry);
+	}
 
 	dget(lower_old_dentry);
 	lower_old_dir_dentry = dget_parent(lower_old_dentry);
@@ -178,8 +179,9 @@ static int do_unionfs_rename(struct inode *old_dir,
 		if (!IS_COPYUP_ERR(err))
 			goto out;
 		do_copyup = old_bstart - 1;
-	} else
+	} else {
 		revert = 1;
+	}
 
 	/*
 	 * Unlink all instances of destination that exist to the left of
@@ -271,9 +273,9 @@ static int do_unionfs_rename(struct inode *old_dir,
 		local_err = vfs_create(lower_parent->d_inode, wh_old, S_IRUGO,
 				       &nd);
 		unlock_dir(lower_parent);
-		if (!local_err)
+		if (!local_err) {
 			set_dbopaque(old_dentry, bwh_old);
-		else {
+		} else {
 			/*
 			 * we can't fix anything now, so we cop-out and use
 			 * -EIO.
@@ -392,8 +394,9 @@ static int may_rename_dir(struct dentry *dentry)
 	if (err == -ENOTEMPTY) {
 		if (is_robranch(dentry))
 			return -EXDEV;
-	} else if (err)
+	} else if (err) {
 		return err;
+	}
 
 	bstart = dbstart(dentry);
 	if (dbend(dentry) == bstart || dbopaque(dentry) == bstart)
@@ -443,9 +446,9 @@ int unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	 * simply override it even if the whited-out dir is not empty.
 	 */
 	wh_dentry = lookup_whiteout(new_dentry);
-	if (!IS_ERR(wh_dentry))
+	if (!IS_ERR(wh_dentry)) {
 		dput(wh_dentry);
-	else if (new_dentry->d_inode) {
+	} else if (new_dentry->d_inode) {
 		if (S_ISDIR(old_dentry->d_inode->i_mode) !=
 		    S_ISDIR(new_dentry->d_inode->i_mode)) {
 			err = S_ISDIR(old_dentry->d_inode->i_mode) ?
@@ -473,10 +476,10 @@ int unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	}
 	err = do_unionfs_rename(old_dir, old_dentry, new_dir, new_dentry);
 out:
-	if (err)
+	if (err) {
 		/* clear the new_dentry stuff created */
 		d_drop(new_dentry);
-	else {
+	} else {
 		/*
 		 * force re-lookup since the dir on ro branch is not renamed,
 		 * and lower dentries still indicate the un-renamed ones.
diff --git a/fs/unionfs/unlink.c b/fs/unionfs/unlink.c
index c5f6ed5..61a6fe1 100644
--- a/fs/unionfs/unlink.c
+++ b/fs/unionfs/unlink.c
@@ -55,11 +55,12 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)
 		if (dbstart(dentry) == 0)
 			goto out;
 		err = create_whiteout(dentry, dbstart(dentry) - 1);
-	} else if (dbopaque(dentry) != -1)
+	} else if (dbopaque(dentry) != -1) {
 		/* There is a lower lower-priority file with the same name. */
 		err = create_whiteout(dentry, dbopaque(dentry));
-	else
+	} else {
 		err = create_whiteout(dentry, dbstart(dentry));
+	}
 
 out:
 	if (!err)
@@ -161,9 +162,9 @@ int unionfs_rmdir(struct inode *dir, struct dentry *dentry)
 
 	err = unionfs_rmdir_first(dir, dentry, namelist);
 	/* create whiteout */
-	if (!err)
+	if (!err) {
 		err = create_whiteout(dentry, dbstart(dentry));
-	else {
+	} else {
 		int new_err;
 
 		if (dbstart(dentry) == 0)
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 15/19] Unionfs: coding style: proper spacing
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (13 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 14/19] Unionfs: use braces in both branches of conditionals Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 16/19] Unionfs: coding style: take assignments out of "if" conditions Erez Zadok
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/copyup.c |    2 +-
 fs/unionfs/debug.c  |   22 +++++++++++-----------
 fs/unionfs/dentry.c |    8 ++++----
 fs/unionfs/fanout.h |    2 +-
 fs/unionfs/super.c  |   14 +++++++-------
 fs/unionfs/union.h  |   38 +++++++++++++++++++-------------------
 6 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
index fb6fcae..560919a 100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@ -875,7 +875,7 @@ void unionfs_postcopyup_release(struct dentry *dentry)
 	int bindex;
 
 	BUG_ON(S_ISDIR(dentry->d_inode->i_mode));
-	for (bindex=dbstart(dentry)+1; bindex<=dbend(dentry); bindex++) {
+	for (bindex = dbstart(dentry)+1; bindex <= dbend(dentry); bindex++) {
 		if (unionfs_lower_mnt_idx(dentry, bindex)) {
 			unionfs_mntput(dentry, bindex);
 			unionfs_set_lower_mnt_idx(dentry, bindex, NULL);
diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
index 984f940..c0d710f 100644
--- a/fs/unionfs/debug.c
+++ b/fs/unionfs/debug.c
@@ -20,7 +20,7 @@
 #define PRINT_CALLER(fname, fxn, line)					\
 	do {								\
 		if (!printed_caller) {					\
-			pr_debug("PC:%s:%s:%d\n",(fname),(fxn),(line));	\
+			pr_debug("PC:%s:%s:%d\n", (fname), (fxn), (line)); \
 			printed_caller = 1;				\
 		}							\
 	} while (0)
@@ -310,7 +310,7 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 	/* check if lower inode is newer than upper one (it shouldn't) */
 	if (unlikely(is_newer_lower(dentry))) {
 		PRINT_CALLER(fname, fxn, line);
-		for (bindex=ibstart(inode); bindex <= ibend(inode); bindex++) {
+		for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
 			lower_inode = unionfs_lower_inode_idx(inode, bindex);
 			if (unlikely(!lower_inode))
 				continue;
@@ -413,7 +413,7 @@ void __unionfs_check_file(const struct file *file,
 		}
 	}
 
-	__unionfs_check_dentry(dentry,fname,fxn,line);
+	__unionfs_check_dentry(dentry, fname, fxn, line);
 }
 
 void __unionfs_check_nd(const struct nameidata *nd,
@@ -445,14 +445,14 @@ void __show_branch_counts(const struct super_block *sb,
 	struct vfsmount *mnt;
 
 	pr_debug("BC:");
-	for (i=0; i<sbmax(sb); i++) {
+	for (i = 0; i < sbmax(sb); i++) {
 		if (likely(sb->s_root))
 			mnt = UNIONFS_D(sb->s_root)->lower_paths[i].mnt;
 		else
 			mnt = NULL;
 		pr_debug("%d:", (mnt ? atomic_read(&mnt->mnt_count) : -99));
 	}
-	pr_debug("%s:%s:%d\n",file,fxn,line);
+	pr_debug("%s:%s:%d\n", file, fxn, line);
 }
 
 void __show_inode_times(const struct inode *inode,
@@ -461,12 +461,12 @@ void __show_inode_times(const struct inode *inode,
 	struct inode *lower_inode;
 	int bindex;
 
-	for (bindex=ibstart(inode); bindex <= ibend(inode); bindex++) {
+	for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (unlikely(!lower_inode))
 			continue;
 		pr_debug("IT(%lu:%d): ", inode->i_ino, bindex);
-		pr_debug("%s:%s:%d ",file,fxn,line);
+		pr_debug("%s:%s:%d ", file, fxn, line);
 		pr_debug("um=%lu/%lu lm=%lu/%lu ",
 			 inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
 			 lower_inode->i_mtime.tv_sec,
@@ -485,13 +485,13 @@ void __show_dinode_times(const struct dentry *dentry,
 	struct inode *lower_inode;
 	int bindex;
 
-	for (bindex=ibstart(inode); bindex <= ibend(inode); bindex++) {
+	for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (!lower_inode)
 			continue;
 		pr_debug("DT(%s:%lu:%d): ", dentry->d_name.name, inode->i_ino,
 			 bindex);
-		pr_debug("%s:%s:%d ",file,fxn,line);
+		pr_debug("%s:%s:%d ", file, fxn, line);
 		pr_debug("um=%lu/%lu lm=%lu/%lu ",
 			 inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
 			 lower_inode->i_mtime.tv_sec,
@@ -513,7 +513,7 @@ void __show_inode_counts(const struct inode *inode,
 		pr_debug("SiC: Null inode\n");
 		return;
 	}
-	for (bindex=sbstart(inode->i_sb); bindex <= sbend(inode->i_sb);
+	for (bindex = sbstart(inode->i_sb); bindex <= sbend(inode->i_sb);
 	     bindex++) {
 		lower_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (unlikely(!lower_inode))
@@ -521,6 +521,6 @@ void __show_inode_counts(const struct inode *inode,
 		pr_debug("SIC(%lu:%d:%d): ", inode->i_ino, bindex,
 			 atomic_read(&(inode)->i_count));
 		pr_debug("lc=%d ", atomic_read(&(lower_inode)->i_count));
-		pr_debug("%s:%s:%d\n",file,fxn,line);
+		pr_debug("%s:%s:%d\n", file, fxn, line);
 	}
 }
diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 8891c53..49323de 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -337,7 +337,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,
 	 * if failed, then sleep for a little, then retry.
 	 */
 	dtmp = dentry->d_parent;
-	for (i=chain_len-1; i>=0; i--) {
+	for (i = chain_len-1; i >= 0; i--) {
 		chain[i] = dget(dtmp);
 		dtmp = dtmp->d_parent;
 	}
@@ -346,7 +346,7 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,
 	 * call __unionfs_d_revalidate_one() on each dentry, but in parent
 	 * to child order.
 	 */
-	for (i=0; i<chain_len; i++) {
+	for (i = 0; i < chain_len; i++) {
 		unionfs_lock_dentry(chain[i]);
 		saved_bstart = dbstart(chain[i]);
 		saved_bend = dbend(chain[i]);
@@ -409,7 +409,7 @@ out_this:
 out_free:
 	/* unlock/dput all dentries in chain and return status */
 	if (chain_len > 0) {
-		for (i=0; i<chain_len; i++)
+		for (i = 0; i < chain_len; i++)
 			dput(chain[i]);
 		kfree(chain);
 	}
@@ -467,7 +467,7 @@ static void unionfs_d_release(struct dentry *dentry)
 		dput(unionfs_lower_dentry_idx(dentry, bindex));
 		unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
 		/* NULL lower mnt is ok if this is a negative dentry */
-		if (!dentry->d_inode && !unionfs_lower_mnt_idx(dentry,bindex))
+		if (!dentry->d_inode && !unionfs_lower_mnt_idx(dentry, bindex))
 			continue;
 		unionfs_mntput(dentry, bindex);
 		unionfs_set_lower_mnt_idx(dentry, bindex, NULL);
diff --git a/fs/unionfs/fanout.h b/fs/unionfs/fanout.h
index 536a51f..8d5f15e 100644
--- a/fs/unionfs/fanout.h
+++ b/fs/unionfs/fanout.h
@@ -310,7 +310,7 @@ static inline void unionfs_copy_attr_times(struct inode *upper)
 
 	if (!upper || ibstart(upper) < 0)
 		return;
-	for (bindex=ibstart(upper); bindex <= ibend(upper); bindex++) {
+	for (bindex = ibstart(upper); bindex <= ibend(upper); bindex++) {
 		lower = unionfs_lower_inode_idx(upper, bindex);
 		if (!lower)
 			continue; /* not all lower dir objects may exist */
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 647b08c..45dc66e 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -202,7 +202,7 @@ static noinline int do_remount_mode_option(char *optarg, int cur_branches,
 		       optarg, err);
 		goto out;
 	}
-	for (idx=0; idx<cur_branches; idx++)
+	for (idx = 0; idx < cur_branches; idx++)
 		if (nd.mnt == new_lower_paths[idx].mnt &&
 		    nd.dentry == new_lower_paths[idx].dentry)
 			break;
@@ -245,7 +245,7 @@ static noinline int do_remount_del_option(char *optarg, int cur_branches,
 		       optarg, err);
 		goto out;
 	}
-	for (idx=0; idx < cur_branches; idx++)
+	for (idx = 0; idx < cur_branches; idx++)
 		if (nd.mnt == new_lower_paths[idx].mnt &&
 		    nd.dentry == new_lower_paths[idx].dentry)
 			break;
@@ -329,7 +329,7 @@ static noinline int do_remount_add_option(char *optarg, int cur_branches,
 		       optarg, err);
 		goto out;
 	}
-	for (idx=0; idx < cur_branches; idx++)
+	for (idx = 0; idx < cur_branches; idx++)
 		if (nd.mnt == new_lower_paths[idx].mnt &&
 		    nd.dentry == new_lower_paths[idx].dentry)
 			break;
@@ -540,7 +540,7 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,
 	       cur_branches * sizeof(struct unionfs_data));
 	memcpy(tmp_lower_paths, UNIONFS_D(sb->s_root)->lower_paths,
 	       cur_branches * sizeof(struct path));
-	for (i=0; i<cur_branches; i++)
+	for (i = 0; i < cur_branches; i++)
 		pathget(&tmp_lower_paths[i]); /* drop refs at end of fxn */
 
 	/*******************************************************************
@@ -743,14 +743,14 @@ out_no_change:
 	 * Update lower inodes: 3 steps
 	 * 1. grab ref on all new lower inodes
 	 */
-	for (i=dbstart(sb->s_root); i<=dbend(sb->s_root); i++) {
+	for (i = dbstart(sb->s_root); i <= dbend(sb->s_root); i++) {
 		struct dentry *lower_dentry =
 			unionfs_lower_dentry_idx(sb->s_root, i);
 		igrab(lower_dentry->d_inode);
 		new_lower_inodes[i] = lower_dentry->d_inode;
 	}
 	/* 2. release reference on all older lower inodes */
-	for (i=old_ibstart; i<=old_ibend; i++) {
+	for (i = old_ibstart; i <= old_ibend; i++) {
 		iput(unionfs_lower_inode_idx(sb->s_root->d_inode, i));
 		unionfs_set_lower_inode_idx(sb->s_root->d_inode, i, NULL);
 	}
@@ -785,7 +785,7 @@ out_no_change:
 out_release:
 	/* no need to cleanup/release anything in tmp_data */
 	if (tmp_lower_paths)
-		for (i=0; i<new_branches; i++)
+		for (i = 0; i < new_branches; i++)
 			pathput(&tmp_lower_paths[i]);
 out_free:
 	kfree(tmp_lower_paths);
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index bd1a0f3..ee8324c 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -392,7 +392,7 @@ static inline int is_robranch_super(const struct super_block *sb, int index)
 {
 	int ret;
 
-  	ret = (!(branchperms(sb, index) & MAY_WRITE)) ? -EROFS : 0;
+	ret = (!(branchperms(sb, index) & MAY_WRITE)) ? -EROFS : 0;
 	return ret;
 }
 
@@ -507,24 +507,24 @@ static inline void unionfs_mntput(struct dentry *dentry, int bindex)
 #ifdef CONFIG_UNION_FS_DEBUG
 
 /* useful for tracking code reachability */
-#define UDBG pr_debug("DBG:%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__)
+#define UDBG pr_debug("DBG:%s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__)
 
 #define unionfs_check_inode(i)	__unionfs_check_inode((i),	\
-	__FILE__,__FUNCTION__,__LINE__)
+	__FILE__, __FUNCTION__, __LINE__)
 #define unionfs_check_dentry(d)	__unionfs_check_dentry((d),	\
-	__FILE__,__FUNCTION__,__LINE__)
+	__FILE__, __FUNCTION__, __LINE__)
 #define unionfs_check_file(f)	__unionfs_check_file((f),	\
-	__FILE__,__FUNCTION__,__LINE__)
+	__FILE__, __FUNCTION__, __LINE__)
 #define unionfs_check_nd(n)	__unionfs_check_nd((n),		\
-	__FILE__,__FUNCTION__,__LINE__)
+	__FILE__, __FUNCTION__, __LINE__)
 #define show_branch_counts(sb)	__show_branch_counts((sb),	\
-	__FILE__,__FUNCTION__,__LINE__)
+	__FILE__, __FUNCTION__, __LINE__)
 #define show_inode_times(i)	__show_inode_times((i),		\
-	__FILE__,__FUNCTION__,__LINE__)
+	__FILE__, __FUNCTION__, __LINE__)
 #define show_dinode_times(d)	__show_dinode_times((d),	\
-	__FILE__,__FUNCTION__,__LINE__)
+	__FILE__, __FUNCTION__, __LINE__)
 #define show_inode_counts(i)	__show_inode_counts((i),	\
-	__FILE__,__FUNCTION__,__LINE__)
+	__FILE__, __FUNCTION__, __LINE__)
 
 extern void __unionfs_check_inode(const struct inode *inode, const char *fname,
 				  const char *fxn, int line);
@@ -542,19 +542,19 @@ extern void __show_inode_times(const struct inode *inode,
 extern void __show_dinode_times(const struct dentry *dentry,
 				const char *file, const char *fxn, int line);
 extern void __show_inode_counts(const struct inode *inode,
-			        const char *file, const char *fxn, int line);
+				const char *file, const char *fxn, int line);
 
 #else /* not CONFIG_UNION_FS_DEBUG */
 
 /* we leave useful hooks for these check functions throughout the code */
-#define unionfs_check_inode(i)		do { } while(0)
-#define unionfs_check_dentry(d)		do { } while(0)
-#define unionfs_check_file(f)		do { } while(0)
-#define unionfs_check_nd(n)		do { } while(0)
-#define show_branch_counts(sb)		do { } while(0)
-#define show_inode_times(i)		do { } while(0)
-#define show_dinode_times(d)		do { } while(0)
-#define show_inode_counts(i)		do { } while(0)
+#define unionfs_check_inode(i)		do { } while (0)
+#define unionfs_check_dentry(d)		do { } while (0)
+#define unionfs_check_file(f)		do { } while (0)
+#define unionfs_check_nd(n)		do { } while (0)
+#define show_branch_counts(sb)		do { } while (0)
+#define show_inode_times(i)		do { } while (0)
+#define show_dinode_times(d)		do { } while (0)
+#define show_inode_counts(i)		do { } while (0)
 
 #endif /* not CONFIG_UNION_FS_DEBUG */
 
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 16/19] Unionfs: coding style: take assignments out of "if" conditions
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (14 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 15/19] Unionfs: coding style: proper spacing Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 17/19] Unionfs: coding style: avoid multiple assignments on same line Erez Zadok
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/commonfops.c |   12 ++++++++----
 fs/unionfs/copyup.c     |    9 ++++++---
 fs/unionfs/dirfops.c    |    6 ++++--
 fs/unionfs/dirhelper.c  |    3 ++-
 fs/unionfs/file.c       |   18 ++++++++++++------
 fs/unionfs/inode.c      |   18 ++++++++++++------
 fs/unionfs/lookup.c     |    6 ++++--
 fs/unionfs/main.c       |   18 ++++++++++++------
 fs/unionfs/mmap.c       |    6 ++++--
 fs/unionfs/rdstate.c    |    3 ++-
 fs/unionfs/rename.c     |    6 ++++--
 fs/unionfs/subr.c       |    3 ++-
 fs/unionfs/super.c      |    3 ++-
 fs/unionfs/unlink.c     |    9 ++++++---
 14 files changed, 80 insertions(+), 40 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index f7da687..6f2970d 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -614,7 +614,8 @@ int unionfs_file_release(struct inode *inode, struct file *file)
 	 * This is important for open-but-unlinked files, as well as mmap
 	 * support.
 	 */
-	if (unlikely((err = unionfs_file_revalidate(file, true))))
+	err = unionfs_file_revalidate(file, true);
+	if (unlikely(err))
 		goto out;
 	unionfs_check_file(file);
 	fileinfo = UNIONFS_F(file);
@@ -707,7 +708,8 @@ static int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd,
 	unionfs_lock_dentry(dentry);
 	orig_bstart = dbstart(dentry);
 	orig_bend = dbend(dentry);
-	if ((err = unionfs_partial_lookup(dentry)))
+	err = unionfs_partial_lookup(dentry);
+	if (err)
 		goto out;
 	bstart = dbstart(dentry);
 	bend = dbend(dentry);
@@ -755,7 +757,8 @@ long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
 
-	if (unlikely((err = unionfs_file_revalidate(file, true))))
+	err = unionfs_file_revalidate(file, true);
+	if (unlikely(err))
 		goto out;
 
 	/* check if asked for local commands */
@@ -793,7 +796,8 @@ int unionfs_flush(struct file *file, fl_owner_t id)
 
 	unionfs_read_lock(dentry->d_sb);
 
-	if (unlikely((err = unionfs_file_revalidate(file, true))))
+	err = unionfs_file_revalidate(file, true);
+	if (unlikely(err))
 		goto out;
 	unionfs_check_file(file);
 
diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
index 560919a..98bed0b 100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@ -394,7 +394,8 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,
 
 	sb = dir->i_sb;
 
-	if ((err = is_robranch_super(sb, new_bindex)))
+	err = is_robranch_super(sb, new_bindex);
+	if (err)
 		goto out;
 
 	/* Create the directory structure above this dentry. */
@@ -465,7 +466,8 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,
 
 #ifdef CONFIG_UNION_FS_XATTR
 	/* Selinux uses extended attributes for permissions. */
-	if ((err = copyup_xattrs(old_lower_dentry, new_lower_dentry)))
+	err = copyup_xattrs(old_lower_dentry, new_lower_dentry);
+	if (err)
 		goto out_unlink;
 #endif /* CONFIG_UNION_FS_XATTR */
 
@@ -679,7 +681,8 @@ struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
 
 	verify_locked(dentry);
 
-	if ((err = is_robranch_super(dir->i_sb, bindex))) {
+	err = is_robranch_super(dir->i_sb, bindex);
+	if (err) {
 		lower_dentry = ERR_PTR(err);
 		goto out;
 	}
diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index ed51540..0064723 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -97,7 +97,8 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
 
-	if (unlikely((err = unionfs_file_revalidate(file, false))))
+	err = unionfs_file_revalidate(file, false);
+	if (unlikely(err))
 		goto out;
 
 	inode = file->f_path.dentry->d_inode;
@@ -200,7 +201,8 @@ static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
 
-	if (unlikely((err = unionfs_file_revalidate(file, false))))
+	err = unionfs_file_revalidate(file, false);
+	if (unlikely(err))
 		goto out;
 
 	rdstate = UNIONFS_F(file)->rdstate;
diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index 8f4a304..7a28444 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -194,7 +194,8 @@ int check_empty(struct dentry *dentry, struct unionfs_dir_state **namelist)
 
 	BUG_ON(!S_ISDIR(dentry->d_inode->i_mode));
 
-	if ((err = unionfs_partial_lookup(dentry)))
+	err = unionfs_partial_lookup(dentry);
+	if (err)
 		goto out;
 
 	bstart = dbstart(dentry);
diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c
index 923f134..126df5e 100644
--- a/fs/unionfs/file.c
+++ b/fs/unionfs/file.c
@@ -24,7 +24,8 @@ static ssize_t unionfs_read(struct file *file, char __user *buf,
 	int err;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if (unlikely((err = unionfs_file_revalidate(file, false))))
+	err = unionfs_file_revalidate(file, false);
+	if (unlikely(err))
 		goto out;
 	unionfs_check_file(file);
 
@@ -47,7 +48,8 @@ static ssize_t unionfs_aio_read(struct kiocb *iocb, const struct iovec *iov,
 	struct file *file = iocb->ki_filp;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if (unlikely((err = unionfs_file_revalidate(file, false))))
+	err = unionfs_file_revalidate(file, false);
+	if (unlikely(err))
 		goto out;
 	unionfs_check_file(file);
 
@@ -72,7 +74,8 @@ static ssize_t unionfs_write(struct file *file, const char __user *buf,
 	int err = 0;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if (unlikely((err = unionfs_file_revalidate(file, true))))
+	err = unionfs_file_revalidate(file, true);
+	if (unlikely(err))
 		goto out;
 	unionfs_check_file(file);
 
@@ -104,7 +107,8 @@ static int unionfs_mmap(struct file *file, struct vm_area_struct *vma)
 
 	/* This might be deferred to mmap's writepage */
 	willwrite = ((vma->vm_flags | VM_SHARED | VM_WRITE) == vma->vm_flags);
-	if (unlikely((err = unionfs_file_revalidate(file, willwrite))))
+	err = unionfs_file_revalidate(file, willwrite);
+	if (unlikely(err))
 		goto out;
 	unionfs_check_file(file);
 
@@ -150,7 +154,8 @@ int unionfs_fsync(struct file *file, struct dentry *dentry, int datasync)
 	int err = -EINVAL;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if (unlikely((err = unionfs_file_revalidate(file, true))))
+	err = unionfs_file_revalidate(file, true);
+	if (unlikely(err))
 		goto out;
 	unionfs_check_file(file);
 
@@ -197,7 +202,8 @@ int unionfs_fasync(int fd, struct file *file, int flag)
 	int err = 0;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if (unlikely((err = unionfs_file_revalidate(file, true))))
+	err = unionfs_file_revalidate(file, true);
+	if (unlikely(err))
 		goto out;
 	unionfs_check_file(file);
 
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 3b58277..4e59ace 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -51,7 +51,8 @@ static int unionfs_create(struct inode *parent, struct dentry *dentry,
 	 * bit redundant as we don't allow branch 0 to be read-only at the
 	 * moment
 	 */
-	if ((err = is_robranch_super(dentry->d_sb, 0))) {
+	err = is_robranch_super(dentry->d_sb, 0);
+	if (err) {
 		err = -EROFS;
 		goto out;
 	}
@@ -278,7 +279,8 @@ static int unionfs_link(struct dentry *old_dentry, struct inode *dir,
 
 	BUG_ON(dbstart(old_dentry) != dbstart(new_dentry));
 	lower_dir_dentry = lock_parent(lower_new_dentry);
-	if (!(err = is_robranch(old_dentry)))
+	err = is_robranch(old_dentry);
+	if (!err)
 		err = vfs_link(lower_old_dentry, lower_dir_dentry->d_inode,
 			       lower_new_dentry);
 	unlock_dir(lower_dir_dentry);
@@ -401,7 +403,8 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,
 		 */
 		lower_dir_dentry = lock_parent(whiteout_dentry);
 
-		if (!(err = is_robranch_super(dentry->d_sb, bstart)))
+		err = is_robranch_super(dentry->d_sb, bstart);
+		if (!err)
 			err = vfs_unlink(lower_dir_dentry->d_inode,
 					 whiteout_dentry);
 		dput(whiteout_dentry);
@@ -455,7 +458,8 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,
 
 		lower_dir_dentry = lock_parent(lower_dentry);
 
-		if (!(err = is_robranch_super(dentry->d_sb, bindex))) {
+		err = is_robranch_super(dentry->d_sb, bindex);
+		if (!err) {
 			mode = S_IALLUGO;
 			err = vfs_symlink(lower_dir_dentry->d_inode,
 					  lower_dentry, symname, mode);
@@ -556,7 +560,8 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode)
 		lower_parent_dentry = lock_parent(whiteout_dentry);
 
 		/* found a.wh.foo entry, remove it then do vfs_mkdir */
-		if (!(err = is_robranch_super(dentry->d_sb, bstart))) {
+		err = is_robranch_super(dentry->d_sb, bstart);
+		if (!err) {
 			args.unlink.parent = lower_parent_dentry->d_inode;
 			args.unlink.dentry = whiteout_dentry;
 			run_sioq(__unionfs_unlink, &args);
@@ -708,7 +713,8 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
 		lower_parent_dentry = lock_parent(whiteout_dentry);
 
 		/* found a.wh.foo entry, remove it then do vfs_mkdir */
-		if (!(err = is_robranch_super(dentry->d_sb, bstart)))
+		err = is_robranch_super(dentry->d_sb, bstart);
+		if (!err)
 			err = vfs_unlink(lower_parent_dentry->d_inode,
 					 whiteout_dentry);
 		dput(whiteout_dentry);
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index a2c046b..a1904c9 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -119,12 +119,14 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
 	case INTERPOSE_PARTIAL:
 		break;
 	case INTERPOSE_LOOKUP:
-		if (unlikely((err = new_dentry_private_data(dentry))))
+		err = new_dentry_private_data(dentry);
+		if (unlikely(err))
 			goto out;
 		break;
 	default:
 		/* default: can only be INTERPOSE_REVAL/REVAL_NEG */
-		if (unlikely((err = realloc_dentry_private_data(dentry))))
+		err = realloc_dentry_private_data(dentry);
+		if (unlikely(err))
 			goto out;
 		break;
 	}
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 2fe6aaa..ffb0da1 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -364,7 +364,8 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info
 			goto out;
 		}
 
-		if ((err = check_branch(&nd))) {
+		err = check_branch(&nd);
+		if (err) {
 			printk(KERN_ERR "unionfs: lower directory "
 			       "'%s' is not a valid branch\n", name);
 			path_release(&nd);
@@ -648,7 +649,8 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,
 
 	/* link the upper and lower dentries */
 	sb->s_root->d_fsdata = NULL;
-	if (unlikely((err = new_dentry_private_data(sb->s_root))))
+	err = new_dentry_private_data(sb->s_root);
+	if (unlikely(err))
 		goto out_freedpd;
 
 	/* Set the lower dentries for s_root */
@@ -738,13 +740,17 @@ static int __init init_unionfs_fs(void)
 
 	pr_info("Registering unionfs " UNIONFS_VERSION "\n");
 
-	if (unlikely((err = unionfs_init_filldir_cache())))
+	err = unionfs_init_filldir_cache();
+	if (unlikely(err))
 		goto out;
-	if (unlikely((err = unionfs_init_inode_cache())))
+	err = unionfs_init_inode_cache();
+	if (unlikely(err))
 		goto out;
-	if (unlikely((err = unionfs_init_dentry_cache())))
+	err = unionfs_init_dentry_cache();
+	if (unlikely(err))
 		goto out;
-	if (unlikely((err = init_sioq())))
+	err = init_sioq();
+	if (unlikely(err))
 		goto out;
 	err = register_filesystem(&unionfs_fs_type);
 out:
diff --git a/fs/unionfs/mmap.c b/fs/unionfs/mmap.c
index 37ad761..ac1a060 100644
--- a/fs/unionfs/mmap.c
+++ b/fs/unionfs/mmap.c
@@ -211,7 +211,8 @@ static int unionfs_readpage(struct file *file, struct page *page)
 	int err;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if (unlikely((err = unionfs_file_revalidate(file, false))))
+	err = unionfs_file_revalidate(file, false);
+	if (unlikely(err))
 		goto out;
 	unionfs_check_file(file);
 
@@ -275,7 +276,8 @@ static int unionfs_commit_write(struct file *file, struct page *page,
 	BUG_ON(file == NULL);
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
-	if (unlikely((err = unionfs_file_revalidate(file, true))))
+	err = unionfs_file_revalidate(file, true);
+	if (unlikely(err))
 		goto out;
 	unionfs_check_file(file);
 
diff --git a/fs/unionfs/rdstate.c b/fs/unionfs/rdstate.c
index e96b6bc..93ea588 100644
--- a/fs/unionfs/rdstate.c
+++ b/fs/unionfs/rdstate.c
@@ -72,7 +72,8 @@ static int guesstimate_hash_size(struct inode *inode)
 		return UNIONFS_I(inode)->hashsize;
 
 	for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
-		if (!(lower_inode = unionfs_lower_inode_idx(inode, bindex)))
+		lower_inode = unionfs_lower_inode_idx(inode, bindex);
+		if (!lower_inode)
 			continue;
 
 		if (lower_inode->i_size == DENTPAGE)
diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index e6a2a3c..91d41d4 100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -75,7 +75,8 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		}
 
 		lower_wh_dir_dentry = lock_parent(lower_wh_dentry);
-		if (!(err = is_robranch_super(old_dentry->d_sb, bindex)))
+		err = is_robranch_super(old_dentry->d_sb, bindex);
+		if (!err)
 			err = vfs_unlink(lower_wh_dir_dentry->d_inode,
 					 lower_wh_dentry);
 
@@ -196,7 +197,8 @@ static int do_unionfs_rename(struct inode *old_dir,
 			continue;
 
 		unlink_dir_dentry = lock_parent(unlink_dentry);
-		if (!(err = is_robranch_super(old_dir->i_sb, bindex)))
+		err = is_robranch_super(old_dir->i_sb, bindex);
+		if (!err)
 			err = vfs_unlink(unlink_dir_dentry->d_inode,
 					 unlink_dentry);
 
diff --git a/fs/unionfs/subr.c b/fs/unionfs/subr.c
index ab409ce..d97086a 100644
--- a/fs/unionfs/subr.c
+++ b/fs/unionfs/subr.c
@@ -87,7 +87,8 @@ int create_whiteout(struct dentry *dentry, int start)
 		if (unlikely(err < 0))
 			goto out;
 		lower_dir_dentry = lock_parent(lower_wh_dentry);
-		if (!(err = is_robranch_super(dentry->d_sb, bindex)))
+		err = is_robranch_super(dentry->d_sb, bindex);
+		if (!err)
 			err = vfs_create(lower_dir_dentry->d_inode,
 					 lower_wh_dentry,
 					 ~current->fs->umask & S_IRWXUGO,
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 45dc66e..0da9181 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -372,7 +372,8 @@ found_insertion_point:
 	 * because this code base doesn't support stacking unionfs: the ODF
 	 * code base supports that correctly.
 	 */
-	if ((err = check_branch(&nd))) {
+	err = check_branch(&nd);
+	if (err) {
 		printk(KERN_ERR "unionfs: lower directory "
 		       "\"%s\" is not a valid branch\n", optarg);
 		path_release(&nd);
diff --git a/fs/unionfs/unlink.c b/fs/unionfs/unlink.c
index 61a6fe1..a8de672 100644
--- a/fs/unionfs/unlink.c
+++ b/fs/unionfs/unlink.c
@@ -26,7 +26,8 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)
 	int bindex;
 	int err = 0;
 
-	if ((err = unionfs_partial_lookup(dentry)))
+	err = unionfs_partial_lookup(dentry);
+	if (err)
 		goto out;
 
 	bindex = dbstart(dentry);
@@ -39,7 +40,8 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)
 
 	/* avoid destroying the lower inode if the file is in use */
 	dget(lower_dentry);
-	if (!(err = is_robranch_super(dentry->d_sb, bindex)))
+	err = is_robranch_super(dentry->d_sb, bindex);
+	if (!err)
 		err = vfs_unlink(lower_dir_dentry->d_inode, lower_dentry);
 	/* if vfs_unlink succeeded, update our inode's times */
 	if (!err)
@@ -127,7 +129,8 @@ static int unionfs_rmdir_first(struct inode *dir, struct dentry *dentry,
 
 	/* avoid destroying the lower inode if the file is in use */
 	dget(lower_dentry);
-	if (!(err = is_robranch(dentry)))
+	err = is_robranch(dentry);
+	if (!err)
 		err = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry);
 	dput(lower_dentry);
 
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 17/19] Unionfs: coding style: avoid multiple assignments on same line
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (15 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 16/19] Unionfs: coding style: take assignments out of "if" conditions Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 18/19] Unionfs: coding style: miscellaneous fixes Erez Zadok
  2007-10-01  5:50 ` [PATCH 19/19] Unionfs: coding style: avoid lines longer than 80 chars Erez Zadok
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/mmap.c  |    3 ++-
 fs/unionfs/super.c |    9 ++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/unionfs/mmap.c b/fs/unionfs/mmap.c
index ac1a060..6440282 100644
--- a/fs/unionfs/mmap.c
+++ b/fs/unionfs/mmap.c
@@ -179,7 +179,8 @@ static int unionfs_do_readpage(struct file *file, struct page *page)
 	 * may be a little slower, but a lot safer, as the VFS does a lot of
 	 * the necessary magic for us.
 	 */
-	offset = lower_file->f_pos = page_offset(page);
+	lower_file->f_pos = page_offset(page);
+	offset = page_offset(page);
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
 	err = vfs_read(lower_file, page_data, PAGE_CACHE_SIZE,
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 0da9181..0a0b075 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -477,13 +477,16 @@ static int unionfs_remount_fs(struct super_block *sb, int *flags,
 	 * "add" and "del" commands.  Copy the "options" string because
 	 * strsep modifies the string and we need it later.
 	 */
-	optionstmp = tmp_to_free = kstrdup(options, GFP_KERNEL);
+	tmp_to_free = kstrdup(options, GFP_KERNEL);
+	optionstmp = tmp_to_free;
 	if (unlikely(!optionstmp)) {
 		err = -ENOMEM;
 		goto out_free;
 	}
-	new_branches = cur_branches = sbmax(sb); /* current no. branches */
-	add_branches = del_branches = 0;
+	cur_branches = sbmax(sb); /* current no. branches */
+	new_branches = sbmax(sb);
+	del_branches = 0;
+	add_branches = 0;
 	new_high_branch_id = sbhbid(sb); /* save current high_branch_id */
 	while ((optname = strsep(&optionstmp, ",")) != NULL) {
 		char *optarg;
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 18/19] Unionfs: coding style: miscellaneous fixes
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (16 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 17/19] Unionfs: coding style: avoid multiple assignments on same line Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  2007-10-01  5:50 ` [PATCH 19/19] Unionfs: coding style: avoid lines longer than 80 chars Erez Zadok
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

No braces around single-statement if's.
No externs in .c files.
use <linux/mman.h> not <asm/mman.h>.
Use (foo *) not (foo*).

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/rdstate.c |    3 +--
 fs/unionfs/super.c   |    3 +--
 fs/unionfs/union.h   |    3 ++-
 fs/unionfs/xattr.c   |    6 +++---
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/fs/unionfs/rdstate.c b/fs/unionfs/rdstate.c
index 93ea588..0df5f52 100644
--- a/fs/unionfs/rdstate.c
+++ b/fs/unionfs/rdstate.c
@@ -218,12 +218,11 @@ struct filldir_node *find_filldir_node(struct unionfs_dir_state *rdstate,
 			 * if the duplicate is in this branch, then the file
 			 * system is corrupted.
 			 */
-			if (unlikely(cursor->bindex == rdstate->bindex)) {
+			if (unlikely(cursor->bindex == rdstate->bindex))
 				printk(KERN_ERR "unionfs: filldir: possible "
 				       "I/O error: a file is duplicated "
 				       "in the same branch %d: %s\n",
 				       rdstate->bindex, cursor->name);
-			}
 			break;
 		}
 	}
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 0a0b075..515689d 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -26,7 +26,6 @@ static struct kmem_cache *unionfs_inode_cachep;
 
 static void unionfs_read_inode(struct inode *inode)
 {
-	extern struct address_space_operations unionfs_aops;
 	int size;
 	struct unionfs_inode_info *info = UNIONFS_I(inode);
 
@@ -965,7 +964,7 @@ static int unionfs_show_options(struct seq_file *m, struct vfsmount *mnt)
 
 	unionfs_lock_dentry(sb->s_root);
 
-	tmp_page = (char*) __get_free_page(GFP_KERNEL);
+	tmp_page = (char *) __get_free_page(GFP_KERNEL);
 	if (unlikely(!tmp_page)) {
 		ret = -ENOMEM;
 		goto out;
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index ee8324c..8eb2ee4 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -44,8 +44,8 @@
 #include <linux/magic.h>
 #include <linux/log2.h>
 #include <linux/poison.h>
+#include <linux/mman.h>
 
-#include <asm/mman.h>
 #include <asm/system.h>
 
 #include <linux/union_fs.h>
@@ -70,6 +70,7 @@ extern struct inode_operations unionfs_dir_iops;
 extern struct inode_operations unionfs_symlink_iops;
 extern struct super_operations unionfs_sops;
 extern struct dentry_operations unionfs_dops;
+extern struct address_space_operations unionfs_aops;
 
 /* How long should an entry be allowed to persist */
 #define RDCACHE_JIFFIES	(5*HZ)
diff --git a/fs/unionfs/xattr.c b/fs/unionfs/xattr.c
index 71ff7d0..602cedf 100644
--- a/fs/unionfs/xattr.c
+++ b/fs/unionfs/xattr.c
@@ -55,7 +55,7 @@ ssize_t unionfs_getxattr(struct dentry *dentry, const char *name, void *value,
 
 	lower_dentry = unionfs_lower_dentry(dentry);
 
-	err = vfs_getxattr(lower_dentry, (char*) name, value, size);
+	err = vfs_getxattr(lower_dentry, (char *) name, value, size);
 
 out:
 	unionfs_unlock_dentry(dentry);
@@ -84,7 +84,7 @@ int unionfs_setxattr(struct dentry *dentry, const char *name,
 
 	lower_dentry = unionfs_lower_dentry(dentry);
 
-	err = vfs_setxattr(lower_dentry, (char*) name, (void*) value,
+	err = vfs_setxattr(lower_dentry, (char *) name, (void *) value,
 			   size, flags);
 
 out:
@@ -113,7 +113,7 @@ int unionfs_removexattr(struct dentry *dentry, const char *name)
 
 	lower_dentry = unionfs_lower_dentry(dentry);
 
-	err = vfs_removexattr(lower_dentry, (char*) name);
+	err = vfs_removexattr(lower_dentry, (char *) name);
 
 out:
 	unionfs_unlock_dentry(dentry);
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 19/19] Unionfs: coding style: avoid lines longer than 80 chars
  2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
                   ` (17 preceding siblings ...)
  2007-10-01  5:50 ` [PATCH 18/19] Unionfs: coding style: miscellaneous fixes Erez Zadok
@ 2007-10-01  5:50 ` Erez Zadok
  18 siblings, 0 replies; 20+ messages in thread
From: Erez Zadok @ 2007-10-01  5:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/commonfops.c |   18 ++++++-----
 fs/unionfs/debug.c      |   80 +++++++++++++++++++++++-----------------------
 fs/unionfs/dentry.c     |    3 +-
 fs/unionfs/dirfops.c    |    8 +++--
 fs/unionfs/fanout.h     |    9 +++--
 5 files changed, 63 insertions(+), 55 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 6f2970d..7654bcb 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -339,7 +339,8 @@ int unionfs_file_revalidate(struct file *file, bool willwrite)
 	if (unlikely(!d_deleted(dentry) &&
 		     (sbgen > fgen || dbstart(dentry) != fbstart(file)))) {
 		/* save orig branch ID */
-		int orig_brid =	UNIONFS_F(file)->saved_branch_ids[fbstart(file)];
+		int orig_brid =
+			UNIONFS_F(file)->saved_branch_ids[fbstart(file)];
 
 		/* First we throw out the existing files. */
 		cleanup_file(file);
@@ -388,7 +389,8 @@ int unionfs_file_revalidate(struct file *file, bool willwrite)
 			}
 		}
 		atomic_set(&UNIONFS_F(file)->generation,
-			   atomic_read(&UNIONFS_I(dentry->d_inode)->generation));
+			   atomic_read(
+				   &UNIONFS_I(dentry->d_inode)->generation));
 	}
 
 	/* Copyup on the first write to a file on a readonly branch. */
@@ -418,6 +420,7 @@ static int __open_dir(struct inode *inode, struct file *file)
 	struct dentry *lower_dentry;
 	struct file *lower_file;
 	int bindex, bstart, bend;
+	struct vfsmount *mnt;
 
 	bstart = fbstart(file) = dbstart(file->f_path.dentry);
 	bend = fbend(file) = dbend(file->f_path.dentry);
@@ -430,10 +433,8 @@ static int __open_dir(struct inode *inode, struct file *file)
 
 		dget(lower_dentry);
 		unionfs_mntget(file->f_path.dentry, bindex);
-		lower_file = dentry_open(lower_dentry,
-					 unionfs_lower_mnt_idx(file->f_path.dentry,
-							       bindex),
-					 file->f_flags);
+		mnt = unionfs_lower_mnt_idx(file->f_path.dentry, bindex);
+		lower_file = dentry_open(lower_dentry, mnt, file->f_flags);
 		if (IS_ERR(lower_file))
 			return PTR_ERR(lower_file);
 
@@ -679,8 +680,9 @@ static long do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		err = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg);
 	} else if (lower_file->f_op->ioctl) {
 		lock_kernel();
-		err = lower_file->f_op->ioctl(lower_file->f_path.dentry->d_inode,
-					      lower_file, cmd, arg);
+		err = lower_file->f_op->ioctl(
+			lower_file->f_path.dentry->d_inode,
+			lower_file, cmd, arg);
 		unlock_kernel();
 	}
 
diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
index c0d710f..68692d7 100644
--- a/fs/unionfs/debug.c
+++ b/fs/unionfs/debug.c
@@ -157,27 +157,26 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 					 bindex, dstart, dend);
 			}
 		} else {	/* lower_dentry == NULL */
-			if (bindex >= dstart && bindex <= dend) {
-				/*
-				 * Directories can have NULL lower inodes in
-				 * b/t start/end, but NOT if at the
-				 * start/end range.  Ignore this rule,
-				 * however, if this is a NULL dentry or a
-				 * deleted dentry.
-				 */
-				if (unlikely(!d_deleted((struct dentry *) dentry) &&
-					     inode &&
-					     !(inode && S_ISDIR(inode->i_mode) &&
-					       bindex > dstart && bindex < dend))) {
-					PRINT_CALLER(fname, fxn, line);
-					pr_debug(" CD2: dentry/lower=%p:%p(%p) "
-						 "bindex=%d dstart/end=%d:%d\n",
-						 dentry, lower_dentry,
-						 (lower_dentry ?
-						  lower_dentry->d_inode :
-						  (void *) -1L),
-						 bindex, dstart, dend);
-				}
+			if (bindex < dstart || bindex > dend)
+				continue;
+			/*
+			 * Directories can have NULL lower inodes in b/t
+			 * start/end, but NOT if at the start/end range.
+			 * Ignore this rule, however, if this is a NULL
+			 * dentry or a deleted dentry.
+			 */
+			if (unlikely(!d_deleted((struct dentry *) dentry) &&
+				     inode &&
+				     !(inode && S_ISDIR(inode->i_mode) &&
+				       bindex > dstart && bindex < dend))) {
+				PRINT_CALLER(fname, fxn, line);
+				pr_debug(" CD2: dentry/lower=%p:%p(%p) "
+					 "bindex=%d dstart/end=%d:%d\n",
+					 dentry, lower_dentry,
+					 (lower_dentry ?
+					  lower_dentry->d_inode :
+					  (void *) -1L),
+					 bindex, dstart, dend);
 			}
 		}
 	}
@@ -193,22 +192,22 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 					 lower_mnt, bindex, dstart, dend);
 			}
 		} else {	/* lower_mnt == NULL */
-			if (bindex >= dstart && bindex <= dend) {
-				/*
-				 * Directories can have NULL lower inodes in
-				 * b/t start/end, but NOT if at the
-				 * start/end range.  Ignore this rule,
-				 * however, if this is a NULL dentry.
-				 */
-				if (unlikely(inode &&
-					     !(inode && S_ISDIR(inode->i_mode) &&
-					       bindex > dstart && bindex < dend))) {
-					PRINT_CALLER(fname, fxn, line);
-					pr_debug(" CM1: dentry/lmnt=%p:%p "
-						 "bindex=%d dstart/end=%d:%d\n",
-						 dentry, lower_mnt, bindex,
-						 dstart, dend);
-				}
+			if (bindex < dstart || bindex > dend)
+				continue;
+			/*
+			 * Directories can have NULL lower inodes in b/t
+			 * start/end, but NOT if at the start/end range.
+			 * Ignore this rule, however, if this is a NULL
+			 * dentry.
+			 */
+			if (unlikely(inode &&
+				     !(inode && S_ISDIR(inode->i_mode) &&
+				       bindex > dstart && bindex < dend))) {
+				PRINT_CALLER(fname, fxn, line);
+				pr_debug(" CM1: dentry/lmnt=%p:%p "
+					 "bindex=%d dstart/end=%d:%d\n",
+					 dentry, lower_mnt, bindex,
+					 dstart, dend);
 			}
 		}
 	}
@@ -310,7 +309,8 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 	/* check if lower inode is newer than upper one (it shouldn't) */
 	if (unlikely(is_newer_lower(dentry))) {
 		PRINT_CALLER(fname, fxn, line);
-		for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
+		for (bindex = ibstart(inode); bindex <= ibend(inode);
+		     bindex++) {
 			lower_inode = unionfs_lower_inode_idx(inode, bindex);
 			if (unlikely(!lower_inode))
 				continue;
@@ -390,8 +390,8 @@ void __unionfs_check_file(const struct file *file,
 			if (unlikely(bindex < fstart || bindex > fend)) {
 				PRINT_CALLER(fname, fxn, line);
 				pr_debug(" CF5: file/lower=%p:%p bindex=%d "
-					 "fstart/end=%d:%d\n",
-					 file, lower_file, bindex, fstart, fend);
+					 "fstart/end=%d:%d\n", file,
+					 lower_file, bindex, fstart, fend);
 			}
 		} else {	/* lower_file == NULL */
 			if (bindex >= fstart && bindex <= fend) {
diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 49323de..6bab9d6 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -328,7 +328,8 @@ bool __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd,
 	 */
 	chain = kzalloc(chain_len * sizeof(struct dentry *), GFP_KERNEL);
 	if (unlikely(!chain)) {
-		printk(KERN_CRIT "unionfs: no more memory in %s\n", __FUNCTION__);
+		printk(KERN_CRIT "unionfs: no more memory in %s\n",
+		       __FUNCTION__);
 		goto out;
 	}
 
diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index 0064723..c644c13 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -155,7 +155,8 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
 		uds->dirpos = offset;
 
 		/* Copy the atime. */
-		fsstack_copy_attr_atime(inode, lower_file->f_path.dentry->d_inode);
+		fsstack_copy_attr_atime(inode,
+					lower_file->f_path.dentry->d_inode);
 
 		if (err < 0)
 			goto out;
@@ -240,8 +241,9 @@ static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)
 				else
 					err = -EINVAL;
 			} else {
-				rdstate = find_rdstate(file->f_path.dentry->d_inode,
-						       offset);
+				struct inode *inode;
+				inode = file->f_path.dentry->d_inode;
+				rdstate = find_rdstate(inode, offset);
 				if (rdstate) {
 					UNIONFS_F(file)->rdstate = rdstate;
 					err = rdstate->offset;
diff --git a/fs/unionfs/fanout.h b/fs/unionfs/fanout.h
index 8d5f15e..ec18013 100644
--- a/fs/unionfs/fanout.h
+++ b/fs/unionfs/fanout.h
@@ -314,11 +314,14 @@ static inline void unionfs_copy_attr_times(struct inode *upper)
 		lower = unionfs_lower_inode_idx(upper, bindex);
 		if (!lower)
 			continue; /* not all lower dir objects may exist */
-		if (unlikely(timespec_compare(&upper->i_mtime, &lower->i_mtime) < 0))
+		if (unlikely(timespec_compare(&upper->i_mtime,
+					      &lower->i_mtime) < 0))
 			upper->i_mtime = lower->i_mtime;
-		if (unlikely(timespec_compare(&upper->i_ctime, &lower->i_ctime) < 0))
+		if (unlikely(timespec_compare(&upper->i_ctime,
+					      &lower->i_ctime) < 0))
 			upper->i_ctime = lower->i_ctime;
-		if (unlikely(timespec_compare(&upper->i_atime, &lower->i_atime) < 0))
+		if (unlikely(timespec_compare(&upper->i_atime,
+					      &lower->i_atime) < 0))
 			upper->i_atime = lower->i_atime;
 	}
 }
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2007-10-01  5:54 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-01  5:50 [GIT PULL -mm] 00/19 Unionfs updates/cleanups/fixes Erez Zadok
2007-10-01  5:50 ` [PATCH 01/19] Unionfs: compile if debug is off Erez Zadok
2007-10-01  5:50 ` [PATCH 02/19] Unionfs: add un/likely on conditionals Erez Zadok
2007-10-01  5:50 ` [PATCH 03/19] Unionfs: minor comment cleanups Erez Zadok
2007-10-01  5:50 ` [PATCH 04/19] Unionfs: use consistent printk prefixes Erez Zadok
2007-10-01  5:50 ` [PATCH 05/19] Unionfs: use UNIONFS_NAME macro Erez Zadok
2007-10-01  5:50 ` [PATCH 06/19] Unionfs: properly indent static struct Erez Zadok
2007-10-01  5:50 ` [PATCH 07/19] Unionfs: remove unnecessary if condition Erez Zadok
2007-10-01  5:50 ` [PATCH 08/19] Unionfs: use page_offset() helper Erez Zadok
2007-10-01  5:50 ` [PATCH 09/19] Unionfs: use pr_debug() instead of custom dprintk() Erez Zadok
2007-10-01  5:50 ` [PATCH 10/19] Unionfs: convert all appropriate printk's to pr_debug calls Erez Zadok
2007-10-01  5:50 ` [PATCH 11/19] Unionfs: add missing newlines in printk's Erez Zadok
2007-10-01  5:50 ` [PATCH 12/19] Unionfs: update/assign a KERN_* level to all printk statements Erez Zadok
2007-10-01  5:50 ` [PATCH 13/19] Unionfs: remove periods from the end of printk strings Erez Zadok
2007-10-01  5:50 ` [PATCH 14/19] Unionfs: use braces in both branches of conditionals Erez Zadok
2007-10-01  5:50 ` [PATCH 15/19] Unionfs: coding style: proper spacing Erez Zadok
2007-10-01  5:50 ` [PATCH 16/19] Unionfs: coding style: take assignments out of "if" conditions Erez Zadok
2007-10-01  5:50 ` [PATCH 17/19] Unionfs: coding style: avoid multiple assignments on same line Erez Zadok
2007-10-01  5:50 ` [PATCH 18/19] Unionfs: coding style: miscellaneous fixes Erez Zadok
2007-10-01  5:50 ` [PATCH 19/19] Unionfs: coding style: avoid lines longer than 80 chars Erez Zadok

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).