All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/28] fs: Logging style neatening and checkpatch wanking...
@ 2011-11-30  2:13 Joe Perches
  2011-11-30  2:13 ` [PATCH 01/28] buffer: Use pr_<level> Joe Perches
                   ` (27 more replies)
  0 siblings, 28 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:13 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel

Use the current logging styles.

Some messages now have prefixes that didn't previously.
buffer:, exec:, namespace: and a few others.

Neaten the file coding style while there.

Joe Perches (28):
  buffer: Use pr_<level>
  mbcache: Use current logging styles
  bio: Use current logging styles
  libfs: Use current logging styles
  super: Use current logging styles
  exec: Use current logging style
  namespace: Use current logging styles
  block_dev: Use current logging style
  dcache: Use current logging style
  fcntl: Use current logging style
  file: Use current logging style
  locks: Use current logging style
  open: Use current logging style
  stat: Use current logging style
  exec: checkpatch wanking
  namespace: checkpatch wanking
  block_dev: checkpatch wanking
  dcache: checkpatch wanking
  fcntl: checkpatch wanking
  file: checkpatch wanking
  locks: checkpatch wanking
  open: checkpatch wanking
  stat: checkpatch wanking
  super: checkpatch wanking
  libfs: checkpatch wanking
  bio: checkpatch wanking
  mbcache: checkpatch wanking.
  buffer: checkpatch wanking

 fs/bio.c       |   31 +++++---
 fs/block_dev.c |   81 ++++++++++-----------
 fs/buffer.c    |  143 ++++++++++++++++++-------------------
 fs/dcache.c    |  137 ++++++++++++++++++------------------
 fs/exec.c      |  106 ++++++++++++++--------------
 fs/fcntl.c     |  134 ++++++++++++++++++-----------------
 fs/file.c      |   25 ++++---
 fs/libfs.c     |  215 +++++++++++++++++++++++++++++---------------------------
 fs/locks.c     |  125 +++++++++++++++-----------------
 fs/mbcache.c   |   82 +++++++++------------
 fs/namespace.c |   61 ++++++++--------
 fs/open.c      |   41 ++++++-----
 fs/stat.c      |   33 ++++-----
 fs/super.c     |   60 ++++++---------
 14 files changed, 631 insertions(+), 643 deletions(-)

-- 
1.7.6.405.gc1be0


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

* [PATCH 01/28] buffer: Use pr_<level>
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
@ 2011-11-30  2:13 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 02/28] mbcache: Use current logging styles Joe Perches
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:13 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Use the current logging styles.
Add #define pr_fmt.
Convert bare printks to pr_notice.
Coalesce format strings.
Align arguments.
Convert %Lu to %llu.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/buffer.c |   58 ++++++++++++++++++++++++++--------------------------------
 1 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 929d620..576a1ba 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -18,6 +18,8 @@
  * async buffer flushing, 1999 Andrea Arcangeli <andrea@suse.de>
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/syscalls.h>
 #include <linux/fs.h>
@@ -107,9 +109,8 @@ static int quiet_error(struct buffer_head *bh)
 static void buffer_io_error(struct buffer_head *bh)
 {
 	char b[BDEVNAME_SIZE];
-	printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
-			bdevname(bh->b_bdev, b),
-			(unsigned long long)bh->b_blocknr);
+	pr_err("Buffer I/O error on device %s, logical block %llu\n",
+	       bdevname(bh->b_bdev, b), (unsigned long long)bh->b_blocknr);
 }
 
 /*
@@ -151,9 +152,8 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate)
 	} else {
 		if (!quiet_error(bh)) {
 			buffer_io_error(bh);
-			printk(KERN_WARNING "lost page write due to "
-					"I/O error on %s\n",
-				       bdevname(bh->b_bdev, b));
+			pr_warn("lost page write due to I/O error on %s\n",
+				bdevname(bh->b_bdev, b));
 		}
 		set_buffer_write_io_error(bh);
 		clear_buffer_uptodate(bh);
@@ -215,14 +215,13 @@ __find_get_block_slow(struct block_device *bdev, sector_t block)
 	if (all_mapped) {
 		char b[BDEVNAME_SIZE];
 
-		printk("__find_get_block_slow() failed. "
-			"block=%llu, b_blocknr=%llu\n",
-			(unsigned long long)block,
-			(unsigned long long)bh->b_blocknr);
-		printk("b_state=0x%08lx, b_size=%zu\n",
-			bh->b_state, bh->b_size);
-		printk("device %s blocksize: %d\n", bdevname(bdev, b),
-			1 << bd_inode->i_blkbits);
+		pr_notice("__find_get_block_slow() failed. block=%llu, b_blocknr=%llu\n",
+			  (unsigned long long)block,
+			  (unsigned long long)bh->b_blocknr);
+		pr_notice("b_state=0x%08lx, b_size=%zu\n",
+			  bh->b_state, bh->b_size);
+		pr_notice("device %s blocksize: %d\n",
+			  bdevname(bdev, b), 1 << bd_inode->i_blkbits);
 	}
 out_unlock:
 	spin_unlock(&bd_mapping->private_lock);
@@ -383,9 +382,8 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate)
 	} else {
 		if (!quiet_error(bh)) {
 			buffer_io_error(bh);
-			printk(KERN_WARNING "lost page write due to "
-					"I/O error on %s\n",
-			       bdevname(bh->b_bdev, b));
+			pr_warn("lost page write due to I/O error on %s\n",
+				bdevname(bh->b_bdev, b));
 		}
 		set_bit(AS_EIO, &page->mapping->flags);
 		set_buffer_write_io_error(bh);
@@ -565,15 +563,14 @@ static void do_thaw_one(struct super_block *sb, void *unused)
 {
 	char b[BDEVNAME_SIZE];
 	while (sb->s_bdev && !thaw_bdev(sb->s_bdev, sb))
-		printk(KERN_WARNING "Emergency Thaw on %s\n",
-		       bdevname(sb->s_bdev, b));
+		pr_warn("Emergency Thaw on %s\n", bdevname(sb->s_bdev, b));
 }
 
 static void do_thaw_all(struct work_struct *work)
 {
 	iterate_supers(do_thaw_one, NULL);
 	kfree(work);
-	printk(KERN_WARNING "Emergency Thaw complete\n");
+	pr_warn("Emergency Thaw complete\n");
 }
 
 /**
@@ -1066,10 +1063,9 @@ grow_buffers(struct block_device *bdev, sector_t block, int size)
 	if (unlikely(index != block >> sizebits)) {
 		char b[BDEVNAME_SIZE];
 
-		printk(KERN_ERR "%s: requested out-of-range block %llu for "
-			"device %s\n",
-			__func__, (unsigned long long)block,
-			bdevname(bdev, b));
+		pr_err("%s: requested out-of-range block %llu for device %s\n",
+		       __func__, (unsigned long long)block,
+		       bdevname(bdev, b));
 		return -EIO;
 	}
 	block = index << sizebits;
@@ -1088,10 +1084,9 @@ __getblk_slow(struct block_device *bdev, sector_t block, int size)
 	/* Size must be multiple of hard sectorsize */
 	if (unlikely(size & (bdev_logical_block_size(bdev)-1) ||
 			(size < 512 || size > PAGE_SIZE))) {
-		printk(KERN_ERR "getblk(): invalid block size %d requested\n",
-					size);
-		printk(KERN_ERR "logical block size: %d\n",
-					bdev_logical_block_size(bdev));
+		pr_err("getblk(): invalid block size %d requested\n", size);
+		pr_err("logical block size: %d\n",
+		       bdev_logical_block_size(bdev));
 
 		dump_stack();
 		return NULL;
@@ -3174,10 +3169,9 @@ SYSCALL_DEFINE2(bdflush, int, func, long, data)
 
 	if (msg_count < 5) {
 		msg_count++;
-		printk(KERN_INFO
-			"warning: process `%s' used the obsolete bdflush"
-			" system call\n", current->comm);
-		printk(KERN_INFO "Fix your initscripts?\n");
+		pr_info("warning: process `%s' used the obsolete bdflush system call\n",
+			current->comm);
+		pr_info("Fix your initscripts?\n");
 	}
 
 	if (func == 1)
-- 
1.7.6.405.gc1be0


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

* [PATCH 02/28] mbcache: Use current logging styles
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
  2011-11-30  2:13 ` [PATCH 01/28] buffer: Use pr_<level> Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 03/28] bio: " Joe Perches
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Convert mb_<level> uses to current logging styles.
Add newlines to uses, remove from #define to consolidate
output and avoid possible message interleaving.
Add #define pr_fmt.
Align arguments.
Neaten macro defines.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/mbcache.c |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/fs/mbcache.c b/fs/mbcache.c
index 8c32ef3..a3c533c 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -26,6 +26,8 @@
  * back on the lru list.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 
@@ -37,23 +39,22 @@
 #include <linux/init.h>
 #include <linux/mbcache.h>
 
-
 #ifdef MB_CACHE_DEBUG
-# define mb_debug(f...) do { \
-		printk(KERN_DEBUG f); \
-		printk("\n"); \
-	} while (0)
-#define mb_assert(c) do { if (!(c)) \
-		printk(KERN_ERR "assertion " #c " failed\n"); \
-	} while(0)
+# define mb_debug(fmt, ...)				\
+	pr_debug(fmt, ##__VA_ARGS__)
+# define mb_assert(c)					\
+do {							\
+	if (!(c))					\
+		pr_err("assertion " #c " failed\n");	\
+} while (0)
 #else
-# define mb_debug(f...) do { } while(0)
-# define mb_assert(c) do { } while(0)
+# define mb_debug(fmt, ...)				\
+	no_printk(fmt, ##__VA_ARGS__)
+# define mb_assert(c)					\
+	do { } while (0)
 #endif
-#define mb_error(f...) do { \
-		printk(KERN_ERR f); \
-		printk("\n"); \
-	} while(0)
+#define mb_err(fmt, ...)				\
+	pr_err(fmt, ##__VA_ARGS__)
 
 #define MB_CACHE_WRITER ((unsigned short)~0U >> 1)
 
@@ -171,7 +172,7 @@ mb_cache_shrink_fn(struct shrinker *shrink, struct shrink_control *sc)
 	int nr_to_scan = sc->nr_to_scan;
 	gfp_t gfp_mask = sc->gfp_mask;
 
-	mb_debug("trying to free %d entries", nr_to_scan);
+	mb_debug("trying to free %d entries\n", nr_to_scan);
 	spin_lock(&mb_cache_spinlock);
 	while (nr_to_scan-- && !list_empty(&mb_cache_lru_list)) {
 		struct mb_cache_entry *ce =
@@ -181,8 +182,8 @@ mb_cache_shrink_fn(struct shrinker *shrink, struct shrink_control *sc)
 		__mb_cache_entry_unhash(ce);
 	}
 	list_for_each_entry(cache, &mb_cache_list, c_cache_list) {
-		mb_debug("cache %s (%d)", cache->c_name,
-			  atomic_read(&cache->c_entry_count));
+		mb_debug("cache %s (%d)\n",
+			 cache->c_name, atomic_read(&cache->c_entry_count));
 		count += atomic_read(&cache->c_entry_count);
 	}
 	spin_unlock(&mb_cache_spinlock);
@@ -318,9 +319,8 @@ mb_cache_destroy(struct mb_cache *cache)
 	}
 
 	if (atomic_read(&cache->c_entry_count) > 0) {
-		mb_error("cache %s: %d orphaned entries",
-			  cache->c_name,
-			  atomic_read(&cache->c_entry_count));
+		mb_err("cache %s: %d orphaned entries\n",
+		       cache->c_name, atomic_read(&cache->c_entry_count));
 	}
 
 	kmem_cache_destroy(cache->c_entry_cache);
-- 
1.7.6.405.gc1be0


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

* [PATCH 03/28] bio: Use current logging styles
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
  2011-11-30  2:13 ` [PATCH 01/28] buffer: Use pr_<level> Joe Perches
  2011-11-30  2:14 ` [PATCH 02/28] mbcache: Use current logging styles Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 04/28] libfs: " Joe Perches
                   ` (24 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Add and use pr_fmt and pr_<level>

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/bio.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/bio.c b/fs/bio.c
index b1fe82c..98acfb1 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -15,6 +15,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-
  *
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/mm.h>
 #include <linux/swap.h>
 #include <linux/bio.h>
@@ -111,7 +114,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size)
 	if (!slab)
 		goto out_unlock;
 
-	printk(KERN_INFO "bio: create slab <%s> at %d\n", bslab->name, entry);
+	pr_info("create slab <%s> at %d\n", bslab->name, entry);
 	bslab->slab = slab;
 	bslab->slab_ref = 1;
 	bslab->slab_size = sz;
-- 
1.7.6.405.gc1be0


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

* [PATCH 04/28] libfs: Use current logging styles
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (2 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 03/28] bio: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 05/28] super: " Joe Perches
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Add and use pr_fmt and pr_<level>.
Coalesce long format strings.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/libfs.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/libfs.c b/fs/libfs.c
index f6d411e..ad1532f 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -3,6 +3,8 @@
  *	Library for filesystems writers.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/pagemap.h>
 #include <linux/slab.h>
@@ -502,9 +504,8 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
 
 		/* warn if it tries to conflict with the root inode */
 		if (unlikely(i == 1))
-			printk(KERN_WARNING "%s: %s passed in a files array"
-				"with an index of 1!\n", __func__,
-				s->s_type->name);
+			pr_warn("%s: %s passed in a files array with an index of 1!\n",
+				__func__, s->s_type->name);
 
 		dentry = d_alloc_name(root, files->name);
 		if (!dentry)
-- 
1.7.6.405.gc1be0


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

* [PATCH 05/28] super: Use current logging styles
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (3 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 04/28] libfs: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 06/28] exec: Use current logging style Joe Perches
                   ` (22 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Add and use pr_fmt and pr_<level>
Add printk level KERN_CRIT to "busy inodes after dismount" message.
Coalesce long format.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/super.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index b83d1c1..23ff118 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -20,6 +20,8 @@
  *  Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000
  */
 
+#define pr_fmt(fmt) "VFS: " fmt
+
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/acct.h>
@@ -393,9 +395,8 @@ void generic_shutdown_super(struct super_block *sb)
 			sop->put_super(sb);
 
 		if (!list_empty(&sb->s_inodes)) {
-			printk("VFS: Busy inodes after unmount of %s. "
-			   "Self-destruct in 5 seconds.  Have a nice day...\n",
-			   sb->s_id);
+			pr_crit("Busy inodes after unmount of %s. Self-destruct in 5 seconds.  Have a nice day...\n",
+				sb->s_id);
 		}
 	}
 	spin_lock(&sb_lock);
@@ -777,7 +778,7 @@ static void do_emergency_remount(struct work_struct *work)
 		__put_super(p);
 	spin_unlock(&sb_lock);
 	kfree(work);
-	printk("Emergency Remount complete\n");
+	pr_info("Emergency Remount complete\n");
 }
 
 void emergency_remount(void)
@@ -1110,8 +1111,9 @@ mount_fs(struct file_system_type *type, int flags, const char *name, void *data)
 	 * this warning for a little while to try and catch filesystems that
 	 * violate this rule.
 	 */
-	WARN((sb->s_maxbytes < 0), "%s set sb->s_maxbytes to "
-		"negative value (%lld)\n", type->name, sb->s_maxbytes);
+	WARN((sb->s_maxbytes < 0),
+	     "%s set sb->s_maxbytes to negative value (%lld)\n",
+	     type->name, sb->s_maxbytes);
 
 	up_write(&sb->s_umount);
 	free_secdata(secdata);
@@ -1163,8 +1165,7 @@ int freeze_super(struct super_block *sb)
 	if (sb->s_op->freeze_fs) {
 		ret = sb->s_op->freeze_fs(sb);
 		if (ret) {
-			printk(KERN_ERR
-				"VFS:Filesystem freeze failed\n");
+			pr_err("Filesystem freeze failed\n");
 			sb->s_frozen = SB_UNFROZEN;
 			deactivate_locked_super(sb);
 			return ret;
@@ -1197,8 +1198,7 @@ int thaw_super(struct super_block *sb)
 	if (sb->s_op->unfreeze_fs) {
 		error = sb->s_op->unfreeze_fs(sb);
 		if (error) {
-			printk(KERN_ERR
-				"VFS:Filesystem thaw failed\n");
+			pr_err("Filesystem thaw failed\n");
 			sb->s_frozen = SB_FREEZE_TRANS;
 			up_write(&sb->s_umount);
 			return error;
-- 
1.7.6.405.gc1be0


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

* [PATCH 06/28] exec: Use current logging style
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (4 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 05/28] super: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 07/28] namespace: Use current logging styles Joe Perches
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Convert printks to pr_<level>.
Add pr_fmt.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/exec.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 3625464..0839da4 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -22,6 +22,8 @@
  * formats. 
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/slab.h>
 #include <linux/file.h>
 #include <linux/fdtable.h>
@@ -2148,8 +2150,8 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 		char **helper_argv;
 
 		if (ispipe < 0) {
-			printk(KERN_WARNING "format_corename failed\n");
-			printk(KERN_WARNING "Aborting core\n");
+			pr_warn("format_corename failed\n");
+			pr_warn("Aborting core\n");
 			goto fail_corename;
 		}
 
@@ -2168,26 +2170,24 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 			 * right pid if a thread in a multi-threaded
 			 * core_pattern process dies.
 			 */
-			printk(KERN_WARNING
-				"Process %d(%s) has RLIMIT_CORE set to 1\n",
+			pr_warn("Process %d(%s) has RLIMIT_CORE set to 1\n",
 				task_tgid_vnr(current), current->comm);
-			printk(KERN_WARNING "Aborting core\n");
+			pr_warn("Aborting core\n");
 			goto fail_unlock;
 		}
 		cprm.limit = RLIM_INFINITY;
 
 		dump_count = atomic_inc_return(&core_dump_count);
 		if (core_pipe_limit && (core_pipe_limit < dump_count)) {
-			printk(KERN_WARNING "Pid %d(%s) over core_pipe_limit\n",
-			       task_tgid_vnr(current), current->comm);
-			printk(KERN_WARNING "Skipping core dump\n");
+			pr_warn("Pid %d(%s) over core_pipe_limit\n",
+				task_tgid_vnr(current), current->comm);
+			pr_warn("Skipping core dump\n");
 			goto fail_dropcount;
 		}
 
 		helper_argv = argv_split(GFP_KERNEL, cn.corename+1, NULL);
 		if (!helper_argv) {
-			printk(KERN_WARNING "%s failed to allocate memory\n",
-			       __func__);
+			pr_warn("%s failed to allocate memory\n", __func__);
 			goto fail_dropcount;
 		}
 
@@ -2196,8 +2196,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 					NULL, &cprm);
 		argv_free(helper_argv);
 		if (retval) {
- 			printk(KERN_INFO "Core dump to %s pipe failed\n",
-			       cn.corename);
+			pr_info("Core dump to %s pipe failed\n", cn.corename);
 			goto close_fail;
  		}
 	} else {
-- 
1.7.6.405.gc1be0


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

* [PATCH 07/28] namespace: Use current logging styles
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (5 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 06/28] exec: Use current logging style Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 08/28] block_dev: Use current logging style Joe Perches
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Add and use pr_fmt and pr_<level>.
This adds a "namespace: " prefix to logging output.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/namespace.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 874dc5c..f9a164d 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -8,6 +8,8 @@
  * Heavily rewritten.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/syscalls.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
@@ -2716,7 +2718,7 @@ void __init mnt_init(void)
 	if (!mount_hashtable)
 		panic("Failed to allocate mount hash table\n");
 
-	printk(KERN_INFO "Mount-cache hash table entries: %lu\n", HASH_SIZE);
+	pr_info("Mount-cache hash table entries: %lu\n", HASH_SIZE);
 
 	for (u = 0; u < HASH_SIZE; u++)
 		INIT_LIST_HEAD(&mount_hashtable[u]);
@@ -2725,11 +2727,10 @@ void __init mnt_init(void)
 
 	err = sysfs_init();
 	if (err)
-		printk(KERN_WARNING "%s: sysfs_init error: %d\n",
-			__func__, err);
+		pr_warn("%s: sysfs_init error: %d\n", __func__, err);
 	fs_kobj = kobject_create_and_add("fs", NULL);
 	if (!fs_kobj)
-		printk(KERN_WARNING "%s: kobj create error\n", __func__);
+		pr_warn("%s: kobj create error\n", __func__);
 	init_rootfs();
 	init_mount_tree();
 }
-- 
1.7.6.405.gc1be0


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

* [PATCH 08/28] block_dev: Use current logging style
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (6 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 07/28] namespace: Use current logging styles Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 09/28] dcache: " Joe Perches
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Add and use pr_fmt and pr_<level>
Coalesce formats.

No change in output as pr_fmt is #define pr_fmt(fmt) fmt

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/block_dev.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 3154fbe..20aa631 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -5,6 +5,8 @@
  *  Copyright (C) 2001  Andrea Arcangeli <andrea@suse.de> SuSE
  */
 
+#define pr_fmt(fmt) fmt
+
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/fcntl.h>
@@ -965,8 +967,8 @@ static void flush_disk(struct block_device *bdev, bool kill_dirty)
 
 		if (bdev->bd_disk)
 			disk_name(bdev->bd_disk, 0, name);
-		printk(KERN_WARNING "VFS: busy inodes on changed media or "
-		       "resized disk %s\n", name);
+		pr_warn("VFS: busy inodes on changed media or resized disk %s\n",
+			name);
 	}
 
 	if (!bdev->bd_disk)
@@ -993,9 +995,8 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev)
 		char name[BDEVNAME_SIZE];
 
 		disk_name(disk, 0, name);
-		printk(KERN_INFO
-		       "%s: detected capacity change from %lld to %lld\n",
-		       name, bdev_size, disk_size);
+		pr_info("%s: detected capacity change from %lld to %lld\n",
+			name, bdev_size, disk_size);
 		i_size_write(bdev->bd_inode, disk_size);
 		flush_disk(bdev, false);
 	}
-- 
1.7.6.405.gc1be0


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

* [PATCH 09/28] dcache: Use current logging style
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (7 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 08/28] block_dev: Use current logging style Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 10/28] fcntl: " Joe Perches
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Add and use pr_fmt and pr_<level>.
No change in output with #define pr_fmt(fmt) fmt

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/dcache.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 3abfec7..6055631 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -14,6 +14,8 @@
  * the dcache entry is deleted or garbage collected.
  */
 
+#define pr_fmt(fmt) fmt
+
 #include <linux/syscalls.h>
 #include <linux/string.h>
 #include <linux/mm.h>
@@ -890,10 +892,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
 			__d_shrink(dentry);
 
 			if (dentry->d_count != 0) {
-				printk(KERN_ERR
-				       "BUG: Dentry %p{i=%lx,n=%s}"
-				       " still in use (%d)"
-				       " [unmount of %s %s]\n",
+				pr_err("BUG: Dentry %p{i=%lx,n=%s} still in use (%d) [unmount of %s %s]\n",
 				       dentry,
 				       dentry->d_inode ?
 				       dentry->d_inode->i_ino : 0UL,
@@ -2164,7 +2163,7 @@ static void dentry_unlock_parents_for_move(struct dentry *dentry,
 static void __d_move(struct dentry * dentry, struct dentry * target)
 {
 	if (!dentry->d_inode)
-		printk(KERN_WARNING "VFS: moving negative dcache entry\n");
+		pr_warn("VFS: moving negative dcache entry\n");
 
 	BUG_ON(d_ancestor(dentry, target));
 	BUG_ON(d_ancestor(target, dentry));
-- 
1.7.6.405.gc1be0


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

* [PATCH 10/28] fcntl: Use current logging style
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (8 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 09/28] dcache: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 11/28] file: " Joe Perches
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro, Matthew Wilcox; +Cc: linux-fsdevel, linux-kernel

Add and use pr_fmt and pr_<level>.
Output message now prefixed with "fcntl: " and
%s:, __func__, (kill_fasync_rcu) now used as well.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/fcntl.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/fcntl.c b/fs/fcntl.c
index 22764c7..5d16b1d 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -4,6 +4,8 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/syscalls.h>
 #include <linux/init.h>
 #include <linux/mm.h>
@@ -797,8 +799,8 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
 		unsigned long flags;
 
 		if (fa->magic != FASYNC_MAGIC) {
-			printk(KERN_ERR "kill_fasync: bad magic number in "
-			       "fasync_struct!\n");
+			pr_err("%s: bad magic number in fasync_struct!\n",
+			       __func__);
 			return;
 		}
 		spin_lock_irqsave(&fa->fa_lock, flags);
-- 
1.7.6.405.gc1be0


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

* [PATCH 11/28] file: Use current logging style
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (9 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 10/28] fcntl: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 12/28] locks: " Joe Perches
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Add and use pr_fmt and pr_<level>
Now prefixed a single message with "file: " and
changed an embedded function name to "%s: ", __func__.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/file.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/file.c b/fs/file.c
index 4c6992d..a88b110 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -6,6 +6,8 @@
  *  Manage the dynamic fd arrays in the process files_struct.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/mm.h>
@@ -469,7 +471,7 @@ repeat:
 #if 1
 	/* Sanity check */
 	if (rcu_dereference_raw(fdt->fd[fd]) != NULL) {
-		printk(KERN_WARNING "alloc_fd: slot %d not NULL!\n", fd);
+		pr_warn("%s: slot %d not NULL!\n", __func__, fd);
 		rcu_assign_pointer(fdt->fd[fd], NULL);
 	}
 #endif
-- 
1.7.6.405.gc1be0


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

* [PATCH 12/28] locks: Use current logging style
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (10 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 11/28] file: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 13/28] open: " Joe Perches
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro, Matthew Wilcox; +Cc: linux-fsdevel, linux-kernel

Add and use pr_fmt and pr_<level>.
Prefix message with "file: " and convert embedded function name
to "%s: ", __func__.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/locks.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 3b0d05d..10f2bdb 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -114,6 +114,8 @@
  *  Stephen Rothwell <sfr@canb.auug.org.au>, June, 2000.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/capability.h>
 #include <linux/file.h>
 #include <linux/fdtable.h>
@@ -581,7 +583,7 @@ static void locks_delete_lock(struct file_lock **thisfl_p)
 
 	fasync_helper(0, fl->fl_file, 0, &fl->fl_fasync);
 	if (fl->fl_fasync != NULL) {
-		printk(KERN_ERR "locks_delete_lock: fasync == %p\n", fl->fl_fasync);
+		pr_err("%s: fasync == %p\n", __func__, fl->fl_fasync);
 		fl->fl_fasync = NULL;
 	}
 
-- 
1.7.6.405.gc1be0


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

* [PATCH 13/28] open: Use current logging style
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (11 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 12/28] locks: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 14/28] stat: " Joe Perches
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Add and use pr_fmt and pr_<level>
No change to output using #define pr_fmt(fmt) fmt

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/open.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/open.c b/fs/open.c
index 22c41b5..58c8d94 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -4,6 +4,8 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
+#define pr_fmt(fmt) fmt
+
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/file.h>
@@ -1043,7 +1045,7 @@ int filp_close(struct file *filp, fl_owner_t id)
 	int retval = 0;
 
 	if (!file_count(filp)) {
-		printk(KERN_ERR "VFS: Close: file count is 0\n");
+		pr_err("VFS: Close: file count is 0\n");
 		return 0;
 	}
 
-- 
1.7.6.405.gc1be0


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

* [PATCH 14/28] stat: Use current logging style
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (12 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 13/28] open: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 15/28] exec: checkpatch wanking Joe Perches
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Add and use pr_fmt and pr_<level>.
No change to output with #define pr_fmt(fmt) fmt

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/stat.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/stat.c b/fs/stat.c
index 8806b89..ff9be35 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -4,6 +4,8 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
+#define pr_fmt(fmt) fmt
+
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/errno.h>
@@ -121,7 +123,7 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta
 	
 	if (warncount > 0) {
 		warncount--;
-		printk(KERN_WARNING "VFS: Warning: %s using old stat() call. Recompile your binary.\n",
+		pr_warn("VFS: Warning: %s using old stat() call. Recompile your binary.\n",
 			current->comm);
 	} else if (warncount < 0) {
 		/* it's laughable, but... */
-- 
1.7.6.405.gc1be0


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

* [PATCH 15/28] exec: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (13 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 14/28] stat: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 16/28] namespace: " Joe Perches
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Fix a few style things, all but 1 false positive,
the #include <asm/mmu_context.h> warning, has been
cleaned.

$ ./scripts/checkpatch.pl --terse -f fs/exec.c | cut -f3- -d":" |sort|uniq -c
      4  ERROR: code indent should use tabs where possible
      1  ERROR: do not initialise globals to 0 or NULL
      2  ERROR: do not use assignment in if condition
     10  ERROR: "foo * bar" should be "foo *bar"
      1  ERROR: space required after that ',' (ctx:OxV)
      3  ERROR: space required after that ',' (ctx:VxV)
      1  ERROR: space required before the open parenthesis '('
      2  ERROR: spaces required around that '<=' (ctx:VxV)
      1  ERROR: spaces required around that '<' (ctx:VxV)
      2  ERROR: spaces required around that '==' (ctx:VxV)
      2  ERROR: spaces required around that '=' (ctx:VxV)
      5  ERROR: trailing whitespace
      1  WARNING: braces {} are not necessary for single statement blocks
      6  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
      3  WARNING: line over 80 characters
      4  WARNING: please, no space before tabs
      4  WARNING: please, no spaces at the start of a line
      1  WARNING: Use #include <linux/mmu_context.h> instead of <asm/mmu_context.h>
      1  WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/exec.c |   83 +++++++++++++++++++++++++++++++------------------------------
 1 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 0839da4..1365d02 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -19,7 +19,7 @@
  * current->executable is only used by the procfs.  This allows a dispatch
  * table to check for several different types  of binary formats.  We keep
  * trying until we recognize the file or we run out of supported binary
- * formats. 
+ * formats.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -58,7 +58,7 @@
 #include <linux/oom.h>
 #include <linux/compat.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/tlb.h>
 #include "internal.h"
@@ -66,7 +66,7 @@
 int core_uses_pid;
 char core_pattern[CORENAME_MAX_SIZE] = "core";
 unsigned int core_pipe_limit;
-int suid_dumpable = 0;
+int suid_dumpable;
 
 struct core_name {
 	char *corename;
@@ -79,7 +79,7 @@ static atomic_t call_count = ATOMIC_INIT(1);
 static LIST_HEAD(formats);
 static DEFINE_RWLOCK(binfmt_lock);
 
-int __register_binfmt(struct linux_binfmt * fmt, int insert)
+int __register_binfmt(struct linux_binfmt *fmt, int insert)
 {
 	if (!fmt)
 		return -EINVAL;
@@ -87,21 +87,19 @@ int __register_binfmt(struct linux_binfmt * fmt, int insert)
 	insert ? list_add(&fmt->lh, &formats) :
 		 list_add_tail(&fmt->lh, &formats);
 	write_unlock(&binfmt_lock);
-	return 0;	
+	return 0;
 }
-
 EXPORT_SYMBOL(__register_binfmt);
 
-void unregister_binfmt(struct linux_binfmt * fmt)
+void unregister_binfmt(struct linux_binfmt *fmt)
 {
 	write_lock(&binfmt_lock);
 	list_del(&fmt->lh);
 	write_unlock(&binfmt_lock);
 }
-
 EXPORT_SYMBOL(unregister_binfmt);
 
-static inline void put_binfmt(struct linux_binfmt * fmt)
+static inline void put_binfmt(struct linux_binfmt *fmt)
 {
 	module_put(fmt->module);
 }
@@ -143,8 +141,8 @@ SYSCALL_DEFINE1(uselib, const char __user *, library)
 	fsnotify_open(file);
 
 	error = -ENOEXEC;
-	if(file->f_op) {
-		struct linux_binfmt * fmt;
+	if (file->f_op) {
+		struct linux_binfmt *fmt;
 
 		read_lock(&binfmt_lock);
 		list_for_each_entry(fmt, &formats, lh) {
@@ -164,7 +162,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library)
 exit:
 	fput(file);
 out:
-  	return error;
+	return error;
 }
 
 #ifdef CONFIG_MMU
@@ -811,13 +809,12 @@ int kernel_read(struct file *file, loff_t offset,
 	set_fs(old_fs);
 	return result;
 }
-
 EXPORT_SYMBOL(kernel_read);
 
 static int exec_mmap(struct mm_struct *mm)
 {
 	struct task_struct *tsk;
-	struct mm_struct * old_mm, *active_mm;
+	struct mm_struct *old_mm, *active_mm;
 
 	/* Notify parent that we're no longer interested in the old VM */
 	tsk = current;
@@ -1012,7 +1009,7 @@ no_thread_group:
  * These functions flushes out all traces of the currently running executable
  * so that a new one can be started
  */
-static void flush_old_files(struct files_struct * files)
+static void flush_old_files(struct files_struct *files)
 {
 	long j = -1;
 	struct fdtable *fdt;
@@ -1031,10 +1028,9 @@ static void flush_old_files(struct files_struct * files)
 			continue;
 		fdt->close_on_exec->fds_bits[j] = 0;
 		spin_unlock(&files->file_lock);
-		for ( ; set ; i++,set >>= 1) {
-			if (set & 1) {
+		for (; set; i++, set >>= 1) {
+			if (set & 1)
 				sys_close(i);
-			}
 		}
 		spin_lock(&files->file_lock);
 
@@ -1069,7 +1065,7 @@ void set_task_comm(struct task_struct *tsk, char *buf)
 	perf_event_comm(tsk);
 }
 
-int flush_old_exec(struct linux_binprm * bprm)
+int flush_old_exec(struct linux_binprm *bprm)
 {
 	int retval;
 
@@ -1112,7 +1108,7 @@ void would_dump(struct linux_binprm *bprm, struct file *file)
 }
 EXPORT_SYMBOL(would_dump);
 
-void setup_new_exec(struct linux_binprm * bprm)
+void setup_new_exec(struct linux_binprm *bprm)
 {
 	int i, ch;
 	const char *name;
@@ -1131,7 +1127,7 @@ void setup_new_exec(struct linux_binprm * bprm)
 	name = bprm->filename;
 
 	/* Copies the binary name from after last slash */
-	for (i=0; (ch = *(name++)) != '\0';) {
+	for (i = 0; (ch = *(name++)) != '\0';) {
 		if (ch == '/')
 			i = 0; /* overwrite what we wrote */
 		else
@@ -1168,7 +1164,7 @@ void setup_new_exec(struct linux_binprm * bprm)
 	   group */
 
 	current->self_exec_id++;
-			
+
 	flush_signal_handlers(current, 0);
 	flush_old_files(current->files);
 }
@@ -1263,8 +1259,8 @@ int check_unsafe_exec(struct linux_binprm *bprm)
 	return res;
 }
 
-/* 
- * Fill the binprm structure from the inode. 
+/*
+ * Fill the binprm structure from the inode.
  * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes
  *
  * This may be called multiple times for binary chains (scripts for example).
@@ -1272,7 +1268,7 @@ int check_unsafe_exec(struct linux_binprm *bprm)
 int prepare_binprm(struct linux_binprm *bprm)
 {
 	umode_t mode;
-	struct inode * inode = bprm->file->f_path.dentry->d_inode;
+	struct inode *inode = bprm->file->f_path.dentry->d_inode;
 	int retval;
 
 	mode = inode->i_mode;
@@ -1311,7 +1307,6 @@ int prepare_binprm(struct linux_binprm *bprm)
 	memset(bprm->buf, 0, BINPRM_BUF_SIZE);
 	return kernel_read(bprm->file, 0, bprm->buf, BINPRM_BUF_SIZE);
 }
-
 EXPORT_SYMBOL(prepare_binprm);
 
 /*
@@ -1361,10 +1356,10 @@ EXPORT_SYMBOL(remove_arg_zero);
 /*
  * cycle the list of binary formats handler, until one recognizes the image
  */
-int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
+int search_binary_handler(struct linux_binprm *bprm, struct pt_regs *regs)
 {
 	unsigned int depth = bprm->recursion_depth;
-	int try,retval;
+	int try, retval;
 	struct linux_binfmt *fmt;
 	pid_t old_pid;
 
@@ -1382,10 +1377,11 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
 	rcu_read_unlock();
 
 	retval = -ENOENT;
-	for (try=0; try<2; try++) {
+	for (try = 0; try < 2; try++) {
 		read_lock(&binfmt_lock);
 		list_for_each_entry(fmt, &formats, lh) {
-			int (*fn)(struct linux_binprm *, struct pt_regs *) = fmt->load_binary;
+			int (*fn)(struct linux_binprm *, struct pt_regs *) =
+				fmt->load_binary;
 			if (!fn)
 				continue;
 			if (!try_module_get(fmt->module))
@@ -1425,7 +1421,10 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
 		if (retval != -ENOEXEC || bprm->mm == NULL) {
 			break;
 		} else {
-#define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
+
+#define printable(c)							\
+	(((c) == '\t') || ((c) == '\n') || (0x20 <= (c) && (c) <= 0x7e))
+
 			if (printable(bprm->buf[0]) &&
 			    printable(bprm->buf[1]) &&
 			    printable(bprm->buf[2]) &&
@@ -1433,7 +1432,8 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
 				break; /* -ENOEXEC */
 			if (try)
 				break; /* -ENOEXEC */
-			request_module("binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
+			request_module("binfmt-%04x",
+				       *(unsigned short *)(&bprm->buf[2]));
 		}
 #else
 		break;
@@ -1441,7 +1441,6 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
 	}
 	return retval;
 }
-
 EXPORT_SYMBOL(search_binary_handler);
 
 /*
@@ -1510,11 +1509,13 @@ static int do_execve_common(const char *filename,
 		goto out_file;
 
 	bprm->argc = count(argv, MAX_ARG_STRINGS);
-	if ((retval = bprm->argc) < 0)
+	retval = bprm->argc;
+	if (retval < 0)
 		goto out;
 
 	bprm->envc = count(envp, MAX_ARG_STRINGS);
-	if ((retval = bprm->envc) < 0)
+	retval = bprm->envc;
+	if (retval < 0)
 		goto out;
 
 	retval = prepare_binprm(bprm);
@@ -1534,7 +1535,7 @@ static int do_execve_common(const char *filename,
 	if (retval < 0)
 		goto out;
 
-	retval = search_binary_handler(bprm,regs);
+	retval = search_binary_handler(bprm, regs);
 	if (retval < 0)
 		goto out;
 
@@ -1613,7 +1614,6 @@ void set_binfmt(struct linux_binfmt *new)
 	if (new)
 		__module_get(new->module);
 }
-
 EXPORT_SYMBOL(set_binfmt);
 
 static int expand_corename(struct core_name *cn)
@@ -2090,7 +2090,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 	struct core_state core_state;
 	struct core_name cn;
 	struct mm_struct *mm = current->mm;
-	struct linux_binfmt * binfmt;
+	struct linux_binfmt *binfmt;
 	const struct cred *old_cred;
 	struct cred *cred;
 	int retval = 0;
@@ -2145,7 +2145,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 
 	ispipe = format_corename(&cn, signr);
 
- 	if (ispipe) {
+	if (ispipe) {
 		int dump_count;
 		char **helper_argv;
 
@@ -2198,7 +2198,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 		if (retval) {
 			pr_info("Core dump to %s pipe failed\n", cn.corename);
 			goto close_fail;
- 		}
+		}
 	} else {
 		struct inode *inode;
 
@@ -2264,7 +2264,8 @@ fail:
  */
 int dump_write(struct file *file, const void *addr, int nr)
 {
-	return access_ok(VERIFY_READ, addr, nr) && file->f_op->write(file, addr, nr, &file->f_pos) == nr;
+	return access_ok(VERIFY_READ, addr, nr) &&
+	       file->f_op->write(file, addr, nr, &file->f_pos) == nr;
 }
 EXPORT_SYMBOL(dump_write);
 
-- 
1.7.6.405.gc1be0


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

* [PATCH 16/28] namespace: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (14 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 15/28] exec: checkpatch wanking Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:22   ` Al Viro
  2011-11-30  2:14 ` [PATCH 17/28] block_dev: " Joe Perches
                   ` (11 subsequent siblings)
  27 siblings, 1 reply; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Fix a few style things.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/namespace.c | \
  cut -f3- -d":" | sort | uniq -c
      1  ERROR: do not initialise statics to 0 or NULL
      2  ERROR: do not use assignment in if condition
      1  ERROR: "foo * bar" should be "foo *bar"
      1  ERROR: need consistent spacing around '|' (ctx:VxW)
      1  WARNING: braces {} are not necessary for single statement blocks
      3  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
      4  WARNING: line over 80 characters
      9  WARNING: please, no space before tabs
      1  WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
      1  WARNING: Use #include <linux/unistd.h> instead of <asm/unistd.h>

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/namespace.c |   52 +++++++++++++++++++++++++++-------------------------
 1 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index f9a164d..30bc685 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -33,8 +33,8 @@
 #include <linux/idr.h>
 #include <linux/fs_struct.h>
 #include <linux/fsnotify.h>
-#include <asm/uaccess.h>
-#include <asm/unistd.h>
+#include <linux/uaccess.h>
+#include <linux/unistd.h>
 #include "pnode.h"
 #include "internal.h"
 
@@ -45,7 +45,7 @@ static int event;
 static DEFINE_IDA(mnt_id_ida);
 static DEFINE_IDA(mnt_group_ida);
 static DEFINE_SPINLOCK(mnt_id_lock);
-static int mnt_id_start = 0;
+static int mnt_id_start;
 static int mnt_group_start = 1;
 
 static struct list_head *mount_hashtable __read_mostly;
@@ -511,7 +511,8 @@ struct vfsmount *lookup_mnt(struct path *path)
 	struct vfsmount *child_mnt;
 
 	br_read_lock(&vfsmount_lock);
-	if ((child_mnt = __lookup_mnt(path->mnt, path->dentry, 1)))
+	child_mnt = __lookup_mnt(path->mnt, path->dentry, 1);
+	if (child_mnt)
 		mntget(child_mnt);
 	br_read_unlock(&vfsmount_lock);
 	return child_mnt;
@@ -671,7 +672,8 @@ static struct vfsmount *skip_mnt_tree(struct vfsmount *p)
 }
 
 struct vfsmount *
-vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
+vfs_kern_mount(struct file_system_type *type, int flags, const char *name,
+	       void *data)
 {
 	struct vfsmount *mnt;
 	struct dentry *root;
@@ -1174,7 +1176,6 @@ int may_umount_tree(struct vfsmount *mnt)
 
 	return 1;
 }
-
 EXPORT_SYMBOL(may_umount_tree);
 
 /**
@@ -1201,7 +1202,6 @@ int may_umount(struct vfsmount *mnt)
 	up_read(&namespace_sem);
 	return ret;
 }
-
 EXPORT_SYMBOL(may_umount);
 
 void release_mounts(struct list_head *head)
@@ -1307,9 +1307,8 @@ static int do_umount(struct vfsmount *mnt, int flags)
 	 * about for the moment.
 	 */
 
-	if (flags & MNT_FORCE && sb->s_op->umount_begin) {
+	if (flags & MNT_FORCE && sb->s_op->umount_begin)
 		sb->s_op->umount_begin(sb);
-	}
 
 	/*
 	 * No sense to grab the lock for this test, but test itself looks
@@ -1541,8 +1540,8 @@ static int invent_group_ids(struct vfsmount *mnt, bool recurse)
  *  @source_mnt : mount tree to be attached
  *  @nd         : place the mount tree @source_mnt is attached
  *  @parent_nd  : if non-null, detach the source_mnt from its parent and
- *  		   store the parent mount and mountpoint dentry.
- *  		   (done when source_mnt is moved)
+ *		   store the parent mount and mountpoint dentry.
+ *		   (done when source_mnt is moved)
  *
  *  NOTE: in the table below explains the semantics when a source mount
  *  of a given type is attached to a destination mount of a given type.
@@ -1562,8 +1561,8 @@ static int invent_group_ids(struct vfsmount *mnt, bool recurse)
  * destination mount.
  *
  * (++)  the cloned mount is propagated to all the mounts in the propagation
- * 	 tree of the destination mount and the cloned mount is added to
- * 	 the peer group of the source mount.
+ *	 tree of the destination mount and the cloned mount is added to
+ *	 the peer group of the source mount.
  * (+)   the cloned mount is created under the destination mount and is marked
  *       as shared. The cloned mount is added to the peer group of the source
  *       mount.
@@ -1572,10 +1571,10 @@ static int invent_group_ids(struct vfsmount *mnt, bool recurse)
  *       of the same master as that of the source mount. The cloned mount
  *       is marked as 'shared and slave'.
  * (*)   the cloned mount is made a slave of the same master as that of the
- * 	 source mount.
+ *	 source mount.
  *
  * ---------------------------------------------------------------------------
- * |         		MOVE MOUNT OPERATION                                 |
+ * |			MOVE MOUNT OPERATION                                 |
  * |**************************************************************************
  * | source-->| shared        |       private  |       slave    | unbindable |
  * | dest     |               |                |                |            |
@@ -1588,11 +1587,11 @@ static int invent_group_ids(struct vfsmount *mnt, bool recurse)
  * ***************************************************************************
  *
  * (+)  the mount is moved to the destination. And is then propagated to
- * 	all the mounts in the propagation tree of the destination mount.
+ *	all the mounts in the propagation tree of the destination mount.
  * (+*)  the mount is moved to the destination.
  * (+++)  the mount is moved to the destination and is then propagated to
- * 	all the mounts belonging to the destination mount's propagation tree.
- * 	the mount is marked as 'shared and slave'.
+ *	all the mounts belonging to the destination mount's propagation tree.
+ *	the mount is marked as 'shared and slave'.
  * (*)	the mount continues to be a slave at the new location.
  *
  * if the source mount is a tree, the operations explained above is
@@ -1977,7 +1976,8 @@ EXPORT_SYMBOL_GPL(do_kern_mount);
 /*
  * add a mount into a namespace's mount tree
  */
-static int do_add_mount(struct vfsmount *newmnt, struct path *path, int mnt_flags)
+static int
+do_add_mount(struct vfsmount *newmnt, struct path *path, int mnt_flags)
 {
 	int err;
 
@@ -2123,7 +2123,6 @@ void mark_mounts_for_expiry(struct list_head *mounts)
 
 	release_mounts(&umounts);
 }
-
 EXPORT_SYMBOL_GPL(mark_mounts_for_expiry);
 
 /*
@@ -2132,7 +2131,8 @@ EXPORT_SYMBOL_GPL(mark_mounts_for_expiry);
  * search the list of submounts for a given mountpoint, and move any
  * shrinkable submounts to the 'graveyard' list.
  */
-static int select_submounts(struct vfsmount *parent, struct list_head *graveyard)
+static int
+select_submounts(struct vfsmount *parent, struct list_head *graveyard)
 {
 	struct vfsmount *this_parent = parent;
 	struct list_head *next;
@@ -2143,7 +2143,8 @@ repeat:
 resume:
 	while (next != &this_parent->mnt_mounts) {
 		struct list_head *tmp = next;
-		struct vfsmount *mnt = list_entry(tmp, struct vfsmount, mnt_child);
+		struct vfsmount *mnt = list_entry(tmp, struct vfsmount,
+						  mnt_child);
 
 		next = tmp->next;
 		if (!(mnt->mnt_flags & MNT_SHRINKABLE))
@@ -2222,7 +2223,7 @@ static long exact_copy_from_user(void *to, const void __user * from,
 	return n;
 }
 
-int copy_mount_options(const void __user * data, unsigned long *where)
+int copy_mount_options(const void __user *data, unsigned long *where)
 {
 	int i;
 	unsigned long page;
@@ -2232,7 +2233,8 @@ int copy_mount_options(const void __user * data, unsigned long *where)
 	if (!data)
 		return 0;
 
-	if (!(page = __get_free_page(GFP_KERNEL)))
+	page = __get_free_page(GFP_KERNEL);
+	if (!page)
 		return -ENOMEM;
 
 	/* We only care that *some* data at the address the user
@@ -2336,7 +2338,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
 		mnt_flags |= MNT_READONLY;
 
 	flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN |
-		   MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
+		   MS_NOATIME | MS_NODIRATIME | MS_RELATIME | MS_KERNMOUNT |
 		   MS_STRICTATIME);
 
 	if (flags & MS_REMOUNT)
-- 
1.7.6.405.gc1be0


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

* [PATCH 17/28] block_dev: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (15 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 16/28] namespace: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 18/28] dcache: " Joe Perches
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Fix a few style things.  Now checkpatch clean.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/block_dev.c | \
  cut -f3- -d":" | sort | uniq -c
      1  ERROR: code indent should use tabs where possible
      1  ERROR: do not use assignment in if condition
      4  ERROR: "foo * bar" should be "foo *bar"
      1  ERROR: space prohibited after that open parenthesis '('
      1  ERROR: space prohibited before that close parenthesis ')'
      1  ERROR: space required after that ',' (ctx:VxV)
      1  ERROR: switch and case should be at the same indent
      4  ERROR: trailing whitespace
      2  WARNING: braces {} are not necessary for single statement blocks
      7  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
      1  WARNING: line over 80 characters
      4  WARNING: please, no space before tabs
      2  WARNING: please, no spaces at the start of a line
      1  WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/block_dev.c |   70 +++++++++++++++++++++++++------------------------------
 1 files changed, 32 insertions(+), 38 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 20aa631..8b9bbf6 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -27,7 +27,7 @@
 #include <linux/namei.h>
 #include <linux/log2.h>
 #include <linux/kmemleak.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 
 struct bdev_inode {
@@ -90,7 +90,7 @@ static void kill_bdev(struct block_device *bdev)
 		return;
 	invalidate_bh_lrus();
 	truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
-}	
+}
 
 int set_blocksize(struct block_device *bdev, int size)
 {
@@ -111,7 +111,6 @@ int set_blocksize(struct block_device *bdev, int size)
 	}
 	return 0;
 }
-
 EXPORT_SYMBOL(set_blocksize);
 
 int sb_set_blocksize(struct super_block *sb, int size)
@@ -124,7 +123,6 @@ int sb_set_blocksize(struct super_block *sb, int size)
 	sb->s_blocksize_bits = blksize_bits(size);
 	return sb->s_blocksize;
 }
-
 EXPORT_SYMBOL(sb_set_blocksize);
 
 int sb_min_blocksize(struct super_block *sb, int size)
@@ -134,7 +132,6 @@ int sb_min_blocksize(struct super_block *sb, int size)
 		size = minsize;
 	return sb_set_blocksize(sb, size);
 }
-
 EXPORT_SYMBOL(sb_min_blocksize);
 
 static int
@@ -321,7 +318,7 @@ static int blkdev_writepage(struct page *page, struct writeback_control *wbc)
 	return block_write_full_page(page, blkdev_get_block, wbc);
 }
 
-static int blkdev_readpage(struct file * file, struct page * page)
+static int blkdev_readpage(struct file *file, struct page *page)
 {
 	return block_read_full_page(page, blkdev_get_block);
 }
@@ -363,33 +360,32 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin)
 
 	retval = -EINVAL;
 	switch (origin) {
-		case SEEK_END:
-			offset += size;
-			break;
-		case SEEK_CUR:
-			offset += file->f_pos;
-		case SEEK_SET:
-			break;
-		default:
-			goto out;
+	case SEEK_END:
+		offset += size;
+		break;
+	case SEEK_CUR:
+		offset += file->f_pos;
+	case SEEK_SET:
+		break;
+	default:
+		goto out;
 	}
 	if (offset >= 0 && offset <= size) {
-		if (offset != file->f_pos) {
+		if (offset != file->f_pos)
 			file->f_pos = offset;
-		}
 		retval = offset;
 	}
 out:
 	mutex_unlock(&bd_inode->i_mutex);
 	return retval;
 }
-	
+
 int blkdev_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
 {
 	struct inode *bd_inode = filp->f_mapping->host;
 	struct block_device *bdev = I_BDEV(bd_inode);
 	int error;
-	
+
 	error = filemap_write_and_wait_range(filp->f_mapping, start, end);
 	if (error)
 		return error;
@@ -412,7 +408,7 @@ EXPORT_SYMBOL(blkdev_fsync);
  */
 
 static  __cacheline_aligned_in_smp DEFINE_SPINLOCK(bdev_lock);
-static struct kmem_cache * bdev_cachep __read_mostly;
+static struct kmem_cache *bdev_cachep __read_mostly;
 
 static struct inode *bdev_alloc_inode(struct super_block *sb)
 {
@@ -468,9 +464,8 @@ static void bdev_evict_inode(struct inode *inode)
 	invalidate_inode_buffers(inode); /* is it needed here? */
 	end_writeback(inode);
 	spin_lock(&bdev_lock);
-	while ( (p = bdev->bd_inodes.next) != &bdev->bd_inodes ) {
+	while ((p = bdev->bd_inodes.next) != &bdev->bd_inodes)
 		__bd_forget(list_entry(p, struct inode, i_devices));
-	}
 	list_del_init(&bdev->bd_list);
 	spin_unlock(&bdev_lock);
 }
@@ -576,7 +571,6 @@ struct block_device *bdget(dev_t dev)
 	}
 	return bdev;
 }
-
 EXPORT_SYMBOL(bdget);
 
 /**
@@ -605,9 +599,8 @@ void bdput(struct block_device *bdev)
 {
 	iput(bdev->bd_inode);
 }
-
 EXPORT_SYMBOL(bdput);
- 
+
 static struct block_device *bd_acquire(struct inode *inode)
 {
 	struct block_device *bdev;
@@ -677,18 +670,19 @@ static bool bd_may_claim(struct block_device *bdev, struct block_device *whole,
 			 void *holder)
 {
 	if (bdev->bd_holder == holder)
-		return true;	 /* already a holder */
+		return true;	/* already a holder */
 	else if (bdev->bd_holder != NULL)
-		return false; 	 /* held by someone else */
+		return false;	/* held by someone else */
 	else if (bdev->bd_contains == bdev)
-		return true;  	 /* is a whole device which isn't held */
+		return true;	/* is a whole device which isn't held */
 
 	else if (whole->bd_holder == bd_may_claim)
-		return true; 	 /* is a partition of a device that is being partitioned */
+		return true;	/* is a partition of a device
+				 * that is being partitioned */
 	else if (whole->bd_holder != NULL)
-		return false;	 /* is a partition of a held device */
+		return false;	/* is a partition of a held device */
 	else
-		return true;	 /* is a partition of an un-held device */
+		return true;	/* is a partition of an un-held device */
 }
 
 /**
@@ -1056,7 +1050,6 @@ int check_disk_change(struct block_device *bdev)
 		bdops->revalidate_disk(bdev->bd_disk);
 	return 1;
 }
-
 EXPORT_SYMBOL(check_disk_change);
 
 void bd_set_size(struct block_device *bdev, loff_t size)
@@ -1149,7 +1142,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
 			}
 
 			if (!ret && !bdev->bd_openers) {
-				bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
+				bd_set_size(bdev,
+					    (loff_t)get_capacity(disk) << 9);
 				bdi = blk_get_backing_dev_info(bdev);
 				if (bdi == NULL)
 					bdi = &default_backing_dev_info;
@@ -1393,7 +1387,7 @@ struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, void *holder)
 }
 EXPORT_SYMBOL(blkdev_get_by_dev);
 
-static int blkdev_open(struct inode * inode, struct file * filp)
+static int blkdev_open(struct inode *inode, struct file *filp)
 {
 	struct block_device *bdev;
 
@@ -1483,7 +1477,8 @@ int blkdev_put(struct block_device *bdev, fmode_t mode)
 		WARN_ON_ONCE(--bdev->bd_contains->bd_holders < 0);
 
 		/* bd_contains might point to self, check in a separate step */
-		if ((bdev_free = !bdev->bd_holders))
+		bdev_free = !bdev->bd_holders;
+		if (bdev_free)
 			bdev->bd_holder = NULL;
 		if (!bdev->bd_contains->bd_holders)
 			bdev->bd_contains->bd_holder = NULL;
@@ -1513,7 +1508,7 @@ int blkdev_put(struct block_device *bdev, fmode_t mode)
 }
 EXPORT_SYMBOL(blkdev_put);
 
-static int blkdev_close(struct inode * inode, struct file * filp)
+static int blkdev_close(struct inode *inode, struct file *filp)
 {
 	struct block_device *bdev = I_BDEV(filp->f_mapping->host);
 
@@ -1594,7 +1589,7 @@ const struct file_operations def_blk_fops = {
 	.llseek		= block_llseek,
 	.read		= do_sync_read,
 	.write		= do_sync_write,
-  	.aio_read	= generic_file_aio_read,
+	.aio_read	= generic_file_aio_read,
 	.aio_write	= blkdev_aio_write,
 	.mmap		= generic_file_mmap,
 	.fsync		= blkdev_fsync,
@@ -1615,7 +1610,6 @@ int ioctl_by_bdev(struct block_device *bdev, unsigned cmd, unsigned long arg)
 	set_fs(old_fs);
 	return res;
 }
-
 EXPORT_SYMBOL(ioctl_by_bdev);
 
 /**
-- 
1.7.6.405.gc1be0


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

* [PATCH 18/28] dcache: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (16 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 17/28] block_dev: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 19/28] fcntl: " Joe Perches
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Style fixing, trivial 80 col and a kstrtoul checkpatch errors remain.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/dcache.c | \
  cut -f3- -d":" | sort | uniq -c
     10  ERROR: code indent should use tabs where possible
     15  ERROR: "foo * bar" should be "foo *bar"
      1  ERROR: space prohibited before that close parenthesis ')'
     21  ERROR: trailing whitespace
      1  WARNING: braces {} are not necessary for single statement blocks
      3  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
      1  WARNING: externs should be avoided in .c files
      8  WARNING: line over 80 characters
      5  WARNING: please, no space before tabs
     20  WARNING: please, no spaces at the start of a line
      1  WARNING: simple_strtoul is obsolete, use kstrtoul instead
      1  WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/dcache.c |  128 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 65 insertions(+), 63 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 6055631..1d62cf7 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -28,7 +28,7 @@
 #include <linux/module.h>
 #include <linux/mount.h>
 #include <linux/file.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/security.h>
 #include <linux/seqlock.h>
 #include <linux/swap.h>
@@ -84,7 +84,6 @@ EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);
 
 static __cacheline_aligned_in_smp DEFINE_SPINLOCK(dcache_lru_lock);
 __cacheline_aligned_in_smp DEFINE_SEQLOCK(rename_lock);
-
 EXPORT_SYMBOL(rename_lock);
 
 static struct kmem_cache *dentry_cache __read_mostly;
@@ -145,7 +144,7 @@ static void __d_free(struct rcu_head *head)
 	WARN_ON(!list_empty(&dentry->d_alias));
 	if (dname_external(dentry))
 		kfree(dentry->d_name.name);
-	kmem_cache_free(dentry_cache, dentry); 
+	kmem_cache_free(dentry_cache, dentry);
 }
 
 /*
@@ -184,7 +183,7 @@ static inline void dentry_rcuwalk_barrier(struct dentry *dentry)
  * d_iput() operation if defined. Dentry has no refcount
  * and is unhashed.
  */
-static void dentry_iput(struct dentry * dentry)
+static void dentry_iput(struct dentry *dentry)
 	__releases(dentry->d_lock)
 	__releases(dentry->d_inode->i_lock)
 {
@@ -209,7 +208,7 @@ static void dentry_iput(struct dentry * dentry)
  * Release the dentry's inode, using the filesystem
  * d_iput() operation if defined. dentry remains in-use.
  */
-static void dentry_unlink_inode(struct dentry * dentry)
+static void dentry_unlink_inode(struct dentry *dentry)
 	__releases(dentry->d_lock)
 	__releases(dentry->d_inode->i_lock)
 {
@@ -437,7 +436,7 @@ relock:
 	return d_kill(dentry, parent);
 }
 
-/* 
+/*
  * This is dput
  *
  * This is complicated by the fact that we do not want to put
@@ -456,7 +455,7 @@ relock:
 
 /*
  * dput - release a dentry
- * @dentry: dentry to release 
+ * @dentry: dentry to release
  *
  * Release a dentry. This will drop the usage count and if appropriate
  * call the dentry unlink method as well as removing it from the queues and
@@ -485,7 +484,7 @@ repeat:
 	}
 
 	/* Unreachable? Get rid of it */
- 	if (d_unhashed(dentry))
+	if (d_unhashed(dentry))
 		goto kill_it;
 
 	/*
@@ -519,8 +518,8 @@ EXPORT_SYMBOL(dput);
  *
  * no dcache lock.
  */
- 
-int d_invalidate(struct dentry * dentry)
+
+int d_invalidate(struct dentry *dentry)
 {
 	/*
 	 * If it's already been dropped, return OK.
@@ -627,7 +626,7 @@ again:
 	discon_alias = NULL;
 	list_for_each_entry(alias, &inode->i_dentry, d_alias) {
 		spin_lock(&alias->d_lock);
- 		if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) {
+		if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) {
 			if (IS_ROOT(alias) &&
 			    (alias->d_flags & DCACHE_DISCONNECTED)) {
 				discon_alias = alias;
@@ -960,7 +959,8 @@ void shrink_dcache_for_umount(struct super_block *sb)
 	shrink_dcache_for_umount_subtree(dentry);
 
 	while (!hlist_bl_empty(&sb->s_anon)) {
-		dentry = hlist_bl_entry(hlist_bl_first(&sb->s_anon), struct dentry, d_hash);
+		dentry = hlist_bl_entry(hlist_bl_first(&sb->s_anon),
+					struct dentry, d_hash);
 		shrink_dcache_for_umount_subtree(dentry);
 	}
 }
@@ -971,7 +971,8 @@ void shrink_dcache_for_umount(struct super_block *sb)
  * the parenthood after dropping the lock and check
  * that the sequence number still matches.
  */
-static struct dentry *try_to_ascend(struct dentry *old, int locked, unsigned seq)
+static struct dentry *
+try_to_ascend(struct dentry *old, int locked, unsigned seq)
 {
 	struct dentry *new = old->d_parent;
 
@@ -999,7 +1000,7 @@ static struct dentry *try_to_ascend(struct dentry *old, int locked, unsigned seq
  * We descend to the next level whenever the d_subdirs
  * list is non-empty and continue searching.
  */
- 
+
 /**
  * have_submounts - check for mounts over a dentry
  * @parent: dentry to check.
@@ -1026,7 +1027,8 @@ repeat:
 resume:
 	while (next != &this_parent->d_subdirs) {
 		struct list_head *tmp = next;
-		struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child);
+		struct dentry *dentry = list_entry(tmp, struct dentry,
+						   d_u.d_child);
 		next = tmp->next;
 
 		spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
@@ -1090,7 +1092,7 @@ EXPORT_SYMBOL(have_submounts);
  * drop the lock and return early due to latency
  * constraints.
  */
-static int select_parent(struct dentry * parent)
+static int select_parent(struct dentry *parent)
 {
 	struct dentry *this_parent;
 	struct list_head *next;
@@ -1107,13 +1109,14 @@ repeat:
 resume:
 	while (next != &this_parent->d_subdirs) {
 		struct list_head *tmp = next;
-		struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child);
+		struct dentry *dentry = list_entry(tmp, struct dentry,
+						   d_u.d_child);
 		next = tmp->next;
 
 		spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
 
-		/* 
-		 * move only zero ref count dentries to the end 
+		/*
+		 * move only zero ref count dentries to the end
 		 * of the unused list for prune_dcache
 		 */
 		if (!dentry->d_count) {
@@ -1179,8 +1182,8 @@ rename_retry:
  *
  * Prune the dcache to remove unused children of the parent dentry.
  */
- 
-void shrink_dcache_parent(struct dentry * parent)
+
+void shrink_dcache_parent(struct dentry *parent)
 {
 	struct super_block *sb = parent->d_sb;
 	int found;
@@ -1199,7 +1202,7 @@ EXPORT_SYMBOL(shrink_dcache_parent);
  * available. On a success the dentry is returned. The name passed in is
  * copied and the copy passed in may be reused after this call.
  */
- 
+
 struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
 {
 	struct dentry *dentry;
@@ -1212,12 +1215,12 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
 	if (name->len > DNAME_INLINE_LEN-1) {
 		dname = kmalloc(name->len + 1, GFP_KERNEL);
 		if (!dname) {
-			kmem_cache_free(dentry_cache, dentry); 
+			kmem_cache_free(dentry_cache, dentry);
 			return NULL;
 		}
 	} else  {
 		dname = dentry->d_iname;
-	}	
+	}
 	dentry->d_name.name = dname;
 
 	dentry->d_name.len = name->len;
@@ -1298,10 +1301,10 @@ EXPORT_SYMBOL(d_alloc_name);
 void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op)
 {
 	WARN_ON_ONCE(dentry->d_op);
-	WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH	|
-				DCACHE_OP_COMPARE	|
-				DCACHE_OP_REVALIDATE	|
-				DCACHE_OP_DELETE ));
+	WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH		|
+					DCACHE_OP_COMPARE	|
+					DCACHE_OP_REVALIDATE	|
+					DCACHE_OP_DELETE));
 	dentry->d_op = op;
 	if (!op)
 		return;
@@ -1347,7 +1350,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
  * (or otherwise set) by the caller to indicate that it is now
  * in use by the dcache.
  */
- 
+
 void d_instantiate(struct dentry *entry, struct inode * inode)
 {
 	BUG_ON(!list_empty(&entry->d_alias));
@@ -1432,7 +1435,6 @@ struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode)
 	iput(inode);
 	return result;
 }
-
 EXPORT_SYMBOL(d_instantiate_unique);
 
 /**
@@ -1443,8 +1445,8 @@ EXPORT_SYMBOL(d_instantiate_unique);
  * instantiated and returned. %NULL is returned if there is insufficient
  * memory or the inode passed is %NULL.
  */
- 
-struct dentry * d_alloc_root(struct inode * root_inode)
+
+struct dentry *d_alloc_root(struct inode *root_inode)
 {
 	struct dentry *res = NULL;
 
@@ -1459,7 +1461,7 @@ struct dentry * d_alloc_root(struct inode * root_inode)
 }
 EXPORT_SYMBOL(d_alloc_root);
 
-static struct dentry * __d_find_any_alias(struct inode *inode)
+static struct dentry *__d_find_any_alias(struct inode *inode)
 {
 	struct dentry *alias;
 
@@ -1470,7 +1472,7 @@ static struct dentry * __d_find_any_alias(struct inode *inode)
 	return alias;
 }
 
-static struct dentry * d_find_any_alias(struct inode *inode)
+static struct dentry *d_find_any_alias(struct inode *inode)
 {
 	struct dentry *de;
 
@@ -1798,10 +1800,10 @@ struct dentry *d_lookup(struct dentry *parent, struct qstr *name)
 	struct dentry *dentry;
 	unsigned seq;
 
-        do {
-                seq = read_seqbegin(&rename_lock);
-                dentry = __d_lookup(parent, name);
-                if (dentry)
+	do {
+		seq = read_seqbegin(&rename_lock);
+		dentry = __d_lookup(parent, name);
+		if (dentry)
 			break;
 	} while (read_seqretry(&rename_lock, seq));
 	return dentry;
@@ -1854,7 +1856,7 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name)
 	 * See Documentation/filesystems/path-lookup.txt for more details.
 	 */
 	rcu_read_lock();
-	
+
 	hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) {
 		const char *tname;
 		int tlen;
@@ -1890,10 +1892,10 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name)
 		break;
 next:
 		spin_unlock(&dentry->d_lock);
- 	}
- 	rcu_read_unlock();
+	}
+	rcu_read_unlock();
 
- 	return found;
+	return found;
 }
 
 /**
@@ -1965,7 +1967,7 @@ EXPORT_SYMBOL(d_validate);
  * it from the hash queues and waiting for
  * it to be deleted later when it has no users
  */
- 
+
 /**
  * d_delete - delete a dentry
  * @dentry: The dentry to delete
@@ -1973,8 +1975,8 @@ EXPORT_SYMBOL(d_validate);
  * Turn the dentry into a negative dentry if possible, otherwise
  * remove it from the hash queues so it can be deleted later
  */
- 
-void d_delete(struct dentry * dentry)
+
+void d_delete(struct dentry *dentry)
 {
 	struct inode *inode;
 	int isdir = 0;
@@ -2006,7 +2008,7 @@ again:
 }
 EXPORT_SYMBOL(d_delete);
 
-static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b)
+static void __d_rehash(struct dentry *entry, struct hlist_bl_head *b)
 {
 	BUG_ON(!d_unhashed(entry));
 	hlist_bl_lock(b);
@@ -2015,7 +2017,7 @@ static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b)
 	hlist_bl_unlock(b);
 }
 
-static void _d_rehash(struct dentry * entry)
+static void _d_rehash(struct dentry *entry)
 {
 	__d_rehash(entry, d_hash(entry->d_parent, entry->d_name.hash));
 }
@@ -2026,8 +2028,8 @@ static void _d_rehash(struct dentry * entry)
  *
  * Adds a dentry to the hash according to its name.
  */
- 
-void d_rehash(struct dentry * entry)
+
+void d_rehash(struct dentry *entry)
 {
 	spin_lock(&entry->d_lock);
 	_d_rehash(entry);
@@ -2160,7 +2162,7 @@ static void dentry_unlock_parents_for_move(struct dentry *dentry,
  * rename_lock, the i_mutex of the source and target directories,
  * and the sb->s_vfs_rename_mutex if they differ. See lock_rename().
  */
-static void __d_move(struct dentry * dentry, struct dentry * target)
+static void __d_move(struct dentry *dentry, struct dentry *target)
 {
 	if (!dentry->d_inode)
 		pr_warn("VFS: moving negative dcache entry\n");
@@ -2457,13 +2459,12 @@ static int prepend_path(const struct path *path, struct path *root,
 
 	br_read_lock(&vfsmount_lock);
 	while (dentry != root->dentry || vfsmnt != root->mnt) {
-		struct dentry * parent;
+		struct dentry *parent;
 
 		if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
 			/* Global root? */
-			if (vfsmnt->mnt_parent == vfsmnt) {
+			if (vfsmnt->mnt_parent == vfsmnt)
 				goto global_root;
-			}
 			dentry = vfsmnt->mnt_mountpoint;
 			vfsmnt = vfsmnt->mnt_parent;
 			continue;
@@ -2808,7 +2809,7 @@ out:
  * Returns 0 otherwise.
  * Caller must ensure that "new_dentry" is pinned before calling is_subdir()
  */
-  
+
 int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
 {
 	int result;
@@ -2876,7 +2877,8 @@ repeat:
 resume:
 	while (next != &this_parent->d_subdirs) {
 		struct list_head *tmp = next;
-		struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child);
+		struct dentry *dentry = list_entry(tmp, struct dentry,
+						   d_u.d_child);
 		next = tmp->next;
 
 		spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
@@ -2921,6 +2923,7 @@ rename_retry:
 	write_seqlock(&rename_lock);
 	goto again;
 }
+EXPORT_SYMBOL(d_genocide);
 
 /**
  * find_inode_number - check for dentry with name
@@ -2935,10 +2938,10 @@ rename_retry:
  * filesystems using synthetic inode numbers, and is necessary
  * to keep getcwd() working.
  */
- 
+
 ino_t find_inode_number(struct dentry *dir, struct qstr *name)
 {
-	struct dentry * dentry;
+	struct dentry *dentry;
 	ino_t ino = 0;
 
 	dentry = d_hash_and_lookup(dir, name);
@@ -2989,10 +2992,10 @@ static void __init dcache_init(void)
 {
 	int loop;
 
-	/* 
+	/*
 	 * A constructor could be added for stable state like the lists,
 	 * but it is probably not worth it because of the cache nature
-	 * of the dcache. 
+	 * of the dcache.
 	 */
 	dentry_cache = KMEM_CACHE(dentry,
 		SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD);
@@ -3019,8 +3022,6 @@ static void __init dcache_init(void)
 struct kmem_cache *names_cachep __read_mostly;
 EXPORT_SYMBOL(names_cachep);
 
-EXPORT_SYMBOL(d_genocide);
-
 void __init vfs_caches_init_early(void)
 {
 	dcache_init_early();
@@ -3031,8 +3032,9 @@ void __init vfs_caches_init(unsigned long mempages)
 {
 	unsigned long reserve;
 
-	/* Base hash sizes on available memory, with a reserve equal to
-           150% of current kernel size */
+	/* Base hash sizes on available memory
+	 * with a reserve equal to 150% of current kernel size
+	 */
 
 	reserve = min((mempages - nr_free_pages()) * 3/2, mempages - 1);
 	mempages -= reserve;
-- 
1.7.6.405.gc1be0


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

* [PATCH 19/28] fcntl: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (17 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 18/28] dcache: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 20/28] file: " Joe Perches
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro, Matthew Wilcox; +Cc: linux-fsdevel, linux-kernel

Now checkpatch clean.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/fcntl.c | \
  cut -f3- -d":" | sort | uniq -c
      5  ERROR: code indent should use tabs where possible
      6  ERROR: "foo * bar" should be "foo *bar"
      2  ERROR: switch and case should be at the same indent
      9  ERROR: trailing whitespace
      1  WARNING: braces {} are not necessary for single statement blocks
      1  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
      4  WARNING: line over 80 characters
      1  WARNING: please, no space before tabs
      4  WARNING: please, no spaces at the start of a line
      1  WARNING: suspect code indent for conditional statements (15, 19)
      1  WARNING: suspect code indent for conditional statements (8, 15)
      1  WARNING: Use #include <linux/poll.h> instead of <asm/poll.h>
      1  WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/fcntl.c |  128 +++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 66 insertions(+), 62 deletions(-)

diff --git a/fs/fcntl.c b/fs/fcntl.c
index 5d16b1d..cc887fd 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -22,10 +22,9 @@
 #include <linux/signal.h>
 #include <linux/rcupdate.h>
 #include <linux/pid_namespace.h>
-
-#include <asm/poll.h>
+#include <linux/poll.h>
+#include <linux/uaccess.h>
 #include <asm/siginfo.h>
-#include <asm/uaccess.h>
 
 void set_close_on_exec(unsigned int fd, int flag)
 {
@@ -55,8 +54,8 @@ static int get_close_on_exec(unsigned int fd)
 SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags)
 {
 	int err = -EBADF;
-	struct file * file, *tofree;
-	struct files_struct * files = current->files;
+	struct file *file, *tofree;
+	struct files_struct *files = current->files;
 	struct fdtable *fdt;
 
 	if ((flags & ~O_CLOEXEC) != 0)
@@ -147,9 +146,9 @@ SYSCALL_DEFINE1(dup, unsigned int, fildes)
 
 #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
 
-static int setfl(int fd, struct file * filp, unsigned long arg)
+static int setfl(int fd, struct file *filp, unsigned long arg)
 {
-	struct inode * inode = filp->f_path.dentry->d_inode;
+	struct inode *inode = filp->f_path.dentry->d_inode;
 	int error = 0;
 
 	/*
@@ -165,9 +164,10 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
 			return -EPERM;
 
 	/* required for strict SunOS emulation */
-	if (O_NONBLOCK != O_NDELAY)
-	       if (arg & O_NDELAY)
-		   arg |= O_NONBLOCK;
+	if (O_NONBLOCK != O_NDELAY) {
+		if (arg & O_NDELAY)
+			arg |= O_NONBLOCK;
+	}
 
 	if (arg & O_DIRECT) {
 		if (!filp->f_mapping || !filp->f_mapping->a_ops ||
@@ -200,7 +200,7 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
 }
 
 static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
-                     int force)
+		     int force)
 {
 	write_lock_irq(&filp->f_owner.lock);
 	if (force || !filp->f_owner.pid) {
@@ -403,9 +403,8 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
 		break;
 	case F_SETSIG:
 		/* arg == 0 restores default behaviour. */
-		if (!valid_signal(arg)) {
+		if (!valid_signal(arg))
 			break;
-		}
 		err = 0;
 		filp->f_owner.signum = arg;
 		break;
@@ -442,7 +441,7 @@ static int check_fcntl_cmd(unsigned cmd)
 }
 
 SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
-{	
+{
 	struct file *filp;
 	long err = -EBADF;
 
@@ -465,7 +464,7 @@ SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
 
 	err = do_fcntl(fd, cmd, arg, filp);
 
- 	fput(filp);
+	fput(filp);
 out:
 	return err;
 }
@@ -473,8 +472,8 @@ out:
 #if BITS_PER_LONG == 32
 SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
 		unsigned long, arg)
-{	
-	struct file * filp;
+{
+	struct file *filp;
 	long err;
 
 	err = -EBADF;
@@ -495,19 +494,19 @@ SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
 		return err;
 	}
 	err = -EBADF;
-	
+
 	switch (cmd) {
-		case F_GETLK64:
-			err = fcntl_getlk64(filp, (struct flock64 __user *) arg);
-			break;
-		case F_SETLK64:
-		case F_SETLKW64:
-			err = fcntl_setlk64(fd, filp, cmd,
-					(struct flock64 __user *) arg);
-			break;
-		default:
-			err = do_fcntl(fd, cmd, arg, filp);
-			break;
+	case F_GETLK64:
+		err = fcntl_getlk64(filp, (struct flock64 __user *)arg);
+		break;
+	case F_SETLK64:
+	case F_SETLKW64:
+		err = fcntl_setlk64(fd, filp, cmd,
+				    (struct flock64 __user *)arg);
+		break;
+	default:
+		err = do_fcntl(fd, cmd, arg, filp);
+		break;
 	}
 	fput(filp);
 out:
@@ -527,7 +526,7 @@ static const long band_table[NSIGPOLL] = {
 };
 
 static inline int sigio_perm(struct task_struct *p,
-                             struct fown_struct *fown, int sig)
+			     struct fown_struct *fown, int sig)
 {
 	const struct cred *cred;
 	int ret;
@@ -556,31 +555,33 @@ static void send_sigio_to_task(struct task_struct *p,
 		return;
 
 	switch (signum) {
+	default: {
 		siginfo_t si;
-		default:
-			/* Queue a rt signal with the appropriate fd as its
-			   value.  We use SI_SIGIO as the source, not 
-			   SI_KERNEL, since kernel signals always get 
-			   delivered even if we can't queue.  Failure to
-			   queue in this case _should_ be reported; we fall
-			   back to SIGIO in that case. --sct */
-			si.si_signo = signum;
-			si.si_errno = 0;
-		        si.si_code  = reason;
-			/* Make sure we are called with one of the POLL_*
-			   reasons, otherwise we could leak kernel stack into
-			   userspace.  */
-			BUG_ON((reason & __SI_MASK) != __SI_POLL);
-			if (reason - POLL_IN >= NSIGPOLL)
-				si.si_band  = ~0L;
-			else
-				si.si_band = band_table[reason - POLL_IN];
-			si.si_fd    = fd;
-			if (!do_send_sig_info(signum, &si, p, group))
-				break;
+
+		/* Queue a rt signal with the appropriate fd as its
+		   value.  We use SI_SIGIO as the source, not
+		   SI_KERNEL, since kernel signals always get
+		   delivered even if we can't queue.  Failure to
+		   queue in this case _should_ be reported; we fall
+		   back to SIGIO in that case. --sct */
+		si.si_signo = signum;
+		si.si_errno = 0;
+		si.si_code  = reason;
+		/* Make sure we are called with one of the POLL_*
+		   reasons, otherwise we could leak kernel stack into
+		   userspace.  */
+		BUG_ON((reason & __SI_MASK) != __SI_POLL);
+		if (reason - POLL_IN >= NSIGPOLL)
+			si.si_band  = ~0L;
+		else
+			si.si_band = band_table[reason - POLL_IN];
+		si.si_fd    = fd;
+		if (!do_send_sig_info(signum, &si, p, group))
+			break;
 		/* fall-through: fall back on the old plain SIGIO signal */
-		case 0:
-			do_send_sig_info(SIGIO, SEND_SIG_PRIV, p, group);
+	}
+	case 0:
+		do_send_sig_info(SIGIO, SEND_SIG_PRIV, p, group);
 	}
 }
 
@@ -590,7 +591,7 @@ void send_sigio(struct fown_struct *fown, int fd, int band)
 	enum pid_type type;
 	struct pid *pid;
 	int group = 1;
-	
+
 	read_lock(&fown->lock);
 
 	type = fown->pid_type;
@@ -602,7 +603,7 @@ void send_sigio(struct fown_struct *fown, int fd, int band)
 	pid = fown->pid;
 	if (!pid)
 		goto out_unlock_fown;
-	
+
 	read_lock(&tasklist_lock);
 	do_each_pid_task(pid, type, p) {
 		send_sigio_to_task(p, fown, fd, band, group);
@@ -626,7 +627,7 @@ int send_sigurg(struct fown_struct *fown)
 	struct pid *pid;
 	int group = 1;
 	int ret = 0;
-	
+
 	read_lock(&fown->lock);
 
 	type = fown->pid_type;
@@ -640,7 +641,7 @@ int send_sigurg(struct fown_struct *fown)
 		goto out_unlock_fown;
 
 	ret = 1;
-	
+
 	read_lock(&tasklist_lock);
 	do_each_pid_task(pid, type, p) {
 		send_sigurg_to_task(p, fown, group);
@@ -717,9 +718,11 @@ void fasync_free(struct fasync_struct *new)
  * NOTE! It is very important that the FASYNC flag always
  * match the state "is the filp on a fasync list".
  */
-struct fasync_struct *fasync_insert_entry(int fd, struct file *filp, struct fasync_struct **fapp, struct fasync_struct *new)
+struct fasync_struct *
+fasync_insert_entry(int fd, struct file *filp, struct fasync_struct **fapp,
+		    struct fasync_struct *new)
 {
-        struct fasync_struct *fa, **fp;
+	struct fasync_struct *fa, **fp;
 
 	spin_lock(&filp->f_lock);
 	spin_lock(&fasync_lock);
@@ -751,7 +754,8 @@ out:
  * Add a fasync entry. Return negative on error, positive if
  * added, and zero if did nothing but change an existing one.
  */
-static int fasync_add_entry(int fd, struct file *filp, struct fasync_struct **fapp)
+static int
+fasync_add_entry(int fd, struct file *filp, struct fasync_struct **fapp)
 {
 	struct fasync_struct *new;
 
@@ -780,13 +784,13 @@ static int fasync_add_entry(int fd, struct file *filp, struct fasync_struct **fa
  * lease code. It returns negative on error, 0 if it did no changes
  * and positive if it added/deleted the entry.
  */
-int fasync_helper(int fd, struct file * filp, int on, struct fasync_struct **fapp)
+int
+fasync_helper(int fd, struct file *filp, int on, struct fasync_struct **fapp)
 {
 	if (!on)
 		return fasync_remove_entry(filp, fapp);
 	return fasync_add_entry(fd, filp, fapp);
 }
-
 EXPORT_SYMBOL(fasync_helper);
 
 /*
-- 
1.7.6.405.gc1be0


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

* [PATCH 20/28] file: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (18 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 19/28] fcntl: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 21/28] locks: " Joe Perches
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Reflowed comments.  Now checkpatch clean.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/file.c | \
  cut -f3- -d":" | sort | uniq -c

      1  ERROR: "foo * bar" should be "foo *bar"
      1  ERROR: space required before the open parenthesis '('
      4  WARNING: line over 80 characters

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/file.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/fs/file.c b/fs/file.c
index a88b110..7128878 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -45,8 +45,9 @@ static DEFINE_PER_CPU(struct fdtable_defer, fdtable_defer_list);
 static void *alloc_fdmem(unsigned int size)
 {
 	/*
-	 * Very large allocations can stress page reclaim, so fall back to
-	 * vmalloc() if the allocation size will be considered "large" by the VM.
+	 * Very large allocations can stress page reclaim so
+	 * fall back to vmalloc() if the allocation size will
+	 * be considered "large" by the VM.
 	 */
 	if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
 		void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN);
@@ -78,7 +79,7 @@ static void free_fdtable_work(struct work_struct *work)
 	fdt = f->next;
 	f->next = NULL;
 	spin_unlock_bh(&f->lock);
-	while(fdt) {
+	while (fdt) {
 		struct fdtable *next = fdt->next;
 
 		__free_fdtable(fdt);
@@ -141,7 +142,7 @@ static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt)
 	memset((char *)(nfdt->close_on_exec) + cpy, 0, set);
 }
 
-static struct fdtable * alloc_fdtable(unsigned int nr)
+static struct fdtable *alloc_fdtable(unsigned int nr)
 {
 	struct fdtable *fdt;
 	char *data;
@@ -157,9 +158,10 @@ static struct fdtable * alloc_fdtable(unsigned int nr)
 	nr = roundup_pow_of_two(nr + 1);
 	nr *= (1024 / sizeof(struct file *));
 	/*
-	 * Note that this can drive nr *below* what we had passed if sysctl_nr_open
-	 * had been set lower between the check in expand_files() and here.  Deal
-	 * with that in caller, it's cheaper that way.
+	 * Note that this can drive nr *below* what we had passed
+	 * if sysctl_nr_open had been set lower between the check
+	 * in expand_files() and here.
+	 * Deal with that in caller, it's cheaper that way.
 	 *
 	 * We make sure that nr remains a multiple of BITS_PER_LONG - otherwise
 	 * bitmaps handling below becomes unpleasant, to put it mildly...
@@ -213,8 +215,9 @@ static int expand_fdtable(struct files_struct *files, int nr)
 	if (!new_fdt)
 		return -ENOMEM;
 	/*
-	 * extremely unlikely race - sysctl_nr_open decreased between the check in
-	 * caller and alloc_fdtable().  Cheaper to catch it here...
+	 * extremely unlikely race - sysctl_nr_open decreased
+	 * between the check in caller and alloc_fdtable().
+	 * Cheaper to catch it here...
 	 */
 	if (unlikely(new_fdt->max_fds <= nr)) {
 		__free_fdtable(new_fdt);
-- 
1.7.6.405.gc1be0


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

* [PATCH 21/28] locks: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (19 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 20/28] file: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 22/28] open: " Joe Perches
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro, Matthew Wilcox; +Cc: linux-fsdevel, linux-kernel

Almost checkpatch clean, a couple long line warnings remain.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/locks.c | \
  cut -f3- -d":" | sort | uniq -c
      3  ERROR: code indent should use tabs where possible
      1  ERROR: else should follow close brace '}'
      2  ERROR: "foo * bar" should be "foo *bar"
      1  ERROR: open brace '{' following function declarations go on the next line
      4  ERROR: return is not a function, parentheses are not required
     14  ERROR: trailing whitespace
      1  WARNING: braces {} are not necessary for any arm of this statement
      2  WARNING: braces {} are not necessary for single statement blocks
     12  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
      1  WARNING: labels should not be indented
      2  WARNING: %Ld/%Lu are not-standard C, use %lld/%llu
     11  WARNING: line over 80 characters
      3  WARNING: please, no space before tabs
      6  WARNING: please, no spaces at the start of a line
      1  WARNING: space prohibited between function name and open parenthesis '('
      1  WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/locks.c |  121 ++++++++++++++++++++++++++++--------------------------------
 1 files changed, 56 insertions(+), 65 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 10f2bdb..268da7c 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -11,11 +11,11 @@
  *
  *  Miscellaneous edits, and a total rewrite of posix_lock_file() code.
  *  Kai Petzke (wpp@marie.physik.tu-berlin.de), 1994
- *  
+ *
  *  Converted file_lock_table to a linked list from an array, which eliminates
  *  the limits on how many active file locks are open.
  *  Chad Page (pageone@netcom.com), November 27, 1994
- * 
+ *
  *  Removed dependency on file descriptors. dup()'ed file descriptors now
  *  get the same locks as the original file descriptors, and a close() on
  *  any file descriptor removes ALL the locks on the file for the current
@@ -41,7 +41,7 @@
  *  with a file pointer (filp). As a result they can be shared by a parent
  *  process and its children after a fork(). They are removed when the last
  *  file descriptor referring to the file pointer is closed (unless explicitly
- *  unlocked). 
+ *  unlocked).
  *
  *  FL_FLOCK locks never deadlock, an existing lock is always removed before
  *  upgrading from shared to exclusive (or vice versa). When this happens
@@ -50,7 +50,7 @@
  *  Andy Walker (andy@lysaker.kvaerner.no), June 09, 1995
  *
  *  Removed some race conditions in flock_lock_file(), marked other possible
- *  races. Just grep for FIXME to see them. 
+ *  races. Just grep for FIXME to see them.
  *  Dmitry Gorodchanin (pgmdsg@ibi.com), February 09, 1996.
  *
  *  Addressed Dmitry's concerns. Deadlock checking no longer recursive.
@@ -101,7 +101,8 @@
  *  Some adaptations for NFS support.
  *  Olaf Kirch (okir@monad.swb.de), Dec 1996,
  *
- *  Fixed /proc/locks interface so that we can't overrun the buffer we are handed.
+ *  Fixed /proc/locks interface so that we can't overrun the buffer
+ *  we are handed.
  *  Andy Walker (andy@lysaker.kvaerner.no), May 12, 1997.
  *
  *  Use slab allocator instead of kmalloc/kfree.
@@ -128,8 +129,7 @@
 #include <linux/time.h>
 #include <linux/rcupdate.h>
 #include <linux/pid_namespace.h>
-
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define IS_POSIX(fl)	(fl->fl_flags & FL_POSIX)
 #define IS_FLOCK(fl)	(fl->fl_flags & FL_FLOCK)
@@ -152,8 +152,10 @@ static int target_leasetype(struct file_lock *fl)
 int leases_enable = 1;
 int lease_break_time = 45;
 
-#define for_each_lock(inode, lockp) \
-	for (lockp = &inode->i_flock; *lockp != NULL; lockp = &(*lockp)->fl_next)
+#define for_each_lock(inode, lockp)				\
+	for (lockp = &inode->i_flock;				\
+	     *lockp != NULL;					\
+	     lockp = &(*lockp)->fl_next)
 
 static LIST_HEAD(file_lock_list);
 static LIST_HEAD(blocked_list);
@@ -228,7 +230,6 @@ void locks_init_lock(struct file_lock *fl)
 	memset(fl, 0, sizeof(struct file_lock));
 	locks_init_lock_heads(fl);
 }
-
 EXPORT_SYMBOL(locks_init_lock);
 
 static void locks_copy_private(struct file_lock *new, struct file_lock *fl)
@@ -270,10 +271,10 @@ void locks_copy_lock(struct file_lock *new, struct file_lock *fl)
 
 	locks_copy_private(new, fl);
 }
-
 EXPORT_SYMBOL(locks_copy_lock);
 
-static inline int flock_translate_cmd(int cmd) {
+static inline int flock_translate_cmd(int cmd)
+{
 	if (cmd & LOCK_MAND)
 		return cmd & (LOCK_MAND | LOCK_RW);
 	switch (cmd) {
@@ -295,7 +296,7 @@ static int flock_make_lock(struct file *filp, struct file_lock **lock,
 	int type = flock_translate_cmd(cmd);
 	if (type < 0)
 		return type;
-	
+
 	fl = locks_alloc_lock();
 	if (fl == NULL)
 		return -ENOMEM;
@@ -305,7 +306,7 @@ static int flock_make_lock(struct file *filp, struct file_lock **lock,
 	fl->fl_flags = FL_FLOCK;
 	fl->fl_type = type;
 	fl->fl_end = OFFSET_MAX;
-	
+
 	*lock = fl;
 	return 0;
 }
@@ -365,7 +366,7 @@ static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
 	fl->fl_start = start;	/* we record the absolute position */
 	if (fl->fl_end < fl->fl_start)
 		return -EOVERFLOW;
-	
+
 	fl->fl_owner = current->files;
 	fl->fl_pid = current->tgid;
 	fl->fl_file = filp;
@@ -411,7 +412,7 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
 	fl->fl_start = start;	/* we record the absolute position */
 	if (fl->fl_end < fl->fl_start)
 		return -EOVERFLOW;
-	
+
 	fl->fl_owner = current->files;
 	fl->fl_pid = current->tgid;
 	fl->fl_file = filp;
@@ -448,7 +449,7 @@ static const struct lock_manager_operations lease_manager_ops = {
  * Initialize a lease, use the default lock manager operations
  */
 static int lease_init(struct file *filp, int type, struct file_lock *fl)
- {
+{
 	if (assign_type(fl, type) != 0)
 		return -EINVAL;
 
@@ -524,7 +525,7 @@ static void locks_delete_block(struct file_lock *waiter)
  * the order they blocked. The documentation doesn't require this but
  * it seems like the reasonable thing to do.
  */
-static void locks_insert_block(struct file_lock *blocker, 
+static void locks_insert_block(struct file_lock *blocker,
 			       struct file_lock *waiter)
 {
 	BUG_ON(!list_empty(&waiter->fl_block));
@@ -611,35 +612,37 @@ static int locks_conflict(struct file_lock *caller_fl, struct file_lock *sys_fl)
 /* Determine if lock sys_fl blocks lock caller_fl. POSIX specific
  * checking before calling the locks_conflict().
  */
-static int posix_locks_conflict(struct file_lock *caller_fl, struct file_lock *sys_fl)
+static int posix_locks_conflict(struct file_lock *caller_fl,
+				struct file_lock *sys_fl)
 {
 	/* POSIX locks owned by the same process do not conflict with
 	 * each other.
 	 */
 	if (!IS_POSIX(sys_fl) || posix_same_owner(caller_fl, sys_fl))
-		return (0);
+		return 0;
 
 	/* Check whether they overlap */
 	if (!locks_overlap(caller_fl, sys_fl))
 		return 0;
 
-	return (locks_conflict(caller_fl, sys_fl));
+	return locks_conflict(caller_fl, sys_fl);
 }
 
 /* Determine if lock sys_fl blocks lock caller_fl. FLOCK specific
  * checking before calling the locks_conflict().
  */
-static int flock_locks_conflict(struct file_lock *caller_fl, struct file_lock *sys_fl)
+static int flock_locks_conflict(struct file_lock *caller_fl,
+				struct file_lock *sys_fl)
 {
 	/* FLOCK locks referring to the same filp do not conflict with
 	 * each other.
 	 */
 	if (!IS_FLOCK(sys_fl) || (caller_fl->fl_file == sys_fl->fl_file))
-		return (0);
+		return 0;
 	if ((caller_fl->fl_type & LOCK_MAND) || (sys_fl->fl_type & LOCK_MAND))
 		return 0;
 
-	return (locks_conflict(caller_fl, sys_fl));
+	return locks_conflict(caller_fl, sys_fl);
 }
 
 void
@@ -729,7 +732,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
 {
 	struct file_lock *new_fl = NULL;
 	struct file_lock **before;
-	struct inode * inode = filp->f_path.dentry->d_inode;
+	struct inode *inode = filp->f_path.dentry->d_inode;
 	int error = 0;
 	int found = 0;
 
@@ -804,7 +807,8 @@ out:
 	return error;
 }
 
-static int __posix_lock_file(struct inode *inode, struct file_lock *request, struct file_lock *conflock)
+static int __posix_lock_file(struct inode *inode, struct file_lock *request,
+			     struct file_lock *conflock)
 {
 	struct file_lock *fl;
 	struct file_lock *new_fl = NULL;
@@ -846,18 +850,15 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
 			error = FILE_LOCK_DEFERRED;
 			locks_insert_block(fl, request);
 			goto out;
-  		}
-  	}
+		}
+	}
 
 	/* If we're just looking for a conflict, we're done. */
 	error = 0;
 	if (request->fl_flags & FL_ACCESS)
 		goto out;
 
-	/*
-	 * Find the first old lock with the same owner as the new lock.
-	 */
-	
+	/* Find the first old lock with the same owner as the new lock. */
 	before = &inode->i_flock;
 
 	/* First skip locks owned by other processes.  */
@@ -902,8 +903,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
 			}
 			request = fl;
 			added = 1;
-		}
-		else {
+		} else {
 			/* Processing for different lock types is a bit
 			 * more complex.
 			 */
@@ -947,7 +947,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
 		}
 		/* Go on to next lock.
 		 */
-	next_lock:
+next_lock:
 		before = &fl->fl_next;
 	}
 
@@ -1039,7 +1039,7 @@ EXPORT_SYMBOL(posix_lock_file);
 int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
 {
 	int error;
-	might_sleep ();
+	might_sleep();
 	for (;;) {
 		error = posix_lock_file(filp, fl, NULL);
 		if (error != FILE_LOCK_DEFERRED)
@@ -1132,7 +1132,6 @@ int locks_mandatory_area(int read_write, struct inode *inode,
 
 	return error;
 }
-
 EXPORT_SYMBOL(locks_mandatory_area);
 
 static void lease_clear_pending(struct file_lock *fl, int arg)
@@ -1160,7 +1159,6 @@ int lease_modify(struct file_lock **before, int arg)
 		locks_delete_lock(before);
 	return 0;
 }
-
 EXPORT_SYMBOL(lease_modify);
 
 static bool past_time(unsigned long then)
@@ -1290,7 +1288,6 @@ out:
 		locks_free_lock(new_fl);
 	return error;
 }
-
 EXPORT_SYMBOL(__break_lease);
 
 /**
@@ -1310,7 +1307,6 @@ void lease_get_mtime(struct inode *inode, struct timespec *time)
 	else
 		*time = inode->i_mtime;
 }
-
 EXPORT_SYMBOL(lease_get_mtime);
 
 /**
@@ -1617,7 +1613,6 @@ int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
 	}
 	return error;
 }
-
 EXPORT_SYMBOL(flock_lock_file_wait);
 
 /**
@@ -1634,7 +1629,8 @@ EXPORT_SYMBOL(flock_lock_file_wait);
  *
  *	%LOCK_UN -- remove an existing lock.
  *
- *	%LOCK_MAND -- a `mandatory' flock.  This exists to emulate Windows Share Modes.
+ *	%LOCK_MAND -- a `mandatory' flock.
+ *	This exists to emulate Windows Share Modes.
  *
  *	%LOCK_MAND can be combined with %LOCK_READ or %LOCK_WRITE to allow other
  *	processes read and write access respectively.
@@ -1758,7 +1754,7 @@ int fcntl_getlk(struct file *filp, struct flock __user *l)
 	error = vfs_test_lock(filp, &file_lock);
 	if (error)
 		goto out;
- 
+
 	flock.l_type = file_lock.fl_type;
 	if (file_lock.fl_type != F_UNLCK) {
 		error = posix_lock_to_flock(&flock, &file_lock);
@@ -1805,7 +1801,8 @@ out:
  * ->lm_grant() before returning to the caller with a FILE_LOCK_DEFERRED
  * return code.
  */
-int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf)
+int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl,
+		  struct file_lock *conf)
 {
 	if (filp->f_op && filp->f_op->lock)
 		return filp->f_op->lock(filp, cmd, fl);
@@ -1874,10 +1871,9 @@ again:
 	error = flock_to_posix_lock(filp, file_lock, &flock);
 	if (error)
 		goto out;
-	if (cmd == F_SETLKW) {
+	if (cmd == F_SETLKW)
 		file_lock->fl_flags |= FL_SLEEP;
-	}
-	
+
 	error = -EBADF;
 	switch (flock.l_type) {
 	case F_RDLCK:
@@ -1951,7 +1947,7 @@ int fcntl_getlk64(struct file *filp, struct flock64 __user *l)
 	error = -EFAULT;
 	if (!copy_to_user(l, &flock, sizeof(flock)))
 		error = 0;
-  
+
 out:
 	return error;
 }
@@ -1992,10 +1988,9 @@ again:
 	error = flock64_to_posix_lock(filp, file_lock, &flock);
 	if (error)
 		goto out;
-	if (cmd == F_SETLKW64) {
+	if (cmd == F_SETLKW64)
 		file_lock->fl_flags |= FL_SLEEP;
-	}
-	
+
 	error = -EBADF;
 	switch (flock.l_type) {
 	case F_RDLCK:
@@ -2065,7 +2060,6 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner)
 	if (lock.fl_ops && lock.fl_ops->fl_release_private)
 		lock.fl_ops->fl_release_private(&lock);
 }
-
 EXPORT_SYMBOL(locks_remove_posix);
 
 /*
@@ -2073,7 +2067,7 @@ EXPORT_SYMBOL(locks_remove_posix);
  */
 void locks_remove_flock(struct file *filp)
 {
-	struct inode * inode = filp->f_path.dentry->d_inode;
+	struct inode *inode = filp->f_path.dentry->d_inode;
 	struct file_lock *fl;
 	struct file_lock **before;
 
@@ -2108,7 +2102,7 @@ void locks_remove_flock(struct file *filp)
 			}
 			/* What? */
 			BUG();
- 		}
+		}
 		before = &fl->fl_next;
 	}
 	unlock_flocks();
@@ -2134,7 +2128,6 @@ posix_unblock_lock(struct file *filp, struct file_lock *waiter)
 	unlock_flocks();
 	return status;
 }
-
 EXPORT_SYMBOL(posix_unblock_lock);
 
 /**
@@ -2150,7 +2143,6 @@ int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
 		return filp->f_op->lock(filp, F_CANCELLK, fl);
 	return 0;
 }
-
 EXPORT_SYMBOL_GPL(vfs_cancel_lock);
 
 #ifdef CONFIG_PROC_FS
@@ -2178,11 +2170,10 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
 			     (inode == NULL) ? "*NOINODE*" :
 			     mandatory_lock(inode) ? "MANDATORY" : "ADVISORY ");
 	} else if (IS_FLOCK(fl)) {
-		if (fl->fl_type & LOCK_MAND) {
+		if (fl->fl_type & LOCK_MAND)
 			seq_printf(f, "FLOCK  MSNFS     ");
-		} else {
+		else
 			seq_printf(f, "FLOCK  ADVISORY  ");
-		}
 	} else if (IS_LEASE(fl)) {
 		seq_printf(f, "LEASE  ");
 		if (lease_breaking(fl))
@@ -2220,9 +2211,9 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
 	}
 	if (IS_POSIX(fl)) {
 		if (fl->fl_end == OFFSET_MAX)
-			seq_printf(f, "%Ld EOF\n", fl->fl_start);
+			seq_printf(f, "%lld EOF\n", fl->fl_start);
 		else
-			seq_printf(f, "%Ld %Ld\n", fl->fl_start, fl->fl_end);
+			seq_printf(f, "%lld %lld\n", fl->fl_start, fl->fl_end);
 	} else {
 		seq_printf(f, "0 EOF\n");
 	}
@@ -2312,7 +2303,8 @@ int lock_may_read(struct inode *inode, loff_t start, unsigned long len)
 		if (IS_POSIX(fl)) {
 			if (fl->fl_type == F_RDLCK)
 				continue;
-			if ((fl->fl_end < start) || (fl->fl_start > (start + len)))
+			if ((fl->fl_end < start) ||
+			    (fl->fl_start > (start + len)))
 				continue;
 		} else if (IS_FLOCK(fl)) {
 			if (!(fl->fl_type & LOCK_MAND))
@@ -2327,7 +2319,6 @@ int lock_may_read(struct inode *inode, loff_t start, unsigned long len)
 	unlock_flocks();
 	return result;
 }
-
 EXPORT_SYMBOL(lock_may_read);
 
 /**
@@ -2350,7 +2341,8 @@ int lock_may_write(struct inode *inode, loff_t start, unsigned long len)
 	lock_flocks();
 	for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
 		if (IS_POSIX(fl)) {
-			if ((fl->fl_end < start) || (fl->fl_start > (start + len)))
+			if ((fl->fl_end < start) ||
+			    (fl->fl_start > (start + len)))
 				continue;
 		} else if (IS_FLOCK(fl)) {
 			if (!(fl->fl_type & LOCK_MAND))
@@ -2365,7 +2357,6 @@ int lock_may_write(struct inode *inode, loff_t start, unsigned long len)
 	unlock_flocks();
 	return result;
 }
-
 EXPORT_SYMBOL(lock_may_write);
 
 static int __init filelock_init(void)
-- 
1.7.6.405.gc1be0


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

* [PATCH 22/28] open: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (20 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 21/28] locks: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 23/28] stat: " Joe Perches
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Now checkpatch clean.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/open.c | \
  cut -f3- -d":" | sort | uniq -c
      8  ERROR: "foo * bar" should be "foo *bar"
      5  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
      4  WARNING: line over 80 characters
      1  WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/open.c |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/fs/open.c b/fs/open.c
index 58c8d94..bb3e0e5 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -21,7 +21,7 @@
 #include <linux/mount.h>
 #include <linux/fcntl.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fs.h>
 #include <linux/personality.h>
 #include <linux/pagemap.h>
@@ -134,9 +134,9 @@ SYSCALL_DEFINE2(truncate, const char __user *, path, long, length)
 
 static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
 {
-	struct inode * inode;
+	struct inode *inode;
 	struct dentry *dentry;
-	struct file * file;
+	struct file *file;
 	int error;
 
 	error = -EINVAL;
@@ -170,7 +170,8 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
 	if (!error)
 		error = security_path_truncate(&file->f_path);
 	if (!error)
-		error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
+		error = do_truncate(dentry, length, ATTR_MTIME | ATTR_CTIME,
+				    file);
 out_putf:
 	fput(file);
 out:
@@ -187,7 +188,7 @@ SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length)
 
 /* LFS versions of truncate are only needed on 32 bit machines */
 #if BITS_PER_LONG == 32
-SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length)
+SYSCALL_DEFINE(truncate64)(const char __user *path, loff_t length)
 {
 	return do_sys_truncate(path, length);
 }
@@ -472,7 +473,7 @@ out_unlock:
 
 SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode)
 {
-	struct file * file;
+	struct file *file;
 	int err = -EBADF;
 
 	file = fget(fd);
@@ -575,7 +576,8 @@ out:
 	return error;
 }
 
-SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group)
+SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t,
+		group)
 {
 	struct path path;
 	int error;
@@ -596,9 +598,9 @@ out:
 
 SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
 {
-	struct file * file;
+	struct file *file;
 	int error = -EBADF;
-	struct dentry * dentry;
+	struct dentry *dentry;
 
 	file = fget(fd);
 	if (!file)
@@ -648,7 +650,8 @@ static inline int __get_file_write_access(struct inode *inode,
 
 static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
 					struct file *f,
-					int (*open)(struct inode *, struct file *),
+					int (*open)(struct inode *,
+						    struct file *),
 					const struct cred *cred)
 {
 	static const struct file_operations empty_fops = {};
@@ -761,8 +764,9 @@ cleanup_file:
  * If the open callback is set to NULL, then the standard f_op->open()
  * filesystem callback is substituted.
  */
-struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
-		int (*open)(struct inode *, struct file *))
+struct file *lookup_instantiate_filp(struct nameidata *nd,
+				     struct dentry *dentry,
+				     int (*open)(struct inode *, struct file *))
 {
 	const struct cred *cred = current_cred();
 
@@ -850,7 +854,6 @@ void put_unused_fd(unsigned int fd)
 	__put_unused_fd(files, fd);
 	spin_unlock(&files->file_lock);
 }
-
 EXPORT_SYMBOL(put_unused_fd);
 
 /*
@@ -876,7 +879,6 @@ void fd_install(unsigned int fd, struct file *file)
 	rcu_assign_pointer(fdt->fd[fd], file);
 	spin_unlock(&files->file_lock);
 }
-
 EXPORT_SYMBOL(fd_install);
 
 static inline int build_open_flags(int flags, int mode, struct open_flags *op)
@@ -1059,7 +1061,6 @@ int filp_close(struct file *filp, fl_owner_t id)
 	fput(filp);
 	return retval;
 }
-
 EXPORT_SYMBOL(filp_close);
 
 /*
@@ -1069,7 +1070,7 @@ EXPORT_SYMBOL(filp_close);
  */
 SYSCALL_DEFINE1(close, unsigned int, fd)
 {
-	struct file * filp;
+	struct file *filp;
 	struct files_struct *files = current->files;
 	struct fdtable *fdt;
 	int retval;
@@ -1121,13 +1122,12 @@ SYSCALL_DEFINE0(vhangup)
  * the caller didn't specify O_LARGEFILE.  On 64bit systems we force
  * on this flag in sys_open.
  */
-int generic_file_open(struct inode * inode, struct file * filp)
+int generic_file_open(struct inode *inode, struct file *filp)
 {
 	if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
 		return -EOVERFLOW;
 	return 0;
 }
-
 EXPORT_SYMBOL(generic_file_open);
 
 /*
@@ -1141,5 +1141,4 @@ int nonseekable_open(struct inode *inode, struct file *filp)
 	filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
 	return 0;
 }
-
 EXPORT_SYMBOL(nonseekable_open);
-- 
1.7.6.405.gc1be0


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

* [PATCH 23/28] stat: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (21 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 22/28] open: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 24/28] super: " Joe Perches
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Now checkpatch clean.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/stat.c | \
  cut -f3- -d":" | sort | uniq -c
      3  ERROR: space required after that ',' (ctx:VxO)
      3  ERROR: space required after that ',' (ctx:VxV)
      3  ERROR: space required before that '&' (ctx:OxV)
      3  ERROR: trailing whitespace
      6  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
      2  WARNING: line over 80 characters
      1  WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
      1  WARNING: Use #include <linux/unistd.h> instead of <asm/unistd.h>

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/stat.c |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/fs/stat.c b/fs/stat.c
index ff9be35..829d9e9 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -16,9 +16,8 @@
 #include <linux/security.h>
 #include <linux/syscalls.h>
 #include <linux/pagemap.h>
-
-#include <asm/uaccess.h>
-#include <asm/unistd.h>
+#include <linux/uaccess.h>
+#include <linux/unistd.h>
 
 void generic_fillattr(struct inode *inode, struct kstat *stat)
 {
@@ -36,7 +35,6 @@ void generic_fillattr(struct inode *inode, struct kstat *stat)
 	stat->blksize = (1 << inode->i_blkbits);
 	stat->blocks = inode->i_blocks;
 }
-
 EXPORT_SYMBOL(generic_fillattr);
 
 int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
@@ -54,7 +52,6 @@ int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
 	generic_fillattr(inode, stat);
 	return 0;
 }
-
 EXPORT_SYMBOL(vfs_getattr);
 
 int vfs_fstat(unsigned int fd, struct kstat *stat)
@@ -116,11 +113,12 @@ EXPORT_SYMBOL(vfs_lstat);
  * For backward compatibility?  Maybe this should be moved
  * into arch/i386 instead?
  */
-static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * statbuf)
+static int cp_old_stat(struct kstat *stat,
+		       struct __old_kernel_stat __user *statbuf)
 {
 	static int warncount = 5;
 	struct __old_kernel_stat tmp;
-	
+
 	if (warncount > 0) {
 		warncount--;
 		pr_warn("VFS: Warning: %s using old stat() call. Recompile your binary.\n",
@@ -145,12 +143,12 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta
 #if BITS_PER_LONG == 32
 	if (stat->size > MAX_NON_LFS)
 		return -EOVERFLOW;
-#endif	
+#endif
 	tmp.st_size = stat->size;
 	tmp.st_atime = stat->atime.tv_sec;
 	tmp.st_mtime = stat->mtime.tv_sec;
 	tmp.st_ctime = stat->ctime.tv_sec;
-	return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
+	return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
 
 SYSCALL_DEFINE2(stat, const char __user *, filename,
@@ -179,7 +177,8 @@ SYSCALL_DEFINE2(lstat, const char __user *, filename,
 	return cp_old_stat(&stat, statbuf);
 }
 
-SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, statbuf)
+SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *,
+		statbuf)
 {
 	struct kstat stat;
 	int error = vfs_fstat(fd, &stat);
@@ -227,7 +226,7 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
 #if BITS_PER_LONG == 32
 	if (stat->size > MAX_NON_LFS)
 		return -EOVERFLOW;
-#endif	
+#endif
 	tmp.st_size = stat->size;
 	tmp.st_atime = stat->atime.tv_sec;
 	tmp.st_mtime = stat->mtime.tv_sec;
@@ -239,7 +238,7 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
 #endif
 	tmp.st_blocks = stat->blocks;
 	tmp.st_blksize = stat->blksize;
-	return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
+	return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
 
 SYSCALL_DEFINE2(newstat, const char __user *, filename,
@@ -363,7 +362,7 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
 	tmp.st_size = stat->size;
 	tmp.st_blocks = stat->blocks;
 	tmp.st_blksize = stat->blksize;
-	return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
+	return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
 
 SYSCALL_DEFINE2(stat64, const char __user *, filename,
@@ -432,7 +431,6 @@ void inode_add_bytes(struct inode *inode, loff_t bytes)
 	__inode_add_bytes(inode, bytes);
 	spin_unlock(&inode->i_lock);
 }
-
 EXPORT_SYMBOL(inode_add_bytes);
 
 void inode_sub_bytes(struct inode *inode, loff_t bytes)
@@ -447,7 +445,6 @@ void inode_sub_bytes(struct inode *inode, loff_t bytes)
 	inode->i_bytes -= bytes;
 	spin_unlock(&inode->i_lock);
 }
-
 EXPORT_SYMBOL(inode_sub_bytes);
 
 loff_t inode_get_bytes(struct inode *inode)
@@ -459,7 +456,6 @@ loff_t inode_get_bytes(struct inode *inode)
 	spin_unlock(&inode->i_lock);
 	return ret;
 }
-
 EXPORT_SYMBOL(inode_get_bytes);
 
 void inode_set_bytes(struct inode *inode, loff_t bytes)
@@ -469,5 +465,4 @@ void inode_set_bytes(struct inode *inode, loff_t bytes)
 	inode->i_blocks = bytes >> 9;
 	inode->i_bytes = bytes & 511;
 }
-
 EXPORT_SYMBOL(inode_set_bytes);
-- 
1.7.6.405.gc1be0


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

* [PATCH 24/28] super: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (22 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 23/28] stat: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 25/28] libfs: " Joe Perches
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Now checkpatch clean.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/super.c | \
  cut -f3- -d":" | sort | uniq -c
      1  ERROR: code indent should use tabs where possible
      1  ERROR: do not initialise statics to 0 or NULL
      2  ERROR: "foo * bar" should be "foo *bar"
      2  ERROR: space required after that ',' (ctx:OxV)
      3  ERROR: trailing whitespace
     14  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
      1  WARNING: line over 80 characters
      1  WARNING: please, no space before tabs
      2  WARNING: please, no spaces at the start of a line

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/super.c |   40 ++++++++++++++--------------------------
 1 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 23ff118..b550808 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -172,7 +172,8 @@ static struct super_block *alloc_super(struct file_system_type *type)
 		s->s_count = 1;
 		atomic_set(&s->s_active, 1);
 		mutex_init(&s->s_vfs_rename_mutex);
-		lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
+		lockdep_set_class(&s->s_vfs_rename_mutex,
+				  &type->s_vfs_rename_key);
 		mutex_init(&s->s_dquot.dqio_mutex);
 		mutex_init(&s->s_dquot.dqonoff_mutex);
 		init_rwsem(&s->s_dquot.dqptr_sem);
@@ -267,7 +268,6 @@ void deactivate_locked_super(struct super_block *s)
 		up_write(&s->s_umount);
 	}
 }
-
 EXPORT_SYMBOL(deactivate_locked_super);
 
 /**
@@ -280,12 +280,11 @@ EXPORT_SYMBOL(deactivate_locked_super);
  */
 void deactivate_super(struct super_block *s)
 {
-        if (!atomic_add_unless(&s->s_active, -1, 1)) {
+	if (!atomic_add_unless(&s->s_active, -1, 1)) {
 		down_write(&s->s_umount);
 		deactivate_locked_super(s);
 	}
 }
-
 EXPORT_SYMBOL(deactivate_super);
 
 /**
@@ -293,7 +292,7 @@ EXPORT_SYMBOL(deactivate_super);
  *	@s: reference we are trying to make active
  *
  *	Tries to acquire an active reference.  grab_super() is used when we
- * 	had just found a superblock in super_blocks or fs_type->fs_supers
+ *	had just found a superblock in super_blocks or fs_type->fs_supers
  *	and want to turn it into a full-blown active reference.  grab_super()
  *	is called with sb_lock held and drops it.  Returns 1 in case of
  *	success, 0 if we had failed (superblock contents was already dead or
@@ -351,17 +350,16 @@ bool grab_super_passive(struct super_block *sb)
 /*
  * Superblock locking.  We really ought to get rid of these two.
  */
-void lock_super(struct super_block * sb)
+void lock_super(struct super_block *sb)
 {
 	mutex_lock(&sb->s_lock);
 }
+EXPORT_SYMBOL(lock_super);
 
-void unlock_super(struct super_block * sb)
+void unlock_super(struct super_block *sb)
 {
 	mutex_unlock(&sb->s_lock);
 }
-
-EXPORT_SYMBOL(lock_super);
 EXPORT_SYMBOL(unlock_super);
 
 /**
@@ -405,7 +403,6 @@ void generic_shutdown_super(struct super_block *sb)
 	spin_unlock(&sb_lock);
 	up_write(&sb->s_umount);
 }
-
 EXPORT_SYMBOL(generic_shutdown_super);
 
 /**
@@ -416,9 +413,9 @@ EXPORT_SYMBOL(generic_shutdown_super);
  *	@data:	argument to each of them
  */
 struct super_block *sget(struct file_system_type *type,
-			int (*test)(struct super_block *,void *),
-			int (*set)(struct super_block *,void *),
-			void *data)
+			 int (*test)(struct super_block *, void *),
+			 int (*set)(struct super_block *, void *),
+			 void *data)
 {
 	struct super_block *s = NULL;
 	struct super_block *old;
@@ -452,7 +449,7 @@ retry:
 			return ERR_PTR(-ENOMEM);
 		goto retry;
 	}
-		
+
 	err = set(s, data);
 	if (err) {
 		spin_unlock(&sb_lock);
@@ -469,7 +466,6 @@ retry:
 	register_shrinker(&s->s_shrink);
 	return s;
 }
-
 EXPORT_SYMBOL(sget);
 
 void drop_super(struct super_block *sb)
@@ -477,7 +473,6 @@ void drop_super(struct super_block *sb)
 	up_read(&sb->s_umount);
 	put_super(sb);
 }
-
 EXPORT_SYMBOL(drop_super);
 
 /**
@@ -587,13 +582,12 @@ void iterate_supers_type(struct file_system_type *type,
 		__put_super(p);
 	spin_unlock(&sb_lock);
 }
-
 EXPORT_SYMBOL(iterate_supers_type);
 
 /**
  *	get_super - get the superblock of a device
  *	@bdev: device to get the superblock for
- *	
+ *
  *	Scans the superblock list and finds the superblock of the file system
  *	mounted on the device given. %NULL is returned if no match is found.
  */
@@ -627,7 +621,6 @@ rescan:
 	spin_unlock(&sb_lock);
 	return NULL;
 }
-
 EXPORT_SYMBOL(get_super);
 
 /**
@@ -660,7 +653,7 @@ restart:
 	spin_unlock(&sb_lock);
 	return NULL;
 }
- 
+
 struct super_block *user_get_super(dev_t dev)
 {
 	struct super_block *sb;
@@ -799,7 +792,7 @@ void emergency_remount(void)
 
 static DEFINE_IDA(unnamed_dev_ida);
 static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */
-static int unnamed_dev_start = 0; /* don't bother trying below it */
+static int unnamed_dev_start;	/* don't bother trying below it */
 
 int get_anon_bdev(dev_t *p)
 {
@@ -851,7 +844,6 @@ int set_anon_super(struct super_block *s, void *data)
 		s->s_bdi = &noop_backing_dev_info;
 	return error;
 }
-
 EXPORT_SYMBOL(set_anon_super);
 
 void kill_anon_super(struct super_block *sb)
@@ -860,7 +852,6 @@ void kill_anon_super(struct super_block *sb)
 	generic_shutdown_super(sb);
 	free_anon_bdev(dev);
 }
-
 EXPORT_SYMBOL(kill_anon_super);
 
 void kill_litter_super(struct super_block *sb)
@@ -869,7 +860,6 @@ void kill_litter_super(struct super_block *sb)
 		d_genocide(sb->s_root);
 	kill_anon_super(sb);
 }
-
 EXPORT_SYMBOL(kill_litter_super);
 
 static int ns_test_super(struct super_block *sb, void *data)
@@ -906,7 +896,6 @@ struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
 
 	return dget(sb->s_root);
 }
-
 EXPORT_SYMBOL(mount_ns);
 
 #ifdef CONFIG_BLOCK
@@ -1016,7 +1005,6 @@ void kill_block_super(struct super_block *sb)
 	WARN_ON_ONCE(!(mode & FMODE_EXCL));
 	blkdev_put(bdev, mode | FMODE_EXCL);
 }
-
 EXPORT_SYMBOL(kill_block_super);
 #endif
 
-- 
1.7.6.405.gc1be0


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

* [PATCH 25/28] libfs: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (23 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 24/28] super: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 26/28] bio: " Joe Perches
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

One warning for kstrtoll remains.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/libfs.c | \
  cut -f3- -d":" | sort | uniq -c
      1  ERROR: "foo * bar" should be "foo *bar"
      2  ERROR: spaces required around that '=' (ctx:VxV)
      2  ERROR: switch and case should be at the same indent
      3  ERROR: trailing whitespace
     34  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
     11  WARNING: line over 80 characters
      7  WARNING: please, no space before tabs
      1  WARNING: simple_strtoll is obsolete, use kstrtoll instead
      1  WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/libfs.c |  208 +++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 107 insertions(+), 101 deletions(-)

diff --git a/fs/libfs.c b/fs/libfs.c
index ad1532f..c224d14 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -15,8 +15,7 @@
 #include <linux/exportfs.h>
 #include <linux/writeback.h>
 #include <linux/buffer_head.h>
-
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "internal.h"
 
@@ -33,6 +32,7 @@ int simple_getattr(struct vfsmount *mnt, struct dentry *dentry,
 	stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9);
 	return 0;
 }
+EXPORT_SYMBOL(simple_getattr);
 
 int simple_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
@@ -41,6 +41,7 @@ int simple_statfs(struct dentry *dentry, struct kstatfs *buf)
 	buf->f_namelen = NAME_MAX;
 	return 0;
 }
+EXPORT_SYMBOL(simple_statfs);
 
 /*
  * Retaining negative dentries for an in-memory filesystem just wastes
@@ -55,7 +56,8 @@ static int simple_delete_dentry(const struct dentry *dentry)
  * Lookup the data. This is trivial - if the dentry didn't already
  * exist, we know it is negative.  Set d_op to delete negative dentries.
  */
-struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
+struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry,
+			     struct nameidata *nd)
 {
 	static const struct dentry_operations simple_dentry_operations = {
 		.d_delete = simple_delete_dentry,
@@ -67,6 +69,7 @@ struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, struct na
 	d_add(dentry, NULL);
 	return NULL;
 }
+EXPORT_SYMBOL(simple_lookup);
 
 int dcache_dir_open(struct inode *inode, struct file *file)
 {
@@ -76,26 +79,28 @@ int dcache_dir_open(struct inode *inode, struct file *file)
 
 	return file->private_data ? 0 : -ENOMEM;
 }
+EXPORT_SYMBOL(dcache_dir_open);
 
 int dcache_dir_close(struct inode *inode, struct file *file)
 {
 	dput(file->private_data);
 	return 0;
 }
+EXPORT_SYMBOL(dcache_dir_close);
 
 loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
 {
 	struct dentry *dentry = file->f_path.dentry;
 	mutex_lock(&dentry->d_inode->i_mutex);
 	switch (origin) {
-		case 1:
-			offset += file->f_pos;
-		case 0:
-			if (offset >= 0)
-				break;
-		default:
-			mutex_unlock(&dentry->d_inode->i_mutex);
-			return -EINVAL;
+	case 1:
+		offset += file->f_pos;
+	case 0:
+		if (offset >= 0)
+			break;
+	default:
+		mutex_unlock(&dentry->d_inode->i_mutex);
+		return -EINVAL;
 	}
 	if (offset != file->f_pos) {
 		file->f_pos = offset;
@@ -110,8 +115,10 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
 			p = dentry->d_subdirs.next;
 			while (n && p != &dentry->d_subdirs) {
 				struct dentry *next;
-				next = list_entry(p, struct dentry, d_u.d_child);
-				spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
+				next = list_entry(p, struct dentry,
+						  d_u.d_child);
+				spin_lock_nested(&next->d_lock,
+						 DENTRY_D_LOCK_NESTED);
 				if (simple_positive(next))
 					n--;
 				spin_unlock(&next->d_lock);
@@ -124,6 +131,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
 	mutex_unlock(&dentry->d_inode->i_mutex);
 	return offset;
 }
+EXPORT_SYMBOL(dcache_dir_lseek);
 
 /* Relationship between i_mode and the DT_xxx types */
 static inline unsigned char dt_type(struct inode *inode)
@@ -137,7 +145,7 @@ static inline unsigned char dt_type(struct inode *inode)
  * both impossible due to the lock on directory.
  */
 
-int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
+int dcache_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
 	struct dentry *dentry = filp->f_path.dentry;
 	struct dentry *cursor = filp->private_data;
@@ -146,58 +154,61 @@ int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
 	int i = filp->f_pos;
 
 	switch (i) {
-		case 0:
-			ino = dentry->d_inode->i_ino;
-			if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0)
-				break;
-			filp->f_pos++;
-			i++;
-			/* fallthrough */
-		case 1:
-			ino = parent_ino(dentry);
-			if (filldir(dirent, "..", 2, i, ino, DT_DIR) < 0)
-				break;
-			filp->f_pos++;
-			i++;
-			/* fallthrough */
-		default:
-			spin_lock(&dentry->d_lock);
-			if (filp->f_pos == 2)
-				list_move(q, &dentry->d_subdirs);
-
-			for (p=q->next; p != &dentry->d_subdirs; p=p->next) {
-				struct dentry *next;
-				next = list_entry(p, struct dentry, d_u.d_child);
-				spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
-				if (!simple_positive(next)) {
-					spin_unlock(&next->d_lock);
-					continue;
-				}
-
-				spin_unlock(&next->d_lock);
-				spin_unlock(&dentry->d_lock);
-				if (filldir(dirent, next->d_name.name, 
-					    next->d_name.len, filp->f_pos, 
-					    next->d_inode->i_ino, 
-					    dt_type(next->d_inode)) < 0)
-					return 0;
-				spin_lock(&dentry->d_lock);
-				spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
-				/* next is still alive */
-				list_move(q, p);
+	case 0:
+		ino = dentry->d_inode->i_ino;
+		if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0)
+			break;
+		filp->f_pos++;
+		i++;
+		/* fallthrough */
+	case 1:
+		ino = parent_ino(dentry);
+		if (filldir(dirent, "..", 2, i, ino, DT_DIR) < 0)
+			break;
+		filp->f_pos++;
+		i++;
+		/* fallthrough */
+	default:
+		spin_lock(&dentry->d_lock);
+		if (filp->f_pos == 2)
+			list_move(q, &dentry->d_subdirs);
+
+		for (p = q->next; p != &dentry->d_subdirs; p = p->next) {
+			struct dentry *next;
+			next = list_entry(p, struct dentry, d_u.d_child);
+			spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
+			if (!simple_positive(next)) {
 				spin_unlock(&next->d_lock);
-				p = q;
-				filp->f_pos++;
+				continue;
 			}
+
+			spin_unlock(&next->d_lock);
 			spin_unlock(&dentry->d_lock);
+			if (filldir(dirent, next->d_name.name,
+				    next->d_name.len, filp->f_pos,
+				    next->d_inode->i_ino,
+				    dt_type(next->d_inode)) < 0)
+				return 0;
+			spin_lock(&dentry->d_lock);
+			spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
+			/* next is still alive */
+			list_move(q, p);
+			spin_unlock(&next->d_lock);
+			p = q;
+			filp->f_pos++;
+		}
+		spin_unlock(&dentry->d_lock);
 	}
 	return 0;
 }
+EXPORT_SYMBOL(dcache_readdir);
 
-ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos)
+ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz,
+			 loff_t *ppos)
 {
 	return -EISDIR;
 }
+EXPORT_SYMBOL(generic_read_dir);
 
 const struct file_operations simple_dir_operations = {
 	.open		= dcache_dir_open,
@@ -207,10 +218,12 @@ const struct file_operations simple_dir_operations = {
 	.readdir	= dcache_readdir,
 	.fsync		= noop_fsync,
 };
+EXPORT_SYMBOL(simple_dir_operations);
 
 const struct inode_operations simple_dir_inode_operations = {
 	.lookup		= simple_lookup,
 };
+EXPORT_SYMBOL(simple_dir_inode_operations);
 
 static const struct super_operations simple_super_operations = {
 	.statfs		= simple_statfs,
@@ -265,8 +278,10 @@ Enomem:
 	deactivate_locked_super(s);
 	return ERR_PTR(-ENOMEM);
 }
+EXPORT_SYMBOL(mount_pseudo);
 
-int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
+int simple_link(struct dentry *old_dentry, struct inode *dir,
+		struct dentry *dentry)
 {
 	struct inode *inode = old_dentry->d_inode;
 
@@ -277,6 +292,7 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den
 	d_instantiate(dentry, inode);
 	return 0;
 }
+EXPORT_SYMBOL(simple_link);
 
 int simple_empty(struct dentry *dentry)
 {
@@ -297,6 +313,7 @@ out:
 	spin_unlock(&dentry->d_lock);
 	return ret;
 }
+EXPORT_SYMBOL(simple_empty);
 
 int simple_unlink(struct inode *dir, struct dentry *dentry)
 {
@@ -307,6 +324,7 @@ int simple_unlink(struct inode *dir, struct dentry *dentry)
 	dput(dentry);
 	return 0;
 }
+EXPORT_SYMBOL(simple_unlink);
 
 int simple_rmdir(struct inode *dir, struct dentry *dentry)
 {
@@ -318,6 +336,7 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)
 	drop_nlink(dir);
 	return 0;
 }
+EXPORT_SYMBOL(simple_rmdir);
 
 int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
 		struct inode *new_dir, struct dentry *new_dentry)
@@ -344,6 +363,7 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
 
 	return 0;
 }
+EXPORT_SYMBOL(simple_rename);
 
 /**
  * simple_setattr - setattr for simple filesystem
@@ -386,6 +406,7 @@ int simple_readpage(struct file *file, struct page *page)
 	unlock_page(page);
 	return 0;
 }
+EXPORT_SYMBOL(simple_readpage);
 
 int simple_write_begin(struct file *file, struct address_space *mapping,
 			loff_t pos, unsigned len, unsigned flags,
@@ -409,17 +430,18 @@ int simple_write_begin(struct file *file, struct address_space *mapping,
 	}
 	return 0;
 }
+EXPORT_SYMBOL(simple_write_begin);
 
 /**
  * simple_write_end - .write_end helper for non-block-device FSes
  * @available: See .write_end of address_space_operations
- * @file: 		"
- * @mapping: 		"
- * @pos: 		"
- * @len: 		"
- * @copied: 		"
- * @page: 		"
- * @fsdata: 		"
+ * @file:		"
+ * @mapping:		"
+ * @pos:		"
+ * @len:		"
+ * @copied:		"
+ * @page:		"
+ * @fsdata:		"
  *
  * simple_write_end does the minimum needed for updating a page after writing is
  * done. It has the same API signature as the .write_end of
@@ -460,6 +482,7 @@ int simple_write_end(struct file *file, struct address_space *mapping,
 
 	return copied;
 }
+EXPORT_SYMBOL(simple_write_end);
 
 /*
  * the inodes created here are not hashed. If you use iunique to generate
@@ -528,10 +551,12 @@ out:
 	dput(root);
 	return -ENOMEM;
 }
+EXPORT_SYMBOL(simple_fill_super);
 
 static DEFINE_SPINLOCK(pin_fs_lock);
 
-int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
+int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount,
+		  int *count)
 {
 	struct vfsmount *mnt = NULL;
 	spin_lock(&pin_fs_lock);
@@ -550,6 +575,7 @@ int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *c
 	mntput(mnt);
 	return 0;
 }
+EXPORT_SYMBOL(simple_pin_fs);
 
 void simple_release_fs(struct vfsmount **mount, int *count)
 {
@@ -561,6 +587,7 @@ void simple_release_fs(struct vfsmount **mount, int *count)
 	spin_unlock(&pin_fs_lock);
 	mntput(mnt);
 }
+EXPORT_SYMBOL(simple_release_fs);
 
 /**
  * simple_read_from_buffer - copy data from the buffer to user space
@@ -595,6 +622,7 @@ ssize_t simple_read_from_buffer(void __user *to, size_t count, loff_t *ppos,
 	*ppos = pos + count;
 	return count;
 }
+EXPORT_SYMBOL(simple_read_from_buffer);
 
 /**
  * simple_write_to_buffer - copy data from user space to the buffer
@@ -629,6 +657,7 @@ ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
 	*ppos = pos + count;
 	return count;
 }
+EXPORT_SYMBOL(simple_write_to_buffer);
 
 /**
  * memory_read_from_buffer - copy data from the buffer
@@ -660,6 +689,7 @@ ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
 
 	return count;
 }
+EXPORT_SYMBOL(memory_read_from_buffer);
 
 /*
  * Transaction based IO.
@@ -681,8 +711,10 @@ void simple_transaction_set(struct file *file, size_t n)
 	smp_mb();
 	ar->size = n;
 }
+EXPORT_SYMBOL(simple_transaction_set);
 
-char *simple_transaction_get(struct file *file, const char __user *buf, size_t size)
+char *simple_transaction_get(struct file *file, const char __user *buf,
+			     size_t size)
 {
 	struct simple_transaction_argresp *ar;
 	static DEFINE_SPINLOCK(simple_transaction_lock);
@@ -712,8 +744,10 @@ char *simple_transaction_get(struct file *file, const char __user *buf, size_t s
 
 	return ar->data;
 }
+EXPORT_SYMBOL(simple_transaction_get);
 
-ssize_t simple_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos)
+ssize_t simple_transaction_read(struct file *file, char __user *buf,
+				size_t size, loff_t *pos)
 {
 	struct simple_transaction_argresp *ar = file->private_data;
 
@@ -721,12 +755,14 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf, size_t size
 		return 0;
 	return simple_read_from_buffer(buf, size, pos, ar->data, ar->size);
 }
+EXPORT_SYMBOL(simple_transaction_read);
 
 int simple_transaction_release(struct inode *inode, struct file *file)
 {
 	free_page((unsigned long)file->private_data);
 	return 0;
 }
+EXPORT_SYMBOL(simple_transaction_release);
 
 /* Simple attribute files */
 
@@ -762,12 +798,14 @@ int simple_attr_open(struct inode *inode, struct file *file,
 
 	return nonseekable_open(inode, file);
 }
+EXPORT_SYMBOL_GPL(simple_attr_open);
 
 int simple_attr_release(struct inode *inode, struct file *file)
 {
 	kfree(file->private_data);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(simple_attr_release);
 
 /* read from the buffer that is filled with the get function */
 ssize_t simple_attr_read(struct file *file, char __user *buf,
@@ -803,6 +841,7 @@ out:
 	mutex_unlock(&attr->mutex);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(simple_attr_read);
 
 /* interpret the buffer as a number to call the set function with */
 ssize_t simple_attr_write(struct file *file, const char __user *buf,
@@ -835,6 +874,7 @@ out:
 	mutex_unlock(&attr->mutex);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(simple_attr_write);
 
 /**
  * generic_fh_to_dentry - generic helper for the fh_to_dentry export operation
@@ -973,38 +1013,4 @@ int noop_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
 	return 0;
 }
-
-EXPORT_SYMBOL(dcache_dir_close);
-EXPORT_SYMBOL(dcache_dir_lseek);
-EXPORT_SYMBOL(dcache_dir_open);
-EXPORT_SYMBOL(dcache_readdir);
-EXPORT_SYMBOL(generic_read_dir);
-EXPORT_SYMBOL(mount_pseudo);
-EXPORT_SYMBOL(simple_write_begin);
-EXPORT_SYMBOL(simple_write_end);
-EXPORT_SYMBOL(simple_dir_inode_operations);
-EXPORT_SYMBOL(simple_dir_operations);
-EXPORT_SYMBOL(simple_empty);
-EXPORT_SYMBOL(simple_fill_super);
-EXPORT_SYMBOL(simple_getattr);
-EXPORT_SYMBOL(simple_link);
-EXPORT_SYMBOL(simple_lookup);
-EXPORT_SYMBOL(simple_pin_fs);
-EXPORT_SYMBOL(simple_readpage);
-EXPORT_SYMBOL(simple_release_fs);
-EXPORT_SYMBOL(simple_rename);
-EXPORT_SYMBOL(simple_rmdir);
-EXPORT_SYMBOL(simple_statfs);
 EXPORT_SYMBOL(noop_fsync);
-EXPORT_SYMBOL(simple_unlink);
-EXPORT_SYMBOL(simple_read_from_buffer);
-EXPORT_SYMBOL(simple_write_to_buffer);
-EXPORT_SYMBOL(memory_read_from_buffer);
-EXPORT_SYMBOL(simple_transaction_set);
-EXPORT_SYMBOL(simple_transaction_get);
-EXPORT_SYMBOL(simple_transaction_read);
-EXPORT_SYMBOL(simple_transaction_release);
-EXPORT_SYMBOL_GPL(simple_attr_open);
-EXPORT_SYMBOL_GPL(simple_attr_release);
-EXPORT_SYMBOL_GPL(simple_attr_read);
-EXPORT_SYMBOL_GPL(simple_attr_write);
-- 
1.7.6.405.gc1be0


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

* [PATCH 26/28] bio: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (24 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 25/28] libfs: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 27/28] mbcache: " Joe Perches
  2011-11-30  2:14 ` [PATCH 28/28] buffer: " Joe Perches
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

One long line was ignored.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/bio.c | \
  cut -f3- -d":" | sort | uniq -c
      1  ERROR: code indent should use tabs where possible
      1  ERROR: space required before the open parenthesis '('
      1  ERROR: trailing whitespace
      4  WARNING: line over 80 characters
      5  WARNING: please, no space before tabs
      1  WARNING: please, no spaces at the start of a line

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/bio.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/fs/bio.c b/fs/bio.c
index 98acfb1..6c62472 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -437,13 +437,13 @@ inline int bio_phys_segments(struct request_queue *q, struct bio *bio)
 EXPORT_SYMBOL(bio_phys_segments);
 
 /**
- * 	__bio_clone	-	clone a bio
- * 	@bio: destination bio
- * 	@bio_src: bio to clone
+ *	__bio_clone	-	clone a bio
+ *	@bio: destination bio
+ *	@bio_src: bio to clone
  *
  *	Clone a &bio. Caller will own the returned bio, but not
  *	the actual data it points to. Reference count of returned
- * 	bio will be one.
+ *	bio will be one.
  */
 void __bio_clone(struct bio *bio, struct bio *bio_src)
 {
@@ -469,11 +469,12 @@ EXPORT_SYMBOL(__bio_clone);
  *	@bio: bio to clone
  *	@gfp_mask: allocation priority
  *
- * 	Like __bio_clone, only also allocates the returned bio
+ *	Like __bio_clone, only also allocates the returned bio
  */
 struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)
 {
-	struct bio *b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, fs_bio_set);
+	struct bio *b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs,
+					 fs_bio_set);
 
 	if (!b)
 		return NULL;
@@ -685,7 +686,8 @@ static void bio_set_map_data(struct bio_map_data *bmd, struct bio *bio,
 			     struct sg_iovec *iov, int iov_count,
 			     int is_our_pages)
 {
-	memcpy(bmd->iovecs, bio->bi_io_vec, sizeof(struct bio_vec) * bio->bi_vcnt);
+	memcpy(bmd->iovecs, bio->bi_io_vec,
+	       sizeof(struct bio_vec) * bio->bi_vcnt);
 	memcpy(bmd->sgvecs, iov, sizeof(struct sg_iovec) * iov_count);
 	bmd->nr_sgvecs = iov_count;
 	bmd->is_our_pages = is_our_pages;
@@ -909,7 +911,8 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
 	 */
 	if ((!write_to_vm && (!map_data || !map_data->null_mapped)) ||
 	    (map_data && map_data->from_user)) {
-		ret = __bio_copy_iov(bio, bio->bi_io_vec, iov, iov_count, 0, 1, 0);
+		ret = __bio_copy_iov(bio, bio->bi_io_vec, iov,
+				     iov_count, 0, 1, 0);
 		if (ret)
 			goto cleanup;
 	}
@@ -1018,7 +1021,7 @@ static struct bio *__bio_map_user_iov(struct request_queue *q,
 
 			if (len <= 0)
 				break;
-			
+
 			if (bytes > len)
 				bytes = len;
 
@@ -1055,7 +1058,7 @@ static struct bio *__bio_map_user_iov(struct request_queue *q,
 
  out_unmap:
 	for (i = 0; i < nr_pages; i++) {
-		if(!pages[i])
+		if (!pages[i])
 			break;
 		page_cache_release(pages[i]);
 	}
@@ -1663,7 +1666,8 @@ static void __init biovec_init_slabs(void)
 
 		size = bvs->nr_vecs * sizeof(struct bio_vec);
 		bvs->slab = kmem_cache_create(bvs->name, size, 0,
-                                SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
+					      SLAB_HWCACHE_ALIGN | SLAB_PANIC,
+					      NULL);
 	}
 }
 
-- 
1.7.6.405.gc1be0


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

* [PATCH 27/28] mbcache: checkpatch wanking.
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (25 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 26/28] bio: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  2011-11-30  2:14 ` [PATCH 28/28] buffer: " Joe Perches
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Now checkpatch clean.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/mbcache.c | cut -f3- -d":" | sort | uniq -c
      1  ERROR: code indent should use tabs where possible
      2  ERROR: spaces required around that '<' (ctx:VxV)
      2  ERROR: spaces required around that '=' (ctx:VxV)
      2  ERROR: trailing whitespace
      9  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
      1  WARNING: please, no space before tabs

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/mbcache.c |   42 ++++++++++++++++--------------------------
 1 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/fs/mbcache.c b/fs/mbcache.c
index a3c533c..a685b62 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -59,24 +59,11 @@ do {							\
 #define MB_CACHE_WRITER ((unsigned short)~0U >> 1)
 
 static DECLARE_WAIT_QUEUE_HEAD(mb_cache_queue);
-		
+
 MODULE_AUTHOR("Andreas Gruenbacher <a.gruenbacher@computer.org>");
 MODULE_DESCRIPTION("Meta block cache (for extended attributes)");
 MODULE_LICENSE("GPL");
 
-EXPORT_SYMBOL(mb_cache_create);
-EXPORT_SYMBOL(mb_cache_shrink);
-EXPORT_SYMBOL(mb_cache_destroy);
-EXPORT_SYMBOL(mb_cache_entry_alloc);
-EXPORT_SYMBOL(mb_cache_entry_insert);
-EXPORT_SYMBOL(mb_cache_entry_release);
-EXPORT_SYMBOL(mb_cache_entry_free);
-EXPORT_SYMBOL(mb_cache_entry_get);
-#if !defined(MB_CACHE_INDEXES_COUNT) || (MB_CACHE_INDEXES_COUNT > 0)
-EXPORT_SYMBOL(mb_cache_entry_find_first);
-EXPORT_SYMBOL(mb_cache_entry_find_next);
-#endif
-
 /*
  * Global data: list of all mbcache's, lru list, and a spinlock for
  * accessing cache data structures on SMP machines. The lru list is
@@ -218,16 +205,16 @@ mb_cache_create(const char *name, int bucket_bits)
 	atomic_set(&cache->c_entry_count, 0);
 	cache->c_bucket_bits = bucket_bits;
 	cache->c_block_hash = kmalloc(bucket_count * sizeof(struct list_head),
-	                              GFP_KERNEL);
+				      GFP_KERNEL);
 	if (!cache->c_block_hash)
 		goto fail;
-	for (n=0; n<bucket_count; n++)
+	for (n = 0; n < bucket_count; n++)
 		INIT_LIST_HEAD(&cache->c_block_hash[n]);
 	cache->c_index_hash = kmalloc(bucket_count * sizeof(struct list_head),
 				      GFP_KERNEL);
 	if (!cache->c_index_hash)
 		goto fail;
-	for (n=0; n<bucket_count; n++)
+	for (n = 0; n < bucket_count; n++)
 		INIT_LIST_HEAD(&cache->c_index_hash[n]);
 	cache->c_entry_cache = kmem_cache_create(name,
 		sizeof(struct mb_cache_entry), 0,
@@ -254,7 +241,7 @@ fail:
 	kfree(cache);
 	return NULL;
 }
-
+EXPORT_SYMBOL(mb_cache_create);
 
 /*
  * mb_cache_shrink()
@@ -286,7 +273,7 @@ mb_cache_shrink(struct block_device *bdev)
 						   e_lru_list), GFP_KERNEL);
 	}
 }
-
+EXPORT_SYMBOL(mb_cache_shrink);
 
 /*
  * mb_cache_destroy()
@@ -329,6 +316,7 @@ mb_cache_destroy(struct mb_cache *cache)
 	kfree(cache->c_block_hash);
 	kfree(cache);
 }
+EXPORT_SYMBOL(mb_cache_destroy);
 
 /*
  * mb_cache_entry_alloc()
@@ -366,7 +354,7 @@ mb_cache_entry_alloc(struct mb_cache *cache, gfp_t gfp_flags)
 	ce->e_used = 1 + MB_CACHE_WRITER;
 	return ce;
 }
-
+EXPORT_SYMBOL(mb_cache_entry_alloc);
 
 /*
  * mb_cache_entry_insert()
@@ -391,7 +379,7 @@ mb_cache_entry_insert(struct mb_cache_entry *ce, struct block_device *bdev,
 	struct list_head *l;
 	int error = -EBUSY;
 
-	bucket = hash_long((unsigned long)bdev + (block & 0xffffffff), 
+	bucket = hash_long((unsigned long)bdev + (block & 0xffffffff),
 			   cache->c_bucket_bits);
 	spin_lock(&mb_cache_spinlock);
 	list_for_each_prev(l, &cache->c_block_hash[bucket]) {
@@ -412,7 +400,7 @@ out:
 	spin_unlock(&mb_cache_spinlock);
 	return error;
 }
-
+EXPORT_SYMBOL(mb_cache_entry_insert);
 
 /*
  * mb_cache_entry_release()
@@ -427,7 +415,7 @@ mb_cache_entry_release(struct mb_cache_entry *ce)
 	spin_lock(&mb_cache_spinlock);
 	__mb_cache_entry_release_unlock(ce);
 }
-
+EXPORT_SYMBOL(mb_cache_entry_release);
 
 /*
  * mb_cache_entry_free()
@@ -443,7 +431,7 @@ mb_cache_entry_free(struct mb_cache_entry *ce)
 	__mb_cache_entry_unhash(ce);
 	__mb_cache_entry_release_unlock(ce);
 }
-
+EXPORT_SYMBOL(mb_cache_entry_free);
 
 /*
  * mb_cache_entry_get()
@@ -497,6 +485,7 @@ cleanup:
 	spin_unlock(&mb_cache_spinlock);
 	return ce;
 }
+EXPORT_SYMBOL(mb_cache_entry_get);
 
 #if !defined(MB_CACHE_INDEXES_COUNT) || (MB_CACHE_INDEXES_COUNT > 0)
 
@@ -566,7 +555,7 @@ mb_cache_entry_find_first(struct mb_cache *cache, struct block_device *bdev,
 	spin_unlock(&mb_cache_spinlock);
 	return ce;
 }
-
+EXPORT_SYMBOL(mb_cache_entry_find_first);
 
 /*
  * mb_cache_entry_find_next()
@@ -578,7 +567,7 @@ mb_cache_entry_find_first(struct mb_cache *cache, struct block_device *bdev,
  *
  * entry = mb_cache_entry_find_first();
  * while (entry) {
- * 	...
+ *	...
  *	entry = mb_cache_entry_find_next(entry, ...);
  * }
  *
@@ -601,6 +590,7 @@ mb_cache_entry_find_next(struct mb_cache_entry *prev,
 	__mb_cache_entry_release_unlock(prev);
 	return ce;
 }
+EXPORT_SYMBOL(mb_cache_entry_find_next);
 
 #endif  /* !defined(MB_CACHE_INDEXES_COUNT) || (MB_CACHE_INDEXES_COUNT > 0) */
 
-- 
1.7.6.405.gc1be0


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

* [PATCH 28/28] buffer: checkpatch wanking
  2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
                   ` (26 preceding siblings ...)
  2011-11-30  2:14 ` [PATCH 27/28] mbcache: " Joe Perches
@ 2011-11-30  2:14 ` Joe Perches
  27 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  2:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel

Just a few ignorable warnings remain.

$ ./scripts/checkpatch.pl -f --terse --nosummary fs/buffer.c | \
  cut -f3- -d":" | sort | uniq -c
      5  ERROR: "foo * bar" should be "foo *bar"
      1  ERROR: space required after that close brace '}'
      1  ERROR: space required after that ',' (ctx:VxO)
      3  ERROR: space required after that ',' (ctx:VxV)
      1  ERROR: space required before that '&' (ctx:OxV)
      3  ERROR: space required before the open parenthesis '('
      1  ERROR: spaces required around that '=' (ctx:OxV)
      3  ERROR: spaces required around that '=' (ctx:VxV)
     13  ERROR: trailing whitespace
      2  WARNING: braces {} are not necessary for any arm of this statement
      2  WARNING: braces {} are not necessary for single statement blocks
      4  WARNING: line over 80 characters
      1  WARNING: Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit
      1  WARNING: space prohibited between function name and open parenthesis '('

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/buffer.c |   85 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 576a1ba..16a259c 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -83,9 +83,10 @@ EXPORT_SYMBOL(unlock_buffer);
  * from becoming locked again - you have to lock it yourself
  * if you want to preserve its state.
  */
-void __wait_on_buffer(struct buffer_head * bh)
+void __wait_on_buffer(struct buffer_head *bh)
 {
-	wait_on_bit(&bh->b_state, BH_Lock, sleep_on_buffer, TASK_UNINTERRUPTIBLE);
+	wait_on_bit(&bh->b_state, BH_Lock, sleep_on_buffer,
+		    TASK_UNINTERRUPTIBLE);
 }
 EXPORT_SYMBOL(__wait_on_buffer);
 
@@ -238,7 +239,7 @@ out:
    Thus invalidate_buffers in general usage is not allwowed to trash
    dirty buffers. For example ioctl(FLSBLKBUF) expects dirty data to
    be preserved.  These buffers are simply skipped.
-  
+
    We also skip buffers which are still in use.  For example this can
    happen if a userspace program is reading the block device.
 
@@ -474,7 +475,7 @@ EXPORT_SYMBOL(mark_buffer_async_write);
  * try_to_free_buffers() will be operating against the *blockdev* mapping
  * at the time, not against the S_ISREG file which depends on those buffers.
  * So the locking for private_list is via the private_lock in the address_space
- * which backs the buffers.  Which is different from the address_space 
+ * which backs the buffers.  Which is different from the address_space
  * against which the buffers are listed.  So for a particular address_space,
  * mapping->private_lock does *not* protect mapping->private_list!  In fact,
  * mapping->private_list will always be protected by the backing blockdev's
@@ -635,11 +636,11 @@ void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode)
 	struct address_space *buffer_mapping = bh->b_page->mapping;
 
 	mark_buffer_dirty(bh);
-	if (!mapping->assoc_mapping) {
+	if (!mapping->assoc_mapping)
 		mapping->assoc_mapping = buffer_mapping;
-	} else {
+	else
 		BUG_ON(mapping->assoc_mapping != buffer_mapping);
-	}
+
 	if (!bh->b_assoc_map) {
 		spin_lock(&buffer_mapping->private_lock);
 		list_move_tail(&bh->b_assoc_buffers,
@@ -734,7 +735,7 @@ EXPORT_SYMBOL(__set_page_dirty_buffers);
  * Do this in two main stages: first we copy dirty buffers to a
  * temporary inode list, queueing the writes as we go.  Then we clean
  * up, waiting for those writes to complete.
- * 
+ *
  * During this second stage, any subsequent updates to the file may end
  * up refiling the buffer on the original inode's dirty list again, so
  * there is a chance we will end up with a buffer queued for write but
@@ -812,7 +813,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
 		brelse(bh);
 		spin_lock(lock);
 	}
-	
+
 	spin_unlock(lock);
 	err2 = osync_buffers_list(lock, list);
 	if (err)
@@ -927,7 +928,7 @@ no_grow:
 	/*
 	 * Return failure for non-async IO requests.  Async IO requests
 	 * are not allowed to fail, so we have to wait until buffer heads
-	 * become available.  But we don't want tasks sleeping with 
+	 * become available.  But we don't want tasks sleeping with
 	 * partially complete buffers, so all were released above.
 	 */
 	if (!retry)
@@ -936,7 +937,7 @@ no_grow:
 	/* We're _really_ low on memory. Now we just
 	 * wait for old buffer heads to become free due to
 	 * finishing IO.  Since this is an async request and
-	 * the reserve list is empty, we're sure there are 
+	 * the reserve list is empty, we're sure there are
 	 * async buffer heads in use.
 	 */
 	free_more_memory();
@@ -960,7 +961,7 @@ link_dev_buffers(struct page *page, struct buffer_head *head)
 
 /*
  * Initialise the state of a blockdev page's buffers.
- */ 
+ */
 static void
 init_page_buffers(struct page *page, struct block_device *bdev,
 			sector_t block, int size)
@@ -1093,7 +1094,7 @@ __getblk_slow(struct block_device *bdev, sector_t block, int size)
 	}
 
 	for (;;) {
-		struct buffer_head * bh;
+		struct buffer_head *bh;
 		int ret;
 
 		bh = __find_get_block(bdev, block, size);
@@ -1177,7 +1178,7 @@ EXPORT_SYMBOL(mark_buffer_dirty);
  * in preparation for freeing it (sometimes, rarely, buffers are removed from
  * a page but it ends up not being freed, and buffers may later be reattached).
  */
-void __brelse(struct buffer_head * buf)
+void __brelse(struct buffer_head *buf)
 {
 	if (atomic_read(&buf->b_count)) {
 		put_bh(buf);
@@ -1398,7 +1399,7 @@ EXPORT_SYMBOL(__breadahead);
  *  @bdev: the block_device to read from
  *  @block: number of block
  *  @size: size (in bytes) to read
- * 
+ *
  *  Reads a specified block, and returns buffer head that contains it.
  *  It returns NULL if the block was unreadable.
  */
@@ -1429,7 +1430,7 @@ static void invalidate_bh_lru(void *arg)
 	}
 	put_cpu_var(bh_lrus);
 }
-	
+
 void invalidate_bh_lrus(void)
 {
 	on_each_cpu(invalidate_bh_lru, NULL, 1);
@@ -1454,7 +1455,7 @@ EXPORT_SYMBOL(set_bh_page);
 /*
  * Called when truncating a buffer on a page completely.
  */
-static void discard_buffer(struct buffer_head * bh)
+static void discard_buffer(struct buffer_head *bh)
 {
 	lock_buffer(bh);
 	clear_buffer_dirty(bh);
@@ -1700,11 +1701,10 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
 			redirty_page_for_writepage(wbc, page);
 			continue;
 		}
-		if (test_clear_buffer_dirty(bh)) {
+		if (test_clear_buffer_dirty(bh))
 			mark_buffer_async_write_endio(bh, handler);
-		} else {
+		else
 			unlock_buffer(bh);
-		}
 	} while ((bh = bh->b_this_page) != head);
 
 	/*
@@ -1832,7 +1832,7 @@ int __block_write_begin(struct page *page, loff_t pos, unsigned len,
 	sector_t block;
 	int err = 0;
 	unsigned blocksize, bbits;
-	struct buffer_head *bh, *head, *wait[2], **wait_bh=wait;
+	struct buffer_head *bh, *head, *wait[2], **wait_bh = wait;
 
 	BUG_ON(!PageLocked(page));
 	BUG_ON(from > PAGE_CACHE_SIZE);
@@ -1847,8 +1847,8 @@ int __block_write_begin(struct page *page, loff_t pos, unsigned len,
 	bbits = inode->i_blkbits;
 	block = (sector_t)page->index << (PAGE_CACHE_SHIFT - bbits);
 
-	for(bh = head, block_start = 0; bh != head || !block_start;
-	    block++, block_start=block_end, bh = bh->b_this_page) {
+	for (bh = head, block_start = 0; bh != head || !block_start;
+	     block++, block_start = block_end, bh = bh->b_this_page) {
 		block_end = block_start + blocksize;
 		if (block_end <= from || block_start >= to) {
 			if (PageUptodate(page)) {
@@ -1883,19 +1883,19 @@ int __block_write_begin(struct page *page, loff_t pos, unsigned len,
 		if (PageUptodate(page)) {
 			if (!buffer_uptodate(bh))
 				set_buffer_uptodate(bh);
-			continue; 
+			continue;
 		}
 		if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
 		    !buffer_unwritten(bh) &&
 		     (block_start < from || block_end > to)) {
 			ll_rw_block(READ, 1, &bh);
-			*wait_bh++=bh;
+			*wait_bh++ = bh;
 		}
 	}
 	/*
 	 * If we issued read requests - let them complete.
 	 */
-	while(wait_bh > wait) {
+	while (wait_bh > wait) {
 		wait_on_buffer(*--wait_bh);
 		if (!buffer_uptodate(*wait_bh))
 			err = -EIO;
@@ -1916,9 +1916,9 @@ static int __block_commit_write(struct inode *inode, struct page *page,
 
 	blocksize = 1 << inode->i_blkbits;
 
-	for(bh = head = page_buffers(page), block_start = 0;
-	    bh != head || !block_start;
-	    block_start=block_end, bh = bh->b_this_page) {
+	for (bh = head = page_buffers(page), block_start = 0;
+	     bh != head || !block_start;
+	     block_start = block_end, bh = bh->b_this_page) {
 		block_end = block_start + blocksize;
 		if (block_end <= from || block_start >= to) {
 			if (!buffer_uptodate(bh))
@@ -2186,7 +2186,7 @@ EXPORT_SYMBOL(block_read_full_page);
 
 /* utility function for filesystems that need to do work on expanding
  * truncates.  Uses filesystem pagecache writes to allow the filesystem to
- * deal with the hole.  
+ * deal with the hole.
  */
 int generic_cont_expand_simple(struct inode *inode, loff_t size)
 {
@@ -2256,9 +2256,9 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
 	if (index == curidx) {
 		zerofrom = curpos & ~PAGE_CACHE_MASK;
 		/* if we will expand the thing last block will be filled */
-		if (offset <= zerofrom) {
+		if (offset <= zerofrom)
 			goto out;
-		}
+
 		if (zerofrom & (blocksize-1)) {
 			*bytes |= (blocksize-1);
 			(*bytes)++;
@@ -2313,7 +2313,7 @@ EXPORT_SYMBOL(cont_write_begin);
 int block_commit_write(struct page *page, unsigned from, unsigned to)
 {
 	struct inode *inode = page->mapping->host;
-	__block_commit_write(inode,page,from,to);
+	__block_commit_write(inode, page, from, to);
 	return 0;
 }
 EXPORT_SYMBOL(block_commit_write);
@@ -2503,8 +2503,8 @@ int nobh_write_begin(struct address_space *mapping,
 	 * page is fully mapped-to-disk.
 	 */
 	for (block_start = 0, block_in_page = 0, bh = head;
-		  block_start < PAGE_CACHE_SIZE;
-		  block_in_page++, block_start += blocksize, bh = bh->b_this_page) {
+	     block_start < PAGE_CACHE_SIZE;
+	     block_in_page++, block_start += blocksize, bh = bh->b_this_page) {
 		int create;
 
 		block_end = block_start + blocksize;
@@ -2769,7 +2769,7 @@ int block_truncate_page(struct address_space *mapping,
 
 	length = blocksize - length;
 	iblock = (sector_t)index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
-	
+
 	page = grab_cache_page(mapping, index);
 	err = -ENOMEM;
 	if (!page)
@@ -2802,7 +2802,9 @@ int block_truncate_page(struct address_space *mapping,
 	if (PageUptodate(page))
 		set_buffer_uptodate(bh);
 
-	if (!buffer_uptodate(bh) && !buffer_delay(bh) && !buffer_unwritten(bh)) {
+	if (!buffer_uptodate(bh) &&
+	    !buffer_delay(bh) &&
+	    !buffer_unwritten(bh)) {
 		err = -EIO;
 		ll_rw_block(READ, 1, &bh);
 		wait_on_buffer(bh);
@@ -2893,18 +2895,17 @@ static void end_bio_bh_io_sync(struct bio *bio, int err)
 {
 	struct buffer_head *bh = bio->bi_private;
 
-	if (err == -EOPNOTSUPP) {
+	if (err == -EOPNOTSUPP)
 		set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
-	}
 
-	if (unlikely (test_bit(BIO_QUIET,&bio->bi_flags)))
+	if (unlikely(test_bit(BIO_QUIET, &bio->bi_flags)))
 		set_bit(BH_Quiet, &bh->b_state);
 
 	bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags));
 	bio_put(bio);
 }
 
-int submit_bh(int rw, struct buffer_head * bh)
+int submit_bh(int rw, struct buffer_head *bh)
 {
 	struct bio *bio;
 	int ret = 0;
@@ -2971,7 +2972,7 @@ EXPORT_SYMBOL(submit_bh);
  *
  * ll_rw_block sets b_end_io to simple completion handler that marks
  * the buffer up-to-date (if approriate), unlocks the buffer and wakes
- * any waiters. 
+ * any waiters.
  *
  * All of the buffers must be for the same device, and must also be a
  * multiple of the current approved size for the device.
-- 
1.7.6.405.gc1be0


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

* Re: [PATCH 16/28] namespace: checkpatch wanking
  2011-11-30  2:14 ` [PATCH 16/28] namespace: " Joe Perches
@ 2011-11-30  2:22   ` Al Viro
  2011-11-30  3:39     ` Joe Perches
  0 siblings, 1 reply; 33+ messages in thread
From: Al Viro @ 2011-11-30  2:22 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-fsdevel, linux-kernel

On Tue, Nov 29, 2011 at 06:14:14PM -0800, Joe Perches wrote:
> Fix a few style things.
> 
> $ ./scripts/checkpatch.pl -f --terse --nosummary fs/namespace.c | \
>   cut -f3- -d":" | sort | uniq -c
>       1  ERROR: do not initialise statics to 0 or NULL
>       2  ERROR: do not use assignment in if condition
>       1  ERROR: "foo * bar" should be "foo *bar"
>       1  ERROR: need consistent spacing around '|' (ctx:VxW)
>       1  WARNING: braces {} are not necessary for single statement blocks
>       3  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
>       4  WARNING: line over 80 characters
>       9  WARNING: please, no space before tabs
>       1  WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
>       1  WARNING: Use #include <linux/unistd.h> instead of <asm/unistd.h>

NAK.  First of all, wanking it certainly is; moreover, it creates shitloads
of conflicts with patches in vfs.git#vfsmount-guts

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

* Re: [PATCH 16/28] namespace: checkpatch wanking
  2011-11-30  2:22   ` Al Viro
@ 2011-11-30  3:39     ` Joe Perches
  2011-11-30  6:50       ` Al Viro
  0 siblings, 1 reply; 33+ messages in thread
From: Joe Perches @ 2011-11-30  3:39 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, linux-kernel

On Wed, 2011-11-30 at 02:22 +0000, Al Viro wrote:
> On Tue, Nov 29, 2011 at 06:14:14PM -0800, Joe Perches wrote:
> > Fix a few style things.
> > $ ./scripts/checkpatch.pl -f --terse --nosummary fs/namespace.c | \
> >   cut -f3- -d":" | sort | uniq -c
> >       1  ERROR: do not initialise statics to 0 or NULL
> >       2  ERROR: do not use assignment in if condition
> >       1  ERROR: "foo * bar" should be "foo *bar"
> >       1  ERROR: need consistent spacing around '|' (ctx:VxW)
> >       1  WARNING: braces {} are not necessary for single statement blocks
> >       3  WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
> >       4  WARNING: line over 80 characters
> >       9  WARNING: please, no space before tabs
> >       1  WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
> >       1  WARNING: Use #include <linux/unistd.h> instead of <asm/unistd.h>
> NAK.  First of all, wanking it certainly is; moreover, it creates shitloads
> of conflicts with patches in vfs.git#vfsmount-guts

No worries.

I think patches 1 thru 14 are reasonable though
and do apply with a few offsets to vfsmount-guts.



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

* Re: [PATCH 16/28] namespace: checkpatch wanking
  2011-11-30  3:39     ` Joe Perches
@ 2011-11-30  6:50       ` Al Viro
  2011-11-30  8:34         ` Joe Perches
  0 siblings, 1 reply; 33+ messages in thread
From: Al Viro @ 2011-11-30  6:50 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-fsdevel, linux-kernel

On Tue, Nov 29, 2011 at 07:39:11PM -0800, Joe Perches wrote:

> No worries.
> 
> I think patches 1 thru 14 are reasonable though
> and do apply with a few offsets to vfsmount-guts.

OK...  BTW, speaking of this one:

-static int mnt_id_start = 0;
+static int mnt_id_start;
 static int mnt_group_start = 1;

this deserves a separate NAK; explicit init here is actually more clear -
the variable is more or less analogous to mnt_group_start and it's less
distracting to have initializers spelled out in similar way as well.

-	if ((child_mnt = __lookup_mnt(path->mnt, path->dentry, 1)))
+	child_mnt = __lookup_mnt(path->mnt, path->dentry, 1);
+	if (child_mnt)
 		mntget(child_mnt);
 	br_read_unlock(&vfsmount_lock);
 	return child_mnt;

Maybe, maybe not; in the #vfsmount-guts I seriously pondered turning that
into
	child_mnt = ...;
	if (child_mnt) {
		mnt_add_count(child_mnt);
		br_read_unlock(...);
		return &child_mnt->mnt;
	} else {
		br_read_unlock(...);
		return NULL;
	}
Hell knows...  Since __lookup_mnt() returns struct mount now *and* lookup_mnt()
returns struct vfsmount (much shrunk subset of the original; almost nothing
in there is needed for anything outside of core VFS code) we need if or ?:
after unlock as well.  So it might make sense to split the codepaths once...

-	if (flags & MNT_FORCE && sb->s_op->umount_begin) {
+	if (flags & MNT_FORCE && sb->s_op->umount_begin)
 		sb->s_op->umount_begin(sb);
-	}

Probably.  It used to be just a method call, then it had grown lock/unlock
around it, then lock went down into the method instances and the compound
statement stayed.
 
-static int do_add_mount(struct vfsmount *newmnt, struct path *path, int mnt_flags)
+static int
+do_add_mount(struct vfsmount *newmnt, struct path *path, int mnt_flags)

I don't mind BSD style like that, but again, check #vfsmount-guts; this
one takes struct mount * now, so that line happens to be below 80 cols.

-static int select_submounts(struct vfsmount *parent, struct list_head *graveyard)
+static int
+select_submounts(struct vfsmount *parent, struct list_head *graveyard)

Ditto.

-		struct vfsmount *mnt = list_entry(tmp, struct vfsmount, mnt_child);
+		struct vfsmount *mnt = list_entry(tmp, struct vfsmount,
+						  mnt_child);

Ditto (mnt_child moved into struct mount now)
 
-	if (!(page = __get_free_page(GFP_KERNEL)))
+	page = __get_free_page(GFP_KERNEL);
+	if (!page)
 		return -ENOMEM;

Not sure...  In general I'd agree, but in this case...

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

* Re: [PATCH 16/28] namespace: checkpatch wanking
  2011-11-30  6:50       ` Al Viro
@ 2011-11-30  8:34         ` Joe Perches
  0 siblings, 0 replies; 33+ messages in thread
From: Joe Perches @ 2011-11-30  8:34 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, linux-kernel

On Wed, 2011-11-30 at 06:50 +0000, Al Viro wrote:
> -	if (!(page = __get_free_page(GFP_KERNEL)))
> +	page = __get_free_page(GFP_KERNEL);
> +	if (!page)
>  		return -ENOMEM;
> Not sure...  In general I'd agree, but in this case...

Shrug.  I'm not sure there's much of a case other than
line count for keeping this a one-liner.

If you want these sorts of changes to be redone after
vfsmount-guts gets promoted, let me know.


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

end of thread, other threads:[~2011-11-30  8:34 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-30  2:13 [PATCH 00/28] fs: Logging style neatening and checkpatch wanking Joe Perches
2011-11-30  2:13 ` [PATCH 01/28] buffer: Use pr_<level> Joe Perches
2011-11-30  2:14 ` [PATCH 02/28] mbcache: Use current logging styles Joe Perches
2011-11-30  2:14 ` [PATCH 03/28] bio: " Joe Perches
2011-11-30  2:14 ` [PATCH 04/28] libfs: " Joe Perches
2011-11-30  2:14 ` [PATCH 05/28] super: " Joe Perches
2011-11-30  2:14 ` [PATCH 06/28] exec: Use current logging style Joe Perches
2011-11-30  2:14 ` [PATCH 07/28] namespace: Use current logging styles Joe Perches
2011-11-30  2:14 ` [PATCH 08/28] block_dev: Use current logging style Joe Perches
2011-11-30  2:14 ` [PATCH 09/28] dcache: " Joe Perches
2011-11-30  2:14 ` [PATCH 10/28] fcntl: " Joe Perches
2011-11-30  2:14 ` [PATCH 11/28] file: " Joe Perches
2011-11-30  2:14 ` [PATCH 12/28] locks: " Joe Perches
2011-11-30  2:14 ` [PATCH 13/28] open: " Joe Perches
2011-11-30  2:14 ` [PATCH 14/28] stat: " Joe Perches
2011-11-30  2:14 ` [PATCH 15/28] exec: checkpatch wanking Joe Perches
2011-11-30  2:14 ` [PATCH 16/28] namespace: " Joe Perches
2011-11-30  2:22   ` Al Viro
2011-11-30  3:39     ` Joe Perches
2011-11-30  6:50       ` Al Viro
2011-11-30  8:34         ` Joe Perches
2011-11-30  2:14 ` [PATCH 17/28] block_dev: " Joe Perches
2011-11-30  2:14 ` [PATCH 18/28] dcache: " Joe Perches
2011-11-30  2:14 ` [PATCH 19/28] fcntl: " Joe Perches
2011-11-30  2:14 ` [PATCH 20/28] file: " Joe Perches
2011-11-30  2:14 ` [PATCH 21/28] locks: " Joe Perches
2011-11-30  2:14 ` [PATCH 22/28] open: " Joe Perches
2011-11-30  2:14 ` [PATCH 23/28] stat: " Joe Perches
2011-11-30  2:14 ` [PATCH 24/28] super: " Joe Perches
2011-11-30  2:14 ` [PATCH 25/28] libfs: " Joe Perches
2011-11-30  2:14 ` [PATCH 26/28] bio: " Joe Perches
2011-11-30  2:14 ` [PATCH 27/28] mbcache: " Joe Perches
2011-11-30  2:14 ` [PATCH 28/28] buffer: " Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.