public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] fs: gfs2: global conversion to pr_foo()
@ 2014-03-05 14:06 Fabian Frederick
  2014-03-06 15:44 ` Steven Whitehouse
  0 siblings, 1 reply; 14+ messages in thread
From: Fabian Frederick @ 2014-03-05 14:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: swhiteho, akpm

-All printk(KERN_foo converted to pr_foo().
-Messages updated to fit in 80 columns.
-fs_macros converted as well.
-fs_printk removed.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/gfs2/dir.c        |  7 ++++---
 fs/gfs2/glock.c      | 19 ++++++++++---------
 fs/gfs2/lock_dlm.c   |  6 +++---
 fs/gfs2/log.c        |  4 ++--
 fs/gfs2/ops_fstype.c | 18 +++++++++---------
 fs/gfs2/quota.c      |  2 +-
 fs/gfs2/rgrp.c       | 18 +++++++++---------
 fs/gfs2/super.c      | 21 ++++++++++++++-------
 fs/gfs2/trans.c      |  8 ++++----
 fs/gfs2/util.c       | 12 ++++++------
 fs/gfs2/util.h       | 11 ++++-------
 11 files changed, 66 insertions(+), 60 deletions(-)

diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index fa32655..abcac94 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -507,7 +507,7 @@ static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset,
 		goto error;
 	return 0;
 error:
-	printk(KERN_WARNING "gfs2_check_dirent: %s (%s)\n", msg,
+	pr_warn("gfs2_check_dirent: %s (%s)\n", msg,
 	       first ? "first in block" : "not first in block");
 	return -EIO;
 }
@@ -531,7 +531,7 @@ static int gfs2_dirent_offset(const void *buf)
 	}
 	return offset;
 wrong_type:
-	printk(KERN_WARNING "gfs2_scan_dirent: wrong block type %u\n",
+	pr_warn("gfs2_scan_dirent: wrong block type %u\n",
 	       be32_to_cpu(h->mh_type));
 	return -1;
 }
@@ -1006,7 +1006,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
 	len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth));
 	half_len = len >> 1;
 	if (!half_len) {
-		printk(KERN_WARNING "i_depth %u lf_depth %u index %u\n", dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
+		pr_warn("i_depth %u lf_depth %u index %u\n", dip->i_depth,
+			be16_to_cpu(oleaf->lf_depth), index);
 		gfs2_consist_inode(dip);
 		error = -EIO;
 		goto fail_brelse;
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index ca0be6c..eac3d24 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -468,7 +468,8 @@ retry:
 			do_xmote(gl, gh, LM_ST_UNLOCKED);
 			break;
 		default: /* Everything else */
-			printk(KERN_ERR "GFS2: wanted %u got %u\n", gl->gl_target, state);
+			pr_err("GFS2: wanted %u got %u\n",
+			       gl->gl_target, state);
 			GLOCK_BUG_ON(gl, 1);
 		}
 		spin_unlock(&gl->gl_spin);
@@ -542,7 +543,7 @@ __acquires(&gl->gl_spin)
 		/* lock_dlm */
 		ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
 		if (ret) {
-			printk(KERN_ERR "GFS2: lm_lock ret %d\n", ret);
+			pr_err("GFS2: lm_lock ret %d\n", ret);
 			GLOCK_BUG_ON(gl, 1);
 		}
 	} else { /* lock_nolock */
@@ -935,7 +936,7 @@ void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...)
 		vaf.fmt = fmt;
 		vaf.va = &args;
 
-		printk(KERN_ERR " %pV", &vaf);
+		pr_err(" %pV", &vaf);
 	}
 
 	va_end(args);
@@ -1010,13 +1011,13 @@ do_cancel:
 	return;
 
 trap_recursive:
-	printk(KERN_ERR "original: %pSR\n", (void *)gh2->gh_ip);
-	printk(KERN_ERR "pid: %d\n", pid_nr(gh2->gh_owner_pid));
-	printk(KERN_ERR "lock type: %d req lock state : %d\n",
+	pr_err("original: %pSR\n", (void *)gh2->gh_ip);
+	pr_err("pid: %d\n", pid_nr(gh2->gh_owner_pid));
+	pr_err("lock type: %d req lock state : %d\n",
 	       gh2->gh_gl->gl_name.ln_type, gh2->gh_state);
-	printk(KERN_ERR "new: %pSR\n", (void *)gh->gh_ip);
-	printk(KERN_ERR "pid: %d\n", pid_nr(gh->gh_owner_pid));
-	printk(KERN_ERR "lock type: %d req lock state : %d\n",
+	pr_err("new: %pSR\n", (void *)gh->gh_ip);
+	pr_err("pid: %d\n", pid_nr(gh->gh_owner_pid));
+	pr_err("lock type: %d req lock state : %d\n",
 	       gh->gh_gl->gl_name.ln_type, gh->gh_state);
 	gfs2_dump_glock(NULL, gl);
 	BUG();
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index 2a6ba06..93a14ad 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -176,7 +176,7 @@ static void gdlm_bast(void *arg, int mode)
 		gfs2_glock_cb(gl, LM_ST_SHARED);
 		break;
 	default:
-		printk(KERN_ERR "unknown bast mode %d", mode);
+		pr_err("unknown bast mode %d", mode);
 		BUG();
 	}
 }
@@ -195,7 +195,7 @@ static int make_mode(const unsigned int lmstate)
 	case LM_ST_SHARED:
 		return DLM_LOCK_PR;
 	}
-	printk(KERN_ERR "unknown LM state %d", lmstate);
+	pr_err("unknown LM state %d", lmstate);
 	BUG();
 	return -1;
 }
@@ -308,7 +308,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
 	error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK,
 			   NULL, gl);
 	if (error) {
-		printk(KERN_ERR "gdlm_unlock %x,%llx err=%d\n",
+		pr_err("gdlm_unlock %x,%llx err=%d\n",
 		       gl->gl_name.ln_type,
 		       (unsigned long long)gl->gl_name.ln_number, error);
 		return;
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 9dcb977..8606e5e 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -690,12 +690,12 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
 	}
 
 	if (sdp->sd_log_num_buf != sdp->sd_log_commited_buf) {
-		printk(KERN_INFO "GFS2: log buf %u %u\n", sdp->sd_log_num_buf,
+		pr_info("GFS2: log buf %u %u\n", sdp->sd_log_num_buf,
 		       sdp->sd_log_commited_buf);
 		gfs2_assert_withdraw(sdp, 0);
 	}
 	if (sdp->sd_log_num_databuf != sdp->sd_log_commited_databuf) {
-		printk(KERN_INFO "GFS2: log databuf %u %u\n",
+		pr_info("GFS2: log databuf %u %u\n",
 		       sdp->sd_log_num_databuf, sdp->sd_log_commited_databuf);
 		gfs2_assert_withdraw(sdp, 0);
 	}
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index c6872d0..6db84b7 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -154,7 +154,7 @@ static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)
 	if (sb->sb_magic != GFS2_MAGIC ||
 	    sb->sb_type != GFS2_METATYPE_SB) {
 		if (!silent)
-			printk(KERN_WARNING "GFS2: not a GFS2 filesystem\n");
+			pr_warn("GFS2: not a GFS2 filesystem\n");
 		return -EINVAL;
 	}
 
@@ -176,7 +176,7 @@ static void end_bio_io_page(struct bio *bio, int error)
 	if (!error)
 		SetPageUptodate(page);
 	else
-		printk(KERN_WARNING "gfs2: error %d reading superblock\n", error);
+		pr_warn("gfs2: error %d reading superblock\n", error);
 	unlock_page(page);
 }
 
@@ -555,7 +555,7 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
 		rc = gfs2_block_map(jd->jd_inode, lb, &bh, 0);
 		db = bh.b_blocknr;
 		if (rc || !db) {
-			printk(KERN_INFO "GFS2 journal mapping error %d: lb="
+			pr_info("GFS2 journal mapping error %d: lb="
 			       "%u db=%llu\n", rc, lb, (unsigned long long)db);
 			break;
 		}
@@ -563,7 +563,7 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
 			jext = kzalloc(sizeof(struct gfs2_journal_extent),
 				       GFP_KERNEL);
 			if (!jext) {
-				printk(KERN_INFO "GFS2 error: out of memory "
+				pr_info("GFS2 error: out of memory "
 				       "mapping journal extents.\n");
 				rc = -ENOMEM;
 				break;
@@ -1008,7 +1008,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
 		lm = &gfs2_dlm_ops;
 #endif
 	} else {
-		printk(KERN_INFO "GFS2: can't find protocol %s\n", proto);
+		pr_info("GFS2: can't find protocol %s\n", proto);
 		return -ENOENT;
 	}
 
@@ -1115,7 +1115,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
 
 	sdp = init_sbd(sb);
 	if (!sdp) {
-		printk(KERN_WARNING "GFS2: can't alloc struct gfs2_sbd\n");
+		pr_warn("GFS2: can't alloc struct gfs2_sbd\n");
 		return -ENOMEM;
 	}
 	sdp->sd_args = *args;
@@ -1363,7 +1363,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
 
 	error = gfs2_mount_args(&args, data);
 	if (error) {
-		printk(KERN_WARNING "GFS2: can't parse mount arguments\n");
+		pr_warn("GFS2: can't parse mount arguments\n");
 		goto error_super;
 	}
 
@@ -1413,7 +1413,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
 
 	error = kern_path(dev_name, LOOKUP_FOLLOW, &path);
 	if (error) {
-		printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n",
+		pr_warn("GFS2: path_lookup on %s returned error %d\n",
 		       dev_name, error);
 		return ERR_PTR(error);
 	}
@@ -1421,7 +1421,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
 		 path.dentry->d_inode->i_sb->s_bdev);
 	path_put(&path);
 	if (IS_ERR(s)) {
-		printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n");
+		pr_warn("GFS2: gfs2 mount does not exist\n");
 		return ERR_CAST(s);
 	}
 	if ((flags ^ s->s_flags) & MS_RDONLY) {
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 8bec0e31..96a592f 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1081,7 +1081,7 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
 {
 	struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
 
-	printk(KERN_INFO "GFS2: fsid=%s: quota %s for %s %u\n",
+	pr_info("GFS2: fsid=%s: quota %s for %s %u\n",
 	       sdp->sd_fsname, type,
 	       (qd->qd_id.type == USRQUOTA) ? "user" : "group",
 	       from_kqid(&init_user_ns, qd->qd_id));
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index a1da213..e95cc17 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -99,11 +99,11 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
 	cur_state = (*byte1 >> bit) & GFS2_BIT_MASK;
 
 	if (unlikely(!valid_change[new_state * 4 + cur_state])) {
-		printk(KERN_WARNING "GFS2: buf_blk = 0x%x old_state=%d, "
+		pr_warn("GFS2: buf_blk = 0x%x old_state=%d, "
 		       "new_state=%d\n", rbm->offset, cur_state, new_state);
-		printk(KERN_WARNING "GFS2: rgrp=0x%llx bi_start=0x%x\n",
+		pr_warn("GFS2: rgrp=0x%llx bi_start=0x%x\n",
 		       (unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
-		printk(KERN_WARNING "GFS2: bi_offset=0x%x bi_len=0x%x\n",
+		pr_warn("GFS2: bi_offset=0x%x bi_len=0x%x\n",
 		       bi->bi_offset, bi->bi_len);
 		dump_stack();
 		gfs2_consist_rgrpd(rbm->rgd);
@@ -736,11 +736,11 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
 
 static void gfs2_rindex_print(const struct gfs2_rgrpd *rgd)
 {
-	printk(KERN_INFO "  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
-	printk(KERN_INFO "  ri_length = %u\n", rgd->rd_length);
-	printk(KERN_INFO "  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
-	printk(KERN_INFO "  ri_data = %u\n", rgd->rd_data);
-	printk(KERN_INFO "  ri_bitbytes = %u\n", rgd->rd_bitbytes);
+	pr_info("  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
+	pr_info("  ri_length = %u\n", rgd->rd_length);
+	pr_info("  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
+	pr_info("  ri_data = %u\n", rgd->rd_data);
+	pr_info("  ri_bitbytes = %u\n", rgd->rd_bitbytes);
 }
 
 /**
@@ -2278,7 +2278,7 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
 		}
 	}
 	if (rbm.rgd->rd_free < *nblocks) {
-		printk(KERN_WARNING "nblocks=%u\n", *nblocks);
+		pr_warn("nblocks=%u\n", *nblocks);
 		goto rgrp_error;
 	}
 
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 60f60f6..0dfe0aa 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -175,7 +175,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 			break;
 		case Opt_debug:
 			if (args->ar_errors == GFS2_ERRORS_PANIC) {
-				printk(KERN_WARNING "GFS2: -o debug and -o errors=panic "
+				pr_warn("GFS2: -o debug and -o errors=panic "
 				       "are mutually exclusive.\n");
 				return -EINVAL;
 			}
@@ -228,21 +228,26 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 		case Opt_commit:
 			rv = match_int(&tmp[0], &args->ar_commit);
 			if (rv || args->ar_commit <= 0) {
-				printk(KERN_WARNING "GFS2: commit mount option requires a positive numeric argument\n");
+				pr_warn("GFS2: commit mount option requires"
+					" a positive numeric argument\n");
 				return rv ? rv : -EINVAL;
 			}
 			break;
 		case Opt_statfs_quantum:
 			rv = match_int(&tmp[0], &args->ar_statfs_quantum);
 			if (rv || args->ar_statfs_quantum < 0) {
-				printk(KERN_WARNING "GFS2: statfs_quantum mount option requires a non-negative numeric argument\n");
+				pr_warn("GFS2: statfs_quantum mount option"
+					" requires a non-negative numeric"
+					" argument\n");
 				return rv ? rv : -EINVAL;
 			}
 			break;
 		case Opt_quota_quantum:
 			rv = match_int(&tmp[0], &args->ar_quota_quantum);
 			if (rv || args->ar_quota_quantum <= 0) {
-				printk(KERN_WARNING "GFS2: quota_quantum mount option requires a positive numeric argument\n");
+				pr_warn("GFS2: quota_quantum mount option"
+					" requires a positive numeric"
+					" argument\n");
 				return rv ? rv : -EINVAL;
 			}
 			break;
@@ -250,7 +255,9 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 			rv = match_int(&tmp[0], &args->ar_statfs_percent);
 			if (rv || args->ar_statfs_percent < 0 ||
 			    args->ar_statfs_percent > 100) {
-				printk(KERN_WARNING "statfs_percent mount option requires a numeric argument between 0 and 100\n");
+				pr_warn("statfs_percent mount option requires"
+					" a numeric argument between 0"
+					" and 100\n");
 				return rv ? rv : -EINVAL;
 			}
 			break;
@@ -259,7 +266,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 			break;
 		case Opt_err_panic:
 			if (args->ar_debug) {
-				printk(KERN_WARNING "GFS2: -o debug and -o errors=panic "
+				pr_warn("GFS2: -o debug and -o errors=panic "
 					"are mutually exclusive.\n");
 				return -EINVAL;
 			}
@@ -279,7 +286,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 			break;
 		case Opt_error:
 		default:
-			printk(KERN_WARNING "GFS2: invalid mount option: %s\n", o);
+			pr_warn("GFS2: invalid mount option: %s\n", o);
 			return -EINVAL;
 		}
 	}
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 2b20d70..f570819 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -96,11 +96,11 @@ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
 
 static void gfs2_print_trans(const struct gfs2_trans *tr)
 {
-	printk(KERN_WARNING "GFS2: Transaction created at: %pSR\n",
+	pr_warn("GFS2: Transaction created at: %pSR\n",
 	       (void *)tr->tr_ip);
-	printk(KERN_WARNING "GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n",
+	pr_warn("GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n",
 	       tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
-	printk(KERN_WARNING "GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
+	pr_warn("GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
 	       tr->tr_num_buf_new, tr->tr_num_buf_rm,
 	       tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
 	       tr->tr_num_revoke, tr->tr_num_revoke_rm);
@@ -230,7 +230,7 @@ static void meta_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
 	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
 	mh = (struct gfs2_meta_header *)bd->bd_bh->b_data;
 	if (unlikely(mh->mh_magic != cpu_to_be32(GFS2_MAGIC))) {
-		printk(KERN_ERR
+		pr_err(
 		       "Attempting to add uninitialised block to journal (inplace block=%lld)\n",
 		       (unsigned long long)bd->bd_bh->b_blocknr);
 		BUG();
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index f7109f6..c83765a 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -30,7 +30,7 @@ mempool_t *gfs2_page_pool __read_mostly;
 
 void gfs2_assert_i(struct gfs2_sbd *sdp)
 {
-	printk(KERN_EMERG "GFS2: fsid=%s: fatal assertion failed\n",
+	pr_emerg("GFS2: fsid=%s: fatal assertion failed\n",
 	       sdp->sd_fsname);
 }
 
@@ -105,11 +105,11 @@ int gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
 		return -2;
 
 	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW)
-		printk(KERN_WARNING
-		       "GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
-		       "GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		       sdp->sd_fsname, assertion,
-		       sdp->sd_fsname, function, file, line);
+		pr_warn("GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
+			"GFS2: fsid=%s:   function = %s, file = %s,"
+			" line = %u\n",
+			sdp->sd_fsname, assertion,
+			sdp->sd_fsname, function, file, line);
 
 	if (sdp->sd_args.ar_debug)
 		BUG();
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
index b7ffb09..7c90b1e 100644
--- a/fs/gfs2/util.h
+++ b/fs/gfs2/util.h
@@ -14,17 +14,14 @@
 
 #include "incore.h"
 
-#define fs_printk(level, fs, fmt, arg...) \
-	printk(level "GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
-
 #define fs_info(fs, fmt, arg...) \
-	fs_printk(KERN_INFO , fs , fmt , ## arg)
+	pr_info("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
 
 #define fs_warn(fs, fmt, arg...) \
-	fs_printk(KERN_WARNING , fs , fmt , ## arg)
+	pr_warn("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
 
 #define fs_err(fs, fmt, arg...) \
-	fs_printk(KERN_ERR, fs , fmt , ## arg)
+	pr_err("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
 
 
 void gfs2_assert_i(struct gfs2_sbd *sdp);
@@ -85,7 +82,7 @@ static inline int gfs2_meta_check(struct gfs2_sbd *sdp,
 	struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data;
 	u32 magic = be32_to_cpu(mh->mh_magic);
 	if (unlikely(magic != GFS2_MAGIC)) {
-		printk(KERN_ERR "GFS2: Magic number missing at %llu\n",
+		pr_err("GFS2: Magic number missing at %llu\n",
 		       (unsigned long long)bh->b_blocknr);
 		return -EIO;
 	}
-- 
1.8.1.4


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

* Re: [PATCH 1/1] fs: gfs2: global conversion to pr_foo()
  2014-03-06 15:44 ` Steven Whitehouse
@ 2014-03-06  9:24   ` Fabian Frederick
  2014-03-06 17:57     ` Steven Whitehouse
  2014-03-06 17:47   ` [PATCH 1/1] fs: gfs2: global conversion to pr_foo() Joe Perches
  1 sibling, 1 reply; 14+ messages in thread
From: Fabian Frederick @ 2014-03-06  9:24 UTC (permalink / raw)
  To: Steven Whitehouse; +Cc: linux-kernel, akpm

On Thu, 06 Mar 2014 15:44:04 +0000
Steven Whitehouse <swhiteho@redhat.com> wrote:

> Hi,
> 
> On Wed, 2014-03-05 at 22:06 +0800, Fabian Frederick wrote:
> > -All printk(KERN_foo converted to pr_foo().
> > -Messages updated to fit in 80 columns.
> > -fs_macros converted as well.
> > -fs_printk removed.
> > 
> > Signed-off-by: Fabian Frederick <fabf@skynet.be>
> 
> Due to various other patches, this didn't apply directly, so I've fixed
> it up by hand. I have pushed it to the -nmw tree, so please do take a
> look and check that I didn't miss anything. Thanks,
> 
> Steve.

Hi Steve,

   Maybe I'm not looking at the right place (steve/gfs2-3.0-nmw.git/) but gfs2 in that tree (with patch applied) still has 25 printk entries. Original patch just keeps 3 printk : 1 commented line, "GFS2 installed" and vprintk(fmt...

Fabian



> 
> > ---
> >  fs/gfs2/dir.c        |  7 ++++---
> >  fs/gfs2/glock.c      | 19 ++++++++++---------
> >  fs/gfs2/lock_dlm.c   |  6 +++---
> >  fs/gfs2/log.c        |  4 ++--
> >  fs/gfs2/ops_fstype.c | 18 +++++++++---------
> >  fs/gfs2/quota.c      |  2 +-
> >  fs/gfs2/rgrp.c       | 18 +++++++++---------
> >  fs/gfs2/super.c      | 21 ++++++++++++++-------
> >  fs/gfs2/trans.c      |  8 ++++----
> >  fs/gfs2/util.c       | 12 ++++++------
> >  fs/gfs2/util.h       | 11 ++++-------
> >  11 files changed, 66 insertions(+), 60 deletions(-)
> > 
> > diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
> > index fa32655..abcac94 100644
> > --- a/fs/gfs2/dir.c
> > +++ b/fs/gfs2/dir.c
> > @@ -507,7 +507,7 @@ static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset,
> >  		goto error;
> >  	return 0;
> >  error:
> > -	printk(KERN_WARNING "gfs2_check_dirent: %s (%s)\n", msg,
> > +	pr_warn("gfs2_check_dirent: %s (%s)\n", msg,
> >  	       first ? "first in block" : "not first in block");
> >  	return -EIO;
> >  }
> > @@ -531,7 +531,7 @@ static int gfs2_dirent_offset(const void *buf)
> >  	}
> >  	return offset;
> >  wrong_type:
> > -	printk(KERN_WARNING "gfs2_scan_dirent: wrong block type %u\n",
> > +	pr_warn("gfs2_scan_dirent: wrong block type %u\n",
> >  	       be32_to_cpu(h->mh_type));
> >  	return -1;
> >  }
> > @@ -1006,7 +1006,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
> >  	len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth));
> >  	half_len = len >> 1;
> >  	if (!half_len) {
> > -		printk(KERN_WARNING "i_depth %u lf_depth %u index %u\n", dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
> > +		pr_warn("i_depth %u lf_depth %u index %u\n", dip->i_depth,
> > +			be16_to_cpu(oleaf->lf_depth), index);
> >  		gfs2_consist_inode(dip);
> >  		error = -EIO;
> >  		goto fail_brelse;
> > diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> > index ca0be6c..eac3d24 100644
> > --- a/fs/gfs2/glock.c
> > +++ b/fs/gfs2/glock.c
> > @@ -468,7 +468,8 @@ retry:
> >  			do_xmote(gl, gh, LM_ST_UNLOCKED);
> >  			break;
> >  		default: /* Everything else */
> > -			printk(KERN_ERR "GFS2: wanted %u got %u\n", gl->gl_target, state);
> > +			pr_err("GFS2: wanted %u got %u\n",
> > +			       gl->gl_target, state);
> >  			GLOCK_BUG_ON(gl, 1);
> >  		}
> >  		spin_unlock(&gl->gl_spin);
> > @@ -542,7 +543,7 @@ __acquires(&gl->gl_spin)
> >  		/* lock_dlm */
> >  		ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
> >  		if (ret) {
> > -			printk(KERN_ERR "GFS2: lm_lock ret %d\n", ret);
> > +			pr_err("GFS2: lm_lock ret %d\n", ret);
> >  			GLOCK_BUG_ON(gl, 1);
> >  		}
> >  	} else { /* lock_nolock */
> > @@ -935,7 +936,7 @@ void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...)
> >  		vaf.fmt = fmt;
> >  		vaf.va = &args;
> >  
> > -		printk(KERN_ERR " %pV", &vaf);
> > +		pr_err(" %pV", &vaf);
> >  	}
> >  
> >  	va_end(args);
> > @@ -1010,13 +1011,13 @@ do_cancel:
> >  	return;
> >  
> >  trap_recursive:
> > -	printk(KERN_ERR "original: %pSR\n", (void *)gh2->gh_ip);
> > -	printk(KERN_ERR "pid: %d\n", pid_nr(gh2->gh_owner_pid));
> > -	printk(KERN_ERR "lock type: %d req lock state : %d\n",
> > +	pr_err("original: %pSR\n", (void *)gh2->gh_ip);
> > +	pr_err("pid: %d\n", pid_nr(gh2->gh_owner_pid));
> > +	pr_err("lock type: %d req lock state : %d\n",
> >  	       gh2->gh_gl->gl_name.ln_type, gh2->gh_state);
> > -	printk(KERN_ERR "new: %pSR\n", (void *)gh->gh_ip);
> > -	printk(KERN_ERR "pid: %d\n", pid_nr(gh->gh_owner_pid));
> > -	printk(KERN_ERR "lock type: %d req lock state : %d\n",
> > +	pr_err("new: %pSR\n", (void *)gh->gh_ip);
> > +	pr_err("pid: %d\n", pid_nr(gh->gh_owner_pid));
> > +	pr_err("lock type: %d req lock state : %d\n",
> >  	       gh->gh_gl->gl_name.ln_type, gh->gh_state);
> >  	gfs2_dump_glock(NULL, gl);
> >  	BUG();
> > diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
> > index 2a6ba06..93a14ad 100644
> > --- a/fs/gfs2/lock_dlm.c
> > +++ b/fs/gfs2/lock_dlm.c
> > @@ -176,7 +176,7 @@ static void gdlm_bast(void *arg, int mode)
> >  		gfs2_glock_cb(gl, LM_ST_SHARED);
> >  		break;
> >  	default:
> > -		printk(KERN_ERR "unknown bast mode %d", mode);
> > +		pr_err("unknown bast mode %d", mode);
> >  		BUG();
> >  	}
> >  }
> > @@ -195,7 +195,7 @@ static int make_mode(const unsigned int lmstate)
> >  	case LM_ST_SHARED:
> >  		return DLM_LOCK_PR;
> >  	}
> > -	printk(KERN_ERR "unknown LM state %d", lmstate);
> > +	pr_err("unknown LM state %d", lmstate);
> >  	BUG();
> >  	return -1;
> >  }
> > @@ -308,7 +308,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
> >  	error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK,
> >  			   NULL, gl);
> >  	if (error) {
> > -		printk(KERN_ERR "gdlm_unlock %x,%llx err=%d\n",
> > +		pr_err("gdlm_unlock %x,%llx err=%d\n",
> >  		       gl->gl_name.ln_type,
> >  		       (unsigned long long)gl->gl_name.ln_number, error);
> >  		return;
> > diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
> > index 9dcb977..8606e5e 100644
> > --- a/fs/gfs2/log.c
> > +++ b/fs/gfs2/log.c
> > @@ -690,12 +690,12 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
> >  	}
> >  
> >  	if (sdp->sd_log_num_buf != sdp->sd_log_commited_buf) {
> > -		printk(KERN_INFO "GFS2: log buf %u %u\n", sdp->sd_log_num_buf,
> > +		pr_info("GFS2: log buf %u %u\n", sdp->sd_log_num_buf,
> >  		       sdp->sd_log_commited_buf);
> >  		gfs2_assert_withdraw(sdp, 0);
> >  	}
> >  	if (sdp->sd_log_num_databuf != sdp->sd_log_commited_databuf) {
> > -		printk(KERN_INFO "GFS2: log databuf %u %u\n",
> > +		pr_info("GFS2: log databuf %u %u\n",
> >  		       sdp->sd_log_num_databuf, sdp->sd_log_commited_databuf);
> >  		gfs2_assert_withdraw(sdp, 0);
> >  	}
> > diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> > index c6872d0..6db84b7 100644
> > --- a/fs/gfs2/ops_fstype.c
> > +++ b/fs/gfs2/ops_fstype.c
> > @@ -154,7 +154,7 @@ static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)
> >  	if (sb->sb_magic != GFS2_MAGIC ||
> >  	    sb->sb_type != GFS2_METATYPE_SB) {
> >  		if (!silent)
> > -			printk(KERN_WARNING "GFS2: not a GFS2 filesystem\n");
> > +			pr_warn("GFS2: not a GFS2 filesystem\n");
> >  		return -EINVAL;
> >  	}
> >  
> > @@ -176,7 +176,7 @@ static void end_bio_io_page(struct bio *bio, int error)
> >  	if (!error)
> >  		SetPageUptodate(page);
> >  	else
> > -		printk(KERN_WARNING "gfs2: error %d reading superblock\n", error);
> > +		pr_warn("gfs2: error %d reading superblock\n", error);
> >  	unlock_page(page);
> >  }
> >  
> > @@ -555,7 +555,7 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
> >  		rc = gfs2_block_map(jd->jd_inode, lb, &bh, 0);
> >  		db = bh.b_blocknr;
> >  		if (rc || !db) {
> > -			printk(KERN_INFO "GFS2 journal mapping error %d: lb="
> > +			pr_info("GFS2 journal mapping error %d: lb="
> >  			       "%u db=%llu\n", rc, lb, (unsigned long long)db);
> >  			break;
> >  		}
> > @@ -563,7 +563,7 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
> >  			jext = kzalloc(sizeof(struct gfs2_journal_extent),
> >  				       GFP_KERNEL);
> >  			if (!jext) {
> > -				printk(KERN_INFO "GFS2 error: out of memory "
> > +				pr_info("GFS2 error: out of memory "
> >  				       "mapping journal extents.\n");
> >  				rc = -ENOMEM;
> >  				break;
> > @@ -1008,7 +1008,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
> >  		lm = &gfs2_dlm_ops;
> >  #endif
> >  	} else {
> > -		printk(KERN_INFO "GFS2: can't find protocol %s\n", proto);
> > +		pr_info("GFS2: can't find protocol %s\n", proto);
> >  		return -ENOENT;
> >  	}
> >  
> > @@ -1115,7 +1115,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
> >  
> >  	sdp = init_sbd(sb);
> >  	if (!sdp) {
> > -		printk(KERN_WARNING "GFS2: can't alloc struct gfs2_sbd\n");
> > +		pr_warn("GFS2: can't alloc struct gfs2_sbd\n");
> >  		return -ENOMEM;
> >  	}
> >  	sdp->sd_args = *args;
> > @@ -1363,7 +1363,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
> >  
> >  	error = gfs2_mount_args(&args, data);
> >  	if (error) {
> > -		printk(KERN_WARNING "GFS2: can't parse mount arguments\n");
> > +		pr_warn("GFS2: can't parse mount arguments\n");
> >  		goto error_super;
> >  	}
> >  
> > @@ -1413,7 +1413,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
> >  
> >  	error = kern_path(dev_name, LOOKUP_FOLLOW, &path);
> >  	if (error) {
> > -		printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n",
> > +		pr_warn("GFS2: path_lookup on %s returned error %d\n",
> >  		       dev_name, error);
> >  		return ERR_PTR(error);
> >  	}
> > @@ -1421,7 +1421,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
> >  		 path.dentry->d_inode->i_sb->s_bdev);
> >  	path_put(&path);
> >  	if (IS_ERR(s)) {
> > -		printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n");
> > +		pr_warn("GFS2: gfs2 mount does not exist\n");
> >  		return ERR_CAST(s);
> >  	}
> >  	if ((flags ^ s->s_flags) & MS_RDONLY) {
> > diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
> > index 8bec0e31..96a592f 100644
> > --- a/fs/gfs2/quota.c
> > +++ b/fs/gfs2/quota.c
> > @@ -1081,7 +1081,7 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
> >  {
> >  	struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
> >  
> > -	printk(KERN_INFO "GFS2: fsid=%s: quota %s for %s %u\n",
> > +	pr_info("GFS2: fsid=%s: quota %s for %s %u\n",
> >  	       sdp->sd_fsname, type,
> >  	       (qd->qd_id.type == USRQUOTA) ? "user" : "group",
> >  	       from_kqid(&init_user_ns, qd->qd_id));
> > diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
> > index a1da213..e95cc17 100644
> > --- a/fs/gfs2/rgrp.c
> > +++ b/fs/gfs2/rgrp.c
> > @@ -99,11 +99,11 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
> >  	cur_state = (*byte1 >> bit) & GFS2_BIT_MASK;
> >  
> >  	if (unlikely(!valid_change[new_state * 4 + cur_state])) {
> > -		printk(KERN_WARNING "GFS2: buf_blk = 0x%x old_state=%d, "
> > +		pr_warn("GFS2: buf_blk = 0x%x old_state=%d, "
> >  		       "new_state=%d\n", rbm->offset, cur_state, new_state);
> > -		printk(KERN_WARNING "GFS2: rgrp=0x%llx bi_start=0x%x\n",
> > +		pr_warn("GFS2: rgrp=0x%llx bi_start=0x%x\n",
> >  		       (unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
> > -		printk(KERN_WARNING "GFS2: bi_offset=0x%x bi_len=0x%x\n",
> > +		pr_warn("GFS2: bi_offset=0x%x bi_len=0x%x\n",
> >  		       bi->bi_offset, bi->bi_len);
> >  		dump_stack();
> >  		gfs2_consist_rgrpd(rbm->rgd);
> > @@ -736,11 +736,11 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
> >  
> >  static void gfs2_rindex_print(const struct gfs2_rgrpd *rgd)
> >  {
> > -	printk(KERN_INFO "  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
> > -	printk(KERN_INFO "  ri_length = %u\n", rgd->rd_length);
> > -	printk(KERN_INFO "  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
> > -	printk(KERN_INFO "  ri_data = %u\n", rgd->rd_data);
> > -	printk(KERN_INFO "  ri_bitbytes = %u\n", rgd->rd_bitbytes);
> > +	pr_info("  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
> > +	pr_info("  ri_length = %u\n", rgd->rd_length);
> > +	pr_info("  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
> > +	pr_info("  ri_data = %u\n", rgd->rd_data);
> > +	pr_info("  ri_bitbytes = %u\n", rgd->rd_bitbytes);
> >  }
> >  
> >  /**
> > @@ -2278,7 +2278,7 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
> >  		}
> >  	}
> >  	if (rbm.rgd->rd_free < *nblocks) {
> > -		printk(KERN_WARNING "nblocks=%u\n", *nblocks);
> > +		pr_warn("nblocks=%u\n", *nblocks);
> >  		goto rgrp_error;
> >  	}
> >  
> > diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> > index 60f60f6..0dfe0aa 100644
> > --- a/fs/gfs2/super.c
> > +++ b/fs/gfs2/super.c
> > @@ -175,7 +175,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> >  			break;
> >  		case Opt_debug:
> >  			if (args->ar_errors == GFS2_ERRORS_PANIC) {
> > -				printk(KERN_WARNING "GFS2: -o debug and -o errors=panic "
> > +				pr_warn("GFS2: -o debug and -o errors=panic "
> >  				       "are mutually exclusive.\n");
> >  				return -EINVAL;
> >  			}
> > @@ -228,21 +228,26 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> >  		case Opt_commit:
> >  			rv = match_int(&tmp[0], &args->ar_commit);
> >  			if (rv || args->ar_commit <= 0) {
> > -				printk(KERN_WARNING "GFS2: commit mount option requires a positive numeric argument\n");
> > +				pr_warn("GFS2: commit mount option requires"
> > +					" a positive numeric argument\n");
> >  				return rv ? rv : -EINVAL;
> >  			}
> >  			break;
> >  		case Opt_statfs_quantum:
> >  			rv = match_int(&tmp[0], &args->ar_statfs_quantum);
> >  			if (rv || args->ar_statfs_quantum < 0) {
> > -				printk(KERN_WARNING "GFS2: statfs_quantum mount option requires a non-negative numeric argument\n");
> > +				pr_warn("GFS2: statfs_quantum mount option"
> > +					" requires a non-negative numeric"
> > +					" argument\n");
> >  				return rv ? rv : -EINVAL;
> >  			}
> >  			break;
> >  		case Opt_quota_quantum:
> >  			rv = match_int(&tmp[0], &args->ar_quota_quantum);
> >  			if (rv || args->ar_quota_quantum <= 0) {
> > -				printk(KERN_WARNING "GFS2: quota_quantum mount option requires a positive numeric argument\n");
> > +				pr_warn("GFS2: quota_quantum mount option"
> > +					" requires a positive numeric"
> > +					" argument\n");
> >  				return rv ? rv : -EINVAL;
> >  			}
> >  			break;
> > @@ -250,7 +255,9 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> >  			rv = match_int(&tmp[0], &args->ar_statfs_percent);
> >  			if (rv || args->ar_statfs_percent < 0 ||
> >  			    args->ar_statfs_percent > 100) {
> > -				printk(KERN_WARNING "statfs_percent mount option requires a numeric argument between 0 and 100\n");
> > +				pr_warn("statfs_percent mount option requires"
> > +					" a numeric argument between 0"
> > +					" and 100\n");
> >  				return rv ? rv : -EINVAL;
> >  			}
> >  			break;
> > @@ -259,7 +266,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> >  			break;
> >  		case Opt_err_panic:
> >  			if (args->ar_debug) {
> > -				printk(KERN_WARNING "GFS2: -o debug and -o errors=panic "
> > +				pr_warn("GFS2: -o debug and -o errors=panic "
> >  					"are mutually exclusive.\n");
> >  				return -EINVAL;
> >  			}
> > @@ -279,7 +286,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> >  			break;
> >  		case Opt_error:
> >  		default:
> > -			printk(KERN_WARNING "GFS2: invalid mount option: %s\n", o);
> > +			pr_warn("GFS2: invalid mount option: %s\n", o);
> >  			return -EINVAL;
> >  		}
> >  	}
> > diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
> > index 2b20d70..f570819 100644
> > --- a/fs/gfs2/trans.c
> > +++ b/fs/gfs2/trans.c
> > @@ -96,11 +96,11 @@ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
> >  
> >  static void gfs2_print_trans(const struct gfs2_trans *tr)
> >  {
> > -	printk(KERN_WARNING "GFS2: Transaction created at: %pSR\n",
> > +	pr_warn("GFS2: Transaction created at: %pSR\n",
> >  	       (void *)tr->tr_ip);
> > -	printk(KERN_WARNING "GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n",
> > +	pr_warn("GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n",
> >  	       tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
> > -	printk(KERN_WARNING "GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
> > +	pr_warn("GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
> >  	       tr->tr_num_buf_new, tr->tr_num_buf_rm,
> >  	       tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
> >  	       tr->tr_num_revoke, tr->tr_num_revoke_rm);
> > @@ -230,7 +230,7 @@ static void meta_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
> >  	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
> >  	mh = (struct gfs2_meta_header *)bd->bd_bh->b_data;
> >  	if (unlikely(mh->mh_magic != cpu_to_be32(GFS2_MAGIC))) {
> > -		printk(KERN_ERR
> > +		pr_err(
> >  		       "Attempting to add uninitialised block to journal (inplace block=%lld)\n",
> >  		       (unsigned long long)bd->bd_bh->b_blocknr);
> >  		BUG();
> > diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
> > index f7109f6..c83765a 100644
> > --- a/fs/gfs2/util.c
> > +++ b/fs/gfs2/util.c
> > @@ -30,7 +30,7 @@ mempool_t *gfs2_page_pool __read_mostly;
> >  
> >  void gfs2_assert_i(struct gfs2_sbd *sdp)
> >  {
> > -	printk(KERN_EMERG "GFS2: fsid=%s: fatal assertion failed\n",
> > +	pr_emerg("GFS2: fsid=%s: fatal assertion failed\n",
> >  	       sdp->sd_fsname);
> >  }
> >  
> > @@ -105,11 +105,11 @@ int gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
> >  		return -2;
> >  
> >  	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW)
> > -		printk(KERN_WARNING
> > -		       "GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
> > -		       "GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
> > -		       sdp->sd_fsname, assertion,
> > -		       sdp->sd_fsname, function, file, line);
> > +		pr_warn("GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
> > +			"GFS2: fsid=%s:   function = %s, file = %s,"
> > +			" line = %u\n",
> > +			sdp->sd_fsname, assertion,
> > +			sdp->sd_fsname, function, file, line);
> >  
> >  	if (sdp->sd_args.ar_debug)
> >  		BUG();
> > diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
> > index b7ffb09..7c90b1e 100644
> > --- a/fs/gfs2/util.h
> > +++ b/fs/gfs2/util.h
> > @@ -14,17 +14,14 @@
> >  
> >  #include "incore.h"
> >  
> > -#define fs_printk(level, fs, fmt, arg...) \
> > -	printk(level "GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> > -
> >  #define fs_info(fs, fmt, arg...) \
> > -	fs_printk(KERN_INFO , fs , fmt , ## arg)
> > +	pr_info("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> >  
> >  #define fs_warn(fs, fmt, arg...) \
> > -	fs_printk(KERN_WARNING , fs , fmt , ## arg)
> > +	pr_warn("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> >  
> >  #define fs_err(fs, fmt, arg...) \
> > -	fs_printk(KERN_ERR, fs , fmt , ## arg)
> > +	pr_err("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> >  
> > 
> >  void gfs2_assert_i(struct gfs2_sbd *sdp);
> > @@ -85,7 +82,7 @@ static inline int gfs2_meta_check(struct gfs2_sbd *sdp,
> >  	struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data;
> >  	u32 magic = be32_to_cpu(mh->mh_magic);
> >  	if (unlikely(magic != GFS2_MAGIC)) {
> > -		printk(KERN_ERR "GFS2: Magic number missing at %llu\n",
> > +		pr_err("GFS2: Magic number missing at %llu\n",
> >  		       (unsigned long long)bh->b_blocknr);
> >  		return -EIO;
> >  	}
> 
> 

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

* Re: [PATCH 1/1] fs: gfs2: global conversion to pr_foo()
  2014-03-06 17:57     ` Steven Whitehouse
@ 2014-03-06 10:27       ` Fabian Frederick
  2014-03-06 20:10         ` [PATCH 0/3] gfs: More logging neatening Joe Perches
  0 siblings, 1 reply; 14+ messages in thread
From: Fabian Frederick @ 2014-03-06 10:27 UTC (permalink / raw)
  To: Steven Whitehouse; +Cc: linux-kernel, akpm

On Thu, 06 Mar 2014 17:57:42 +0000
Steven Whitehouse <swhiteho@redhat.com> wrote:

> Hi,
> 
> On Thu, 2014-03-06 at 17:24 +0800, Fabian Frederick wrote:
> > On Thu, 06 Mar 2014 15:44:04 +0000
> > Steven Whitehouse <swhiteho@redhat.com> wrote:
> > 
> > > Hi,
> > > 
> > > On Wed, 2014-03-05 at 22:06 +0800, Fabian Frederick wrote:
> > > > -All printk(KERN_foo converted to pr_foo().
> > > > -Messages updated to fit in 80 columns.
> > > > -fs_macros converted as well.
> > > > -fs_printk removed.
> > > > 
> > > > Signed-off-by: Fabian Frederick <fabf@skynet.be>
> > > 
> > > Due to various other patches, this didn't apply directly, so I've fixed
> > > it up by hand. I have pushed it to the -nmw tree, so please do take a
> > > look and check that I didn't miss anything. Thanks,
> > > 
> > > Steve.
> > 
> > Hi Steve,
> > 
> >    Maybe I'm not looking at the right place (steve/gfs2-3.0-nmw.git/) but gfs2 in that tree (with patch applied) still has 25 printk entries. Original patch just keeps 3 printk : 1 commented line, "GFS2 installed" and vprintk(fmt...
> > 
> > Fabian
> > 
> Yes, I see now... I think git didn't give me the full list of files with
> rejects or something like that. Anyway I've picked up the other bits
> that were missing now and I think it should now be complete,
> 
> Steve.

Thanks :) It seems better now except fs_macros in util.h but I guess Joe will update all that stuff anyway.

Fabian
> 
> > 
> > 
> > > 
> > > > ---
> > > >  fs/gfs2/dir.c        |  7 ++++---
> > > >  fs/gfs2/glock.c      | 19 ++++++++++---------
> > > >  fs/gfs2/lock_dlm.c   |  6 +++---
> > > >  fs/gfs2/log.c        |  4 ++--
> > > >  fs/gfs2/ops_fstype.c | 18 +++++++++---------
> > > >  fs/gfs2/quota.c      |  2 +-
> > > >  fs/gfs2/rgrp.c       | 18 +++++++++---------
> > > >  fs/gfs2/super.c      | 21 ++++++++++++++-------
> > > >  fs/gfs2/trans.c      |  8 ++++----
> > > >  fs/gfs2/util.c       | 12 ++++++------
> > > >  fs/gfs2/util.h       | 11 ++++-------
> > > >  11 files changed, 66 insertions(+), 60 deletions(-)
> > > > 
> > > > diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
> > > > index fa32655..abcac94 100644
> > > > --- a/fs/gfs2/dir.c
> > > > +++ b/fs/gfs2/dir.c
> > > > @@ -507,7 +507,7 @@ static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset,
> > > >  		goto error;
> > > >  	return 0;
> > > >  error:
> > > > -	printk(KERN_WARNING "gfs2_check_dirent: %s (%s)\n", msg,
> > > > +	pr_warn("gfs2_check_dirent: %s (%s)\n", msg,
> > > >  	       first ? "first in block" : "not first in block");
> > > >  	return -EIO;
> > > >  }
> > > > @@ -531,7 +531,7 @@ static int gfs2_dirent_offset(const void *buf)
> > > >  	}
> > > >  	return offset;
> > > >  wrong_type:
> > > > -	printk(KERN_WARNING "gfs2_scan_dirent: wrong block type %u\n",
> > > > +	pr_warn("gfs2_scan_dirent: wrong block type %u\n",
> > > >  	       be32_to_cpu(h->mh_type));
> > > >  	return -1;
> > > >  }
> > > > @@ -1006,7 +1006,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
> > > >  	len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth));
> > > >  	half_len = len >> 1;
> > > >  	if (!half_len) {
> > > > -		printk(KERN_WARNING "i_depth %u lf_depth %u index %u\n", dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
> > > > +		pr_warn("i_depth %u lf_depth %u index %u\n", dip->i_depth,
> > > > +			be16_to_cpu(oleaf->lf_depth), index);
> > > >  		gfs2_consist_inode(dip);
> > > >  		error = -EIO;
> > > >  		goto fail_brelse;
> > > > diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> > > > index ca0be6c..eac3d24 100644
> > > > --- a/fs/gfs2/glock.c
> > > > +++ b/fs/gfs2/glock.c
> > > > @@ -468,7 +468,8 @@ retry:
> > > >  			do_xmote(gl, gh, LM_ST_UNLOCKED);
> > > >  			break;
> > > >  		default: /* Everything else */
> > > > -			printk(KERN_ERR "GFS2: wanted %u got %u\n", gl->gl_target, state);
> > > > +			pr_err("GFS2: wanted %u got %u\n",
> > > > +			       gl->gl_target, state);
> > > >  			GLOCK_BUG_ON(gl, 1);
> > > >  		}
> > > >  		spin_unlock(&gl->gl_spin);
> > > > @@ -542,7 +543,7 @@ __acquires(&gl->gl_spin)
> > > >  		/* lock_dlm */
> > > >  		ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
> > > >  		if (ret) {
> > > > -			printk(KERN_ERR "GFS2: lm_lock ret %d\n", ret);
> > > > +			pr_err("GFS2: lm_lock ret %d\n", ret);
> > > >  			GLOCK_BUG_ON(gl, 1);
> > > >  		}
> > > >  	} else { /* lock_nolock */
> > > > @@ -935,7 +936,7 @@ void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...)
> > > >  		vaf.fmt = fmt;
> > > >  		vaf.va = &args;
> > > >  
> > > > -		printk(KERN_ERR " %pV", &vaf);
> > > > +		pr_err(" %pV", &vaf);
> > > >  	}
> > > >  
> > > >  	va_end(args);
> > > > @@ -1010,13 +1011,13 @@ do_cancel:
> > > >  	return;
> > > >  
> > > >  trap_recursive:
> > > > -	printk(KERN_ERR "original: %pSR\n", (void *)gh2->gh_ip);
> > > > -	printk(KERN_ERR "pid: %d\n", pid_nr(gh2->gh_owner_pid));
> > > > -	printk(KERN_ERR "lock type: %d req lock state : %d\n",
> > > > +	pr_err("original: %pSR\n", (void *)gh2->gh_ip);
> > > > +	pr_err("pid: %d\n", pid_nr(gh2->gh_owner_pid));
> > > > +	pr_err("lock type: %d req lock state : %d\n",
> > > >  	       gh2->gh_gl->gl_name.ln_type, gh2->gh_state);
> > > > -	printk(KERN_ERR "new: %pSR\n", (void *)gh->gh_ip);
> > > > -	printk(KERN_ERR "pid: %d\n", pid_nr(gh->gh_owner_pid));
> > > > -	printk(KERN_ERR "lock type: %d req lock state : %d\n",
> > > > +	pr_err("new: %pSR\n", (void *)gh->gh_ip);
> > > > +	pr_err("pid: %d\n", pid_nr(gh->gh_owner_pid));
> > > > +	pr_err("lock type: %d req lock state : %d\n",
> > > >  	       gh->gh_gl->gl_name.ln_type, gh->gh_state);
> > > >  	gfs2_dump_glock(NULL, gl);
> > > >  	BUG();
> > > > diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
> > > > index 2a6ba06..93a14ad 100644
> > > > --- a/fs/gfs2/lock_dlm.c
> > > > +++ b/fs/gfs2/lock_dlm.c
> > > > @@ -176,7 +176,7 @@ static void gdlm_bast(void *arg, int mode)
> > > >  		gfs2_glock_cb(gl, LM_ST_SHARED);
> > > >  		break;
> > > >  	default:
> > > > -		printk(KERN_ERR "unknown bast mode %d", mode);
> > > > +		pr_err("unknown bast mode %d", mode);
> > > >  		BUG();
> > > >  	}
> > > >  }
> > > > @@ -195,7 +195,7 @@ static int make_mode(const unsigned int lmstate)
> > > >  	case LM_ST_SHARED:
> > > >  		return DLM_LOCK_PR;
> > > >  	}
> > > > -	printk(KERN_ERR "unknown LM state %d", lmstate);
> > > > +	pr_err("unknown LM state %d", lmstate);
> > > >  	BUG();
> > > >  	return -1;
> > > >  }
> > > > @@ -308,7 +308,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
> > > >  	error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK,
> > > >  			   NULL, gl);
> > > >  	if (error) {
> > > > -		printk(KERN_ERR "gdlm_unlock %x,%llx err=%d\n",
> > > > +		pr_err("gdlm_unlock %x,%llx err=%d\n",
> > > >  		       gl->gl_name.ln_type,
> > > >  		       (unsigned long long)gl->gl_name.ln_number, error);
> > > >  		return;
> > > > diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
> > > > index 9dcb977..8606e5e 100644
> > > > --- a/fs/gfs2/log.c
> > > > +++ b/fs/gfs2/log.c
> > > > @@ -690,12 +690,12 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
> > > >  	}
> > > >  
> > > >  	if (sdp->sd_log_num_buf != sdp->sd_log_commited_buf) {
> > > > -		printk(KERN_INFO "GFS2: log buf %u %u\n", sdp->sd_log_num_buf,
> > > > +		pr_info("GFS2: log buf %u %u\n", sdp->sd_log_num_buf,
> > > >  		       sdp->sd_log_commited_buf);
> > > >  		gfs2_assert_withdraw(sdp, 0);
> > > >  	}
> > > >  	if (sdp->sd_log_num_databuf != sdp->sd_log_commited_databuf) {
> > > > -		printk(KERN_INFO "GFS2: log databuf %u %u\n",
> > > > +		pr_info("GFS2: log databuf %u %u\n",
> > > >  		       sdp->sd_log_num_databuf, sdp->sd_log_commited_databuf);
> > > >  		gfs2_assert_withdraw(sdp, 0);
> > > >  	}
> > > > diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> > > > index c6872d0..6db84b7 100644
> > > > --- a/fs/gfs2/ops_fstype.c
> > > > +++ b/fs/gfs2/ops_fstype.c
> > > > @@ -154,7 +154,7 @@ static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)
> > > >  	if (sb->sb_magic != GFS2_MAGIC ||
> > > >  	    sb->sb_type != GFS2_METATYPE_SB) {
> > > >  		if (!silent)
> > > > -			printk(KERN_WARNING "GFS2: not a GFS2 filesystem\n");
> > > > +			pr_warn("GFS2: not a GFS2 filesystem\n");
> > > >  		return -EINVAL;
> > > >  	}
> > > >  
> > > > @@ -176,7 +176,7 @@ static void end_bio_io_page(struct bio *bio, int error)
> > > >  	if (!error)
> > > >  		SetPageUptodate(page);
> > > >  	else
> > > > -		printk(KERN_WARNING "gfs2: error %d reading superblock\n", error);
> > > > +		pr_warn("gfs2: error %d reading superblock\n", error);
> > > >  	unlock_page(page);
> > > >  }
> > > >  
> > > > @@ -555,7 +555,7 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
> > > >  		rc = gfs2_block_map(jd->jd_inode, lb, &bh, 0);
> > > >  		db = bh.b_blocknr;
> > > >  		if (rc || !db) {
> > > > -			printk(KERN_INFO "GFS2 journal mapping error %d: lb="
> > > > +			pr_info("GFS2 journal mapping error %d: lb="
> > > >  			       "%u db=%llu\n", rc, lb, (unsigned long long)db);
> > > >  			break;
> > > >  		}
> > > > @@ -563,7 +563,7 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
> > > >  			jext = kzalloc(sizeof(struct gfs2_journal_extent),
> > > >  				       GFP_KERNEL);
> > > >  			if (!jext) {
> > > > -				printk(KERN_INFO "GFS2 error: out of memory "
> > > > +				pr_info("GFS2 error: out of memory "
> > > >  				       "mapping journal extents.\n");
> > > >  				rc = -ENOMEM;
> > > >  				break;
> > > > @@ -1008,7 +1008,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
> > > >  		lm = &gfs2_dlm_ops;
> > > >  #endif
> > > >  	} else {
> > > > -		printk(KERN_INFO "GFS2: can't find protocol %s\n", proto);
> > > > +		pr_info("GFS2: can't find protocol %s\n", proto);
> > > >  		return -ENOENT;
> > > >  	}
> > > >  
> > > > @@ -1115,7 +1115,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
> > > >  
> > > >  	sdp = init_sbd(sb);
> > > >  	if (!sdp) {
> > > > -		printk(KERN_WARNING "GFS2: can't alloc struct gfs2_sbd\n");
> > > > +		pr_warn("GFS2: can't alloc struct gfs2_sbd\n");
> > > >  		return -ENOMEM;
> > > >  	}
> > > >  	sdp->sd_args = *args;
> > > > @@ -1363,7 +1363,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
> > > >  
> > > >  	error = gfs2_mount_args(&args, data);
> > > >  	if (error) {
> > > > -		printk(KERN_WARNING "GFS2: can't parse mount arguments\n");
> > > > +		pr_warn("GFS2: can't parse mount arguments\n");
> > > >  		goto error_super;
> > > >  	}
> > > >  
> > > > @@ -1413,7 +1413,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
> > > >  
> > > >  	error = kern_path(dev_name, LOOKUP_FOLLOW, &path);
> > > >  	if (error) {
> > > > -		printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n",
> > > > +		pr_warn("GFS2: path_lookup on %s returned error %d\n",
> > > >  		       dev_name, error);
> > > >  		return ERR_PTR(error);
> > > >  	}
> > > > @@ -1421,7 +1421,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
> > > >  		 path.dentry->d_inode->i_sb->s_bdev);
> > > >  	path_put(&path);
> > > >  	if (IS_ERR(s)) {
> > > > -		printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n");
> > > > +		pr_warn("GFS2: gfs2 mount does not exist\n");
> > > >  		return ERR_CAST(s);
> > > >  	}
> > > >  	if ((flags ^ s->s_flags) & MS_RDONLY) {
> > > > diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
> > > > index 8bec0e31..96a592f 100644
> > > > --- a/fs/gfs2/quota.c
> > > > +++ b/fs/gfs2/quota.c
> > > > @@ -1081,7 +1081,7 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
> > > >  {
> > > >  	struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
> > > >  
> > > > -	printk(KERN_INFO "GFS2: fsid=%s: quota %s for %s %u\n",
> > > > +	pr_info("GFS2: fsid=%s: quota %s for %s %u\n",
> > > >  	       sdp->sd_fsname, type,
> > > >  	       (qd->qd_id.type == USRQUOTA) ? "user" : "group",
> > > >  	       from_kqid(&init_user_ns, qd->qd_id));
> > > > diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
> > > > index a1da213..e95cc17 100644
> > > > --- a/fs/gfs2/rgrp.c
> > > > +++ b/fs/gfs2/rgrp.c
> > > > @@ -99,11 +99,11 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
> > > >  	cur_state = (*byte1 >> bit) & GFS2_BIT_MASK;
> > > >  
> > > >  	if (unlikely(!valid_change[new_state * 4 + cur_state])) {
> > > > -		printk(KERN_WARNING "GFS2: buf_blk = 0x%x old_state=%d, "
> > > > +		pr_warn("GFS2: buf_blk = 0x%x old_state=%d, "
> > > >  		       "new_state=%d\n", rbm->offset, cur_state, new_state);
> > > > -		printk(KERN_WARNING "GFS2: rgrp=0x%llx bi_start=0x%x\n",
> > > > +		pr_warn("GFS2: rgrp=0x%llx bi_start=0x%x\n",
> > > >  		       (unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
> > > > -		printk(KERN_WARNING "GFS2: bi_offset=0x%x bi_len=0x%x\n",
> > > > +		pr_warn("GFS2: bi_offset=0x%x bi_len=0x%x\n",
> > > >  		       bi->bi_offset, bi->bi_len);
> > > >  		dump_stack();
> > > >  		gfs2_consist_rgrpd(rbm->rgd);
> > > > @@ -736,11 +736,11 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
> > > >  
> > > >  static void gfs2_rindex_print(const struct gfs2_rgrpd *rgd)
> > > >  {
> > > > -	printk(KERN_INFO "  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
> > > > -	printk(KERN_INFO "  ri_length = %u\n", rgd->rd_length);
> > > > -	printk(KERN_INFO "  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
> > > > -	printk(KERN_INFO "  ri_data = %u\n", rgd->rd_data);
> > > > -	printk(KERN_INFO "  ri_bitbytes = %u\n", rgd->rd_bitbytes);
> > > > +	pr_info("  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
> > > > +	pr_info("  ri_length = %u\n", rgd->rd_length);
> > > > +	pr_info("  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
> > > > +	pr_info("  ri_data = %u\n", rgd->rd_data);
> > > > +	pr_info("  ri_bitbytes = %u\n", rgd->rd_bitbytes);
> > > >  }
> > > >  
> > > >  /**
> > > > @@ -2278,7 +2278,7 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
> > > >  		}
> > > >  	}
> > > >  	if (rbm.rgd->rd_free < *nblocks) {
> > > > -		printk(KERN_WARNING "nblocks=%u\n", *nblocks);
> > > > +		pr_warn("nblocks=%u\n", *nblocks);
> > > >  		goto rgrp_error;
> > > >  	}
> > > >  
> > > > diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> > > > index 60f60f6..0dfe0aa 100644
> > > > --- a/fs/gfs2/super.c
> > > > +++ b/fs/gfs2/super.c
> > > > @@ -175,7 +175,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> > > >  			break;
> > > >  		case Opt_debug:
> > > >  			if (args->ar_errors == GFS2_ERRORS_PANIC) {
> > > > -				printk(KERN_WARNING "GFS2: -o debug and -o errors=panic "
> > > > +				pr_warn("GFS2: -o debug and -o errors=panic "
> > > >  				       "are mutually exclusive.\n");
> > > >  				return -EINVAL;
> > > >  			}
> > > > @@ -228,21 +228,26 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> > > >  		case Opt_commit:
> > > >  			rv = match_int(&tmp[0], &args->ar_commit);
> > > >  			if (rv || args->ar_commit <= 0) {
> > > > -				printk(KERN_WARNING "GFS2: commit mount option requires a positive numeric argument\n");
> > > > +				pr_warn("GFS2: commit mount option requires"
> > > > +					" a positive numeric argument\n");
> > > >  				return rv ? rv : -EINVAL;
> > > >  			}
> > > >  			break;
> > > >  		case Opt_statfs_quantum:
> > > >  			rv = match_int(&tmp[0], &args->ar_statfs_quantum);
> > > >  			if (rv || args->ar_statfs_quantum < 0) {
> > > > -				printk(KERN_WARNING "GFS2: statfs_quantum mount option requires a non-negative numeric argument\n");
> > > > +				pr_warn("GFS2: statfs_quantum mount option"
> > > > +					" requires a non-negative numeric"
> > > > +					" argument\n");
> > > >  				return rv ? rv : -EINVAL;
> > > >  			}
> > > >  			break;
> > > >  		case Opt_quota_quantum:
> > > >  			rv = match_int(&tmp[0], &args->ar_quota_quantum);
> > > >  			if (rv || args->ar_quota_quantum <= 0) {
> > > > -				printk(KERN_WARNING "GFS2: quota_quantum mount option requires a positive numeric argument\n");
> > > > +				pr_warn("GFS2: quota_quantum mount option"
> > > > +					" requires a positive numeric"
> > > > +					" argument\n");
> > > >  				return rv ? rv : -EINVAL;
> > > >  			}
> > > >  			break;
> > > > @@ -250,7 +255,9 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> > > >  			rv = match_int(&tmp[0], &args->ar_statfs_percent);
> > > >  			if (rv || args->ar_statfs_percent < 0 ||
> > > >  			    args->ar_statfs_percent > 100) {
> > > > -				printk(KERN_WARNING "statfs_percent mount option requires a numeric argument between 0 and 100\n");
> > > > +				pr_warn("statfs_percent mount option requires"
> > > > +					" a numeric argument between 0"
> > > > +					" and 100\n");
> > > >  				return rv ? rv : -EINVAL;
> > > >  			}
> > > >  			break;
> > > > @@ -259,7 +266,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> > > >  			break;
> > > >  		case Opt_err_panic:
> > > >  			if (args->ar_debug) {
> > > > -				printk(KERN_WARNING "GFS2: -o debug and -o errors=panic "
> > > > +				pr_warn("GFS2: -o debug and -o errors=panic "
> > > >  					"are mutually exclusive.\n");
> > > >  				return -EINVAL;
> > > >  			}
> > > > @@ -279,7 +286,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> > > >  			break;
> > > >  		case Opt_error:
> > > >  		default:
> > > > -			printk(KERN_WARNING "GFS2: invalid mount option: %s\n", o);
> > > > +			pr_warn("GFS2: invalid mount option: %s\n", o);
> > > >  			return -EINVAL;
> > > >  		}
> > > >  	}
> > > > diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
> > > > index 2b20d70..f570819 100644
> > > > --- a/fs/gfs2/trans.c
> > > > +++ b/fs/gfs2/trans.c
> > > > @@ -96,11 +96,11 @@ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
> > > >  
> > > >  static void gfs2_print_trans(const struct gfs2_trans *tr)
> > > >  {
> > > > -	printk(KERN_WARNING "GFS2: Transaction created at: %pSR\n",
> > > > +	pr_warn("GFS2: Transaction created at: %pSR\n",
> > > >  	       (void *)tr->tr_ip);
> > > > -	printk(KERN_WARNING "GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n",
> > > > +	pr_warn("GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n",
> > > >  	       tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
> > > > -	printk(KERN_WARNING "GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
> > > > +	pr_warn("GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
> > > >  	       tr->tr_num_buf_new, tr->tr_num_buf_rm,
> > > >  	       tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
> > > >  	       tr->tr_num_revoke, tr->tr_num_revoke_rm);
> > > > @@ -230,7 +230,7 @@ static void meta_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
> > > >  	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
> > > >  	mh = (struct gfs2_meta_header *)bd->bd_bh->b_data;
> > > >  	if (unlikely(mh->mh_magic != cpu_to_be32(GFS2_MAGIC))) {
> > > > -		printk(KERN_ERR
> > > > +		pr_err(
> > > >  		       "Attempting to add uninitialised block to journal (inplace block=%lld)\n",
> > > >  		       (unsigned long long)bd->bd_bh->b_blocknr);
> > > >  		BUG();
> > > > diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
> > > > index f7109f6..c83765a 100644
> > > > --- a/fs/gfs2/util.c
> > > > +++ b/fs/gfs2/util.c
> > > > @@ -30,7 +30,7 @@ mempool_t *gfs2_page_pool __read_mostly;
> > > >  
> > > >  void gfs2_assert_i(struct gfs2_sbd *sdp)
> > > >  {
> > > > -	printk(KERN_EMERG "GFS2: fsid=%s: fatal assertion failed\n",
> > > > +	pr_emerg("GFS2: fsid=%s: fatal assertion failed\n",
> > > >  	       sdp->sd_fsname);
> > > >  }
> > > >  
> > > > @@ -105,11 +105,11 @@ int gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
> > > >  		return -2;
> > > >  
> > > >  	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW)
> > > > -		printk(KERN_WARNING
> > > > -		       "GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
> > > > -		       "GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
> > > > -		       sdp->sd_fsname, assertion,
> > > > -		       sdp->sd_fsname, function, file, line);
> > > > +		pr_warn("GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
> > > > +			"GFS2: fsid=%s:   function = %s, file = %s,"
> > > > +			" line = %u\n",
> > > > +			sdp->sd_fsname, assertion,
> > > > +			sdp->sd_fsname, function, file, line);
> > > >  
> > > >  	if (sdp->sd_args.ar_debug)
> > > >  		BUG();
> > > > diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
> > > > index b7ffb09..7c90b1e 100644
> > > > --- a/fs/gfs2/util.h
> > > > +++ b/fs/gfs2/util.h
> > > > @@ -14,17 +14,14 @@
> > > >  
> > > >  #include "incore.h"
> > > >  
> > > > -#define fs_printk(level, fs, fmt, arg...) \
> > > > -	printk(level "GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> > > > -
> > > >  #define fs_info(fs, fmt, arg...) \
> > > > -	fs_printk(KERN_INFO , fs , fmt , ## arg)
> > > > +	pr_info("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> > > >  
> > > >  #define fs_warn(fs, fmt, arg...) \
> > > > -	fs_printk(KERN_WARNING , fs , fmt , ## arg)
> > > > +	pr_warn("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> > > >  
> > > >  #define fs_err(fs, fmt, arg...) \
> > > > -	fs_printk(KERN_ERR, fs , fmt , ## arg)
> > > > +	pr_err("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> > > >  
> > > > 
> > > >  void gfs2_assert_i(struct gfs2_sbd *sdp);
> > > > @@ -85,7 +82,7 @@ static inline int gfs2_meta_check(struct gfs2_sbd *sdp,
> > > >  	struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data;
> > > >  	u32 magic = be32_to_cpu(mh->mh_magic);
> > > >  	if (unlikely(magic != GFS2_MAGIC)) {
> > > > -		printk(KERN_ERR "GFS2: Magic number missing at %llu\n",
> > > > +		pr_err("GFS2: Magic number missing at %llu\n",
> > > >  		       (unsigned long long)bh->b_blocknr);
> > > >  		return -EIO;
> > > >  	}
> > > 
> > > 
> 
> 

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

* Re: [PATCH 1/1] fs: gfs2: global conversion to pr_foo()
  2014-03-05 14:06 [PATCH 1/1] fs: gfs2: global conversion to pr_foo() Fabian Frederick
@ 2014-03-06 15:44 ` Steven Whitehouse
  2014-03-06  9:24   ` Fabian Frederick
  2014-03-06 17:47   ` [PATCH 1/1] fs: gfs2: global conversion to pr_foo() Joe Perches
  0 siblings, 2 replies; 14+ messages in thread
From: Steven Whitehouse @ 2014-03-06 15:44 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-kernel, akpm

Hi,

On Wed, 2014-03-05 at 22:06 +0800, Fabian Frederick wrote:
> -All printk(KERN_foo converted to pr_foo().
> -Messages updated to fit in 80 columns.
> -fs_macros converted as well.
> -fs_printk removed.
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Due to various other patches, this didn't apply directly, so I've fixed
it up by hand. I have pushed it to the -nmw tree, so please do take a
look and check that I didn't miss anything. Thanks,

Steve.

> ---
>  fs/gfs2/dir.c        |  7 ++++---
>  fs/gfs2/glock.c      | 19 ++++++++++---------
>  fs/gfs2/lock_dlm.c   |  6 +++---
>  fs/gfs2/log.c        |  4 ++--
>  fs/gfs2/ops_fstype.c | 18 +++++++++---------
>  fs/gfs2/quota.c      |  2 +-
>  fs/gfs2/rgrp.c       | 18 +++++++++---------
>  fs/gfs2/super.c      | 21 ++++++++++++++-------
>  fs/gfs2/trans.c      |  8 ++++----
>  fs/gfs2/util.c       | 12 ++++++------
>  fs/gfs2/util.h       | 11 ++++-------
>  11 files changed, 66 insertions(+), 60 deletions(-)
> 
> diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
> index fa32655..abcac94 100644
> --- a/fs/gfs2/dir.c
> +++ b/fs/gfs2/dir.c
> @@ -507,7 +507,7 @@ static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset,
>  		goto error;
>  	return 0;
>  error:
> -	printk(KERN_WARNING "gfs2_check_dirent: %s (%s)\n", msg,
> +	pr_warn("gfs2_check_dirent: %s (%s)\n", msg,
>  	       first ? "first in block" : "not first in block");
>  	return -EIO;
>  }
> @@ -531,7 +531,7 @@ static int gfs2_dirent_offset(const void *buf)
>  	}
>  	return offset;
>  wrong_type:
> -	printk(KERN_WARNING "gfs2_scan_dirent: wrong block type %u\n",
> +	pr_warn("gfs2_scan_dirent: wrong block type %u\n",
>  	       be32_to_cpu(h->mh_type));
>  	return -1;
>  }
> @@ -1006,7 +1006,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
>  	len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth));
>  	half_len = len >> 1;
>  	if (!half_len) {
> -		printk(KERN_WARNING "i_depth %u lf_depth %u index %u\n", dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
> +		pr_warn("i_depth %u lf_depth %u index %u\n", dip->i_depth,
> +			be16_to_cpu(oleaf->lf_depth), index);
>  		gfs2_consist_inode(dip);
>  		error = -EIO;
>  		goto fail_brelse;
> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> index ca0be6c..eac3d24 100644
> --- a/fs/gfs2/glock.c
> +++ b/fs/gfs2/glock.c
> @@ -468,7 +468,8 @@ retry:
>  			do_xmote(gl, gh, LM_ST_UNLOCKED);
>  			break;
>  		default: /* Everything else */
> -			printk(KERN_ERR "GFS2: wanted %u got %u\n", gl->gl_target, state);
> +			pr_err("GFS2: wanted %u got %u\n",
> +			       gl->gl_target, state);
>  			GLOCK_BUG_ON(gl, 1);
>  		}
>  		spin_unlock(&gl->gl_spin);
> @@ -542,7 +543,7 @@ __acquires(&gl->gl_spin)
>  		/* lock_dlm */
>  		ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
>  		if (ret) {
> -			printk(KERN_ERR "GFS2: lm_lock ret %d\n", ret);
> +			pr_err("GFS2: lm_lock ret %d\n", ret);
>  			GLOCK_BUG_ON(gl, 1);
>  		}
>  	} else { /* lock_nolock */
> @@ -935,7 +936,7 @@ void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...)
>  		vaf.fmt = fmt;
>  		vaf.va = &args;
>  
> -		printk(KERN_ERR " %pV", &vaf);
> +		pr_err(" %pV", &vaf);
>  	}
>  
>  	va_end(args);
> @@ -1010,13 +1011,13 @@ do_cancel:
>  	return;
>  
>  trap_recursive:
> -	printk(KERN_ERR "original: %pSR\n", (void *)gh2->gh_ip);
> -	printk(KERN_ERR "pid: %d\n", pid_nr(gh2->gh_owner_pid));
> -	printk(KERN_ERR "lock type: %d req lock state : %d\n",
> +	pr_err("original: %pSR\n", (void *)gh2->gh_ip);
> +	pr_err("pid: %d\n", pid_nr(gh2->gh_owner_pid));
> +	pr_err("lock type: %d req lock state : %d\n",
>  	       gh2->gh_gl->gl_name.ln_type, gh2->gh_state);
> -	printk(KERN_ERR "new: %pSR\n", (void *)gh->gh_ip);
> -	printk(KERN_ERR "pid: %d\n", pid_nr(gh->gh_owner_pid));
> -	printk(KERN_ERR "lock type: %d req lock state : %d\n",
> +	pr_err("new: %pSR\n", (void *)gh->gh_ip);
> +	pr_err("pid: %d\n", pid_nr(gh->gh_owner_pid));
> +	pr_err("lock type: %d req lock state : %d\n",
>  	       gh->gh_gl->gl_name.ln_type, gh->gh_state);
>  	gfs2_dump_glock(NULL, gl);
>  	BUG();
> diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
> index 2a6ba06..93a14ad 100644
> --- a/fs/gfs2/lock_dlm.c
> +++ b/fs/gfs2/lock_dlm.c
> @@ -176,7 +176,7 @@ static void gdlm_bast(void *arg, int mode)
>  		gfs2_glock_cb(gl, LM_ST_SHARED);
>  		break;
>  	default:
> -		printk(KERN_ERR "unknown bast mode %d", mode);
> +		pr_err("unknown bast mode %d", mode);
>  		BUG();
>  	}
>  }
> @@ -195,7 +195,7 @@ static int make_mode(const unsigned int lmstate)
>  	case LM_ST_SHARED:
>  		return DLM_LOCK_PR;
>  	}
> -	printk(KERN_ERR "unknown LM state %d", lmstate);
> +	pr_err("unknown LM state %d", lmstate);
>  	BUG();
>  	return -1;
>  }
> @@ -308,7 +308,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
>  	error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK,
>  			   NULL, gl);
>  	if (error) {
> -		printk(KERN_ERR "gdlm_unlock %x,%llx err=%d\n",
> +		pr_err("gdlm_unlock %x,%llx err=%d\n",
>  		       gl->gl_name.ln_type,
>  		       (unsigned long long)gl->gl_name.ln_number, error);
>  		return;
> diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
> index 9dcb977..8606e5e 100644
> --- a/fs/gfs2/log.c
> +++ b/fs/gfs2/log.c
> @@ -690,12 +690,12 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
>  	}
>  
>  	if (sdp->sd_log_num_buf != sdp->sd_log_commited_buf) {
> -		printk(KERN_INFO "GFS2: log buf %u %u\n", sdp->sd_log_num_buf,
> +		pr_info("GFS2: log buf %u %u\n", sdp->sd_log_num_buf,
>  		       sdp->sd_log_commited_buf);
>  		gfs2_assert_withdraw(sdp, 0);
>  	}
>  	if (sdp->sd_log_num_databuf != sdp->sd_log_commited_databuf) {
> -		printk(KERN_INFO "GFS2: log databuf %u %u\n",
> +		pr_info("GFS2: log databuf %u %u\n",
>  		       sdp->sd_log_num_databuf, sdp->sd_log_commited_databuf);
>  		gfs2_assert_withdraw(sdp, 0);
>  	}
> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index c6872d0..6db84b7 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -154,7 +154,7 @@ static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)
>  	if (sb->sb_magic != GFS2_MAGIC ||
>  	    sb->sb_type != GFS2_METATYPE_SB) {
>  		if (!silent)
> -			printk(KERN_WARNING "GFS2: not a GFS2 filesystem\n");
> +			pr_warn("GFS2: not a GFS2 filesystem\n");
>  		return -EINVAL;
>  	}
>  
> @@ -176,7 +176,7 @@ static void end_bio_io_page(struct bio *bio, int error)
>  	if (!error)
>  		SetPageUptodate(page);
>  	else
> -		printk(KERN_WARNING "gfs2: error %d reading superblock\n", error);
> +		pr_warn("gfs2: error %d reading superblock\n", error);
>  	unlock_page(page);
>  }
>  
> @@ -555,7 +555,7 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
>  		rc = gfs2_block_map(jd->jd_inode, lb, &bh, 0);
>  		db = bh.b_blocknr;
>  		if (rc || !db) {
> -			printk(KERN_INFO "GFS2 journal mapping error %d: lb="
> +			pr_info("GFS2 journal mapping error %d: lb="
>  			       "%u db=%llu\n", rc, lb, (unsigned long long)db);
>  			break;
>  		}
> @@ -563,7 +563,7 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
>  			jext = kzalloc(sizeof(struct gfs2_journal_extent),
>  				       GFP_KERNEL);
>  			if (!jext) {
> -				printk(KERN_INFO "GFS2 error: out of memory "
> +				pr_info("GFS2 error: out of memory "
>  				       "mapping journal extents.\n");
>  				rc = -ENOMEM;
>  				break;
> @@ -1008,7 +1008,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
>  		lm = &gfs2_dlm_ops;
>  #endif
>  	} else {
> -		printk(KERN_INFO "GFS2: can't find protocol %s\n", proto);
> +		pr_info("GFS2: can't find protocol %s\n", proto);
>  		return -ENOENT;
>  	}
>  
> @@ -1115,7 +1115,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
>  
>  	sdp = init_sbd(sb);
>  	if (!sdp) {
> -		printk(KERN_WARNING "GFS2: can't alloc struct gfs2_sbd\n");
> +		pr_warn("GFS2: can't alloc struct gfs2_sbd\n");
>  		return -ENOMEM;
>  	}
>  	sdp->sd_args = *args;
> @@ -1363,7 +1363,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
>  
>  	error = gfs2_mount_args(&args, data);
>  	if (error) {
> -		printk(KERN_WARNING "GFS2: can't parse mount arguments\n");
> +		pr_warn("GFS2: can't parse mount arguments\n");
>  		goto error_super;
>  	}
>  
> @@ -1413,7 +1413,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
>  
>  	error = kern_path(dev_name, LOOKUP_FOLLOW, &path);
>  	if (error) {
> -		printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n",
> +		pr_warn("GFS2: path_lookup on %s returned error %d\n",
>  		       dev_name, error);
>  		return ERR_PTR(error);
>  	}
> @@ -1421,7 +1421,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
>  		 path.dentry->d_inode->i_sb->s_bdev);
>  	path_put(&path);
>  	if (IS_ERR(s)) {
> -		printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n");
> +		pr_warn("GFS2: gfs2 mount does not exist\n");
>  		return ERR_CAST(s);
>  	}
>  	if ((flags ^ s->s_flags) & MS_RDONLY) {
> diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
> index 8bec0e31..96a592f 100644
> --- a/fs/gfs2/quota.c
> +++ b/fs/gfs2/quota.c
> @@ -1081,7 +1081,7 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
>  {
>  	struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
>  
> -	printk(KERN_INFO "GFS2: fsid=%s: quota %s for %s %u\n",
> +	pr_info("GFS2: fsid=%s: quota %s for %s %u\n",
>  	       sdp->sd_fsname, type,
>  	       (qd->qd_id.type == USRQUOTA) ? "user" : "group",
>  	       from_kqid(&init_user_ns, qd->qd_id));
> diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
> index a1da213..e95cc17 100644
> --- a/fs/gfs2/rgrp.c
> +++ b/fs/gfs2/rgrp.c
> @@ -99,11 +99,11 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
>  	cur_state = (*byte1 >> bit) & GFS2_BIT_MASK;
>  
>  	if (unlikely(!valid_change[new_state * 4 + cur_state])) {
> -		printk(KERN_WARNING "GFS2: buf_blk = 0x%x old_state=%d, "
> +		pr_warn("GFS2: buf_blk = 0x%x old_state=%d, "
>  		       "new_state=%d\n", rbm->offset, cur_state, new_state);
> -		printk(KERN_WARNING "GFS2: rgrp=0x%llx bi_start=0x%x\n",
> +		pr_warn("GFS2: rgrp=0x%llx bi_start=0x%x\n",
>  		       (unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
> -		printk(KERN_WARNING "GFS2: bi_offset=0x%x bi_len=0x%x\n",
> +		pr_warn("GFS2: bi_offset=0x%x bi_len=0x%x\n",
>  		       bi->bi_offset, bi->bi_len);
>  		dump_stack();
>  		gfs2_consist_rgrpd(rbm->rgd);
> @@ -736,11 +736,11 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
>  
>  static void gfs2_rindex_print(const struct gfs2_rgrpd *rgd)
>  {
> -	printk(KERN_INFO "  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
> -	printk(KERN_INFO "  ri_length = %u\n", rgd->rd_length);
> -	printk(KERN_INFO "  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
> -	printk(KERN_INFO "  ri_data = %u\n", rgd->rd_data);
> -	printk(KERN_INFO "  ri_bitbytes = %u\n", rgd->rd_bitbytes);
> +	pr_info("  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
> +	pr_info("  ri_length = %u\n", rgd->rd_length);
> +	pr_info("  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
> +	pr_info("  ri_data = %u\n", rgd->rd_data);
> +	pr_info("  ri_bitbytes = %u\n", rgd->rd_bitbytes);
>  }
>  
>  /**
> @@ -2278,7 +2278,7 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
>  		}
>  	}
>  	if (rbm.rgd->rd_free < *nblocks) {
> -		printk(KERN_WARNING "nblocks=%u\n", *nblocks);
> +		pr_warn("nblocks=%u\n", *nblocks);
>  		goto rgrp_error;
>  	}
>  
> diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> index 60f60f6..0dfe0aa 100644
> --- a/fs/gfs2/super.c
> +++ b/fs/gfs2/super.c
> @@ -175,7 +175,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
>  			break;
>  		case Opt_debug:
>  			if (args->ar_errors == GFS2_ERRORS_PANIC) {
> -				printk(KERN_WARNING "GFS2: -o debug and -o errors=panic "
> +				pr_warn("GFS2: -o debug and -o errors=panic "
>  				       "are mutually exclusive.\n");
>  				return -EINVAL;
>  			}
> @@ -228,21 +228,26 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
>  		case Opt_commit:
>  			rv = match_int(&tmp[0], &args->ar_commit);
>  			if (rv || args->ar_commit <= 0) {
> -				printk(KERN_WARNING "GFS2: commit mount option requires a positive numeric argument\n");
> +				pr_warn("GFS2: commit mount option requires"
> +					" a positive numeric argument\n");
>  				return rv ? rv : -EINVAL;
>  			}
>  			break;
>  		case Opt_statfs_quantum:
>  			rv = match_int(&tmp[0], &args->ar_statfs_quantum);
>  			if (rv || args->ar_statfs_quantum < 0) {
> -				printk(KERN_WARNING "GFS2: statfs_quantum mount option requires a non-negative numeric argument\n");
> +				pr_warn("GFS2: statfs_quantum mount option"
> +					" requires a non-negative numeric"
> +					" argument\n");
>  				return rv ? rv : -EINVAL;
>  			}
>  			break;
>  		case Opt_quota_quantum:
>  			rv = match_int(&tmp[0], &args->ar_quota_quantum);
>  			if (rv || args->ar_quota_quantum <= 0) {
> -				printk(KERN_WARNING "GFS2: quota_quantum mount option requires a positive numeric argument\n");
> +				pr_warn("GFS2: quota_quantum mount option"
> +					" requires a positive numeric"
> +					" argument\n");
>  				return rv ? rv : -EINVAL;
>  			}
>  			break;
> @@ -250,7 +255,9 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
>  			rv = match_int(&tmp[0], &args->ar_statfs_percent);
>  			if (rv || args->ar_statfs_percent < 0 ||
>  			    args->ar_statfs_percent > 100) {
> -				printk(KERN_WARNING "statfs_percent mount option requires a numeric argument between 0 and 100\n");
> +				pr_warn("statfs_percent mount option requires"
> +					" a numeric argument between 0"
> +					" and 100\n");
>  				return rv ? rv : -EINVAL;
>  			}
>  			break;
> @@ -259,7 +266,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
>  			break;
>  		case Opt_err_panic:
>  			if (args->ar_debug) {
> -				printk(KERN_WARNING "GFS2: -o debug and -o errors=panic "
> +				pr_warn("GFS2: -o debug and -o errors=panic "
>  					"are mutually exclusive.\n");
>  				return -EINVAL;
>  			}
> @@ -279,7 +286,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
>  			break;
>  		case Opt_error:
>  		default:
> -			printk(KERN_WARNING "GFS2: invalid mount option: %s\n", o);
> +			pr_warn("GFS2: invalid mount option: %s\n", o);
>  			return -EINVAL;
>  		}
>  	}
> diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
> index 2b20d70..f570819 100644
> --- a/fs/gfs2/trans.c
> +++ b/fs/gfs2/trans.c
> @@ -96,11 +96,11 @@ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
>  
>  static void gfs2_print_trans(const struct gfs2_trans *tr)
>  {
> -	printk(KERN_WARNING "GFS2: Transaction created at: %pSR\n",
> +	pr_warn("GFS2: Transaction created at: %pSR\n",
>  	       (void *)tr->tr_ip);
> -	printk(KERN_WARNING "GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n",
> +	pr_warn("GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n",
>  	       tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
> -	printk(KERN_WARNING "GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
> +	pr_warn("GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
>  	       tr->tr_num_buf_new, tr->tr_num_buf_rm,
>  	       tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
>  	       tr->tr_num_revoke, tr->tr_num_revoke_rm);
> @@ -230,7 +230,7 @@ static void meta_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
>  	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
>  	mh = (struct gfs2_meta_header *)bd->bd_bh->b_data;
>  	if (unlikely(mh->mh_magic != cpu_to_be32(GFS2_MAGIC))) {
> -		printk(KERN_ERR
> +		pr_err(
>  		       "Attempting to add uninitialised block to journal (inplace block=%lld)\n",
>  		       (unsigned long long)bd->bd_bh->b_blocknr);
>  		BUG();
> diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
> index f7109f6..c83765a 100644
> --- a/fs/gfs2/util.c
> +++ b/fs/gfs2/util.c
> @@ -30,7 +30,7 @@ mempool_t *gfs2_page_pool __read_mostly;
>  
>  void gfs2_assert_i(struct gfs2_sbd *sdp)
>  {
> -	printk(KERN_EMERG "GFS2: fsid=%s: fatal assertion failed\n",
> +	pr_emerg("GFS2: fsid=%s: fatal assertion failed\n",
>  	       sdp->sd_fsname);
>  }
>  
> @@ -105,11 +105,11 @@ int gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
>  		return -2;
>  
>  	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW)
> -		printk(KERN_WARNING
> -		       "GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
> -		       "GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
> -		       sdp->sd_fsname, assertion,
> -		       sdp->sd_fsname, function, file, line);
> +		pr_warn("GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
> +			"GFS2: fsid=%s:   function = %s, file = %s,"
> +			" line = %u\n",
> +			sdp->sd_fsname, assertion,
> +			sdp->sd_fsname, function, file, line);
>  
>  	if (sdp->sd_args.ar_debug)
>  		BUG();
> diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
> index b7ffb09..7c90b1e 100644
> --- a/fs/gfs2/util.h
> +++ b/fs/gfs2/util.h
> @@ -14,17 +14,14 @@
>  
>  #include "incore.h"
>  
> -#define fs_printk(level, fs, fmt, arg...) \
> -	printk(level "GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> -
>  #define fs_info(fs, fmt, arg...) \
> -	fs_printk(KERN_INFO , fs , fmt , ## arg)
> +	pr_info("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
>  
>  #define fs_warn(fs, fmt, arg...) \
> -	fs_printk(KERN_WARNING , fs , fmt , ## arg)
> +	pr_warn("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
>  
>  #define fs_err(fs, fmt, arg...) \
> -	fs_printk(KERN_ERR, fs , fmt , ## arg)
> +	pr_err("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
>  
> 
>  void gfs2_assert_i(struct gfs2_sbd *sdp);
> @@ -85,7 +82,7 @@ static inline int gfs2_meta_check(struct gfs2_sbd *sdp,
>  	struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data;
>  	u32 magic = be32_to_cpu(mh->mh_magic);
>  	if (unlikely(magic != GFS2_MAGIC)) {
> -		printk(KERN_ERR "GFS2: Magic number missing at %llu\n",
> +		pr_err("GFS2: Magic number missing at %llu\n",
>  		       (unsigned long long)bh->b_blocknr);
>  		return -EIO;
>  	}



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

* Re: [PATCH 1/1] fs: gfs2: global conversion to pr_foo()
  2014-03-06 15:44 ` Steven Whitehouse
  2014-03-06  9:24   ` Fabian Frederick
@ 2014-03-06 17:47   ` Joe Perches
  2014-03-06 17:59     ` Steven Whitehouse
  1 sibling, 1 reply; 14+ messages in thread
From: Joe Perches @ 2014-03-06 17:47 UTC (permalink / raw)
  To: Steven Whitehouse; +Cc: Fabian Frederick, linux-kernel, akpm

On Thu, 2014-03-06 at 15:44 +0000, Steven Whitehouse wrote:
> On Wed, 2014-03-05 at 22:06 +0800, Fabian Frederick wrote:
> > -All printk(KERN_foo converted to pr_foo().
> > -Messages updated to fit in 80 columns.
> > -fs_macros converted as well.
> > -fs_printk removed.
> > 
> > Signed-off-by: Fabian Frederick <fabf@skynet.be>
> 
> Due to various other patches, this didn't apply directly, so I've fixed
> it up by hand. I have pushed it to the -nmw tree, so please do take a
> look and check that I didn't miss anything. Thanks,

Fabian's patch had a few more changes.

The biggest benefit to pr_<level> is automatic
prefixing with pr_fmt().

That wasn't done by Fabian's patch.

There were also printks that didn't have any
"GFS2: " prefix at all.

Here's a proposal on top of what's applied.

This adds pr_fmt, converts the rest of the printks,
removes the embedded "GFS2: " prefixes, and
standardizes on "gfs2: " as the prefix.

It also does a few conversions of embedded function
names to "%s: ", __func__

Dunno if that "GFS2:" -> "gfs2: " is a good thing,
but at least it's consistent.

unsigned...
---
 fs/gfs2/dir.c        | 14 ++++++++------
 fs/gfs2/glock.c      | 20 +++++++++++---------
 fs/gfs2/lock_dlm.c   |  9 ++++++---
 fs/gfs2/main.c       |  4 +++-
 fs/gfs2/ops_fstype.c | 25 +++++++++++++------------
 fs/gfs2/quota.c      | 10 ++++++----
 fs/gfs2/rgrp.c       | 24 +++++++++++++-----------
 fs/gfs2/super.c      | 16 ++++++++--------
 fs/gfs2/sys.c        |  2 ++
 fs/gfs2/trans.c      | 19 ++++++++++---------
 fs/gfs2/util.c       | 13 ++++++-------
 fs/gfs2/util.h       | 25 ++++++++++++-------------
 12 files changed, 98 insertions(+), 83 deletions(-)

diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 39c7081..1a349f9 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -53,6 +53,8 @@
  * but never before the maximum hash table size has been reached.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/buffer_head.h>
@@ -507,8 +509,8 @@ static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset,
 		goto error;
 	return 0;
 error:
-	pr_warn("gfs2_check_dirent: %s (%s)\n", msg,
-	       first ? "first in block" : "not first in block");
+	pr_warn("%s: %s (%s)\n",
+		__func__, msg, first ? "first in block" : "not first in block");
 	return -EIO;
 }
 
@@ -531,8 +533,7 @@ static int gfs2_dirent_offset(const void *buf)
 	}
 	return offset;
 wrong_type:
-	pr_warn("gfs2_scan_dirent: wrong block type %u\n",
-	        be32_to_cpu(h->mh_type));
+	pr_warn("%s: wrong block type %u\n", __func__, be32_to_cpu(h->mh_type));
 	return -1;
 }
 
@@ -728,7 +729,7 @@ static int get_leaf(struct gfs2_inode *dip, u64 leaf_no,
 
 	error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_WAIT, bhp);
 	if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) {
-		/* printk(KERN_INFO "block num=%llu\n", leaf_no); */
+		/* pr_info("block num=%llu\n", leaf_no); */
 		error = -EIO;
 	}
 
@@ -1006,7 +1007,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
 	len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth));
 	half_len = len >> 1;
 	if (!half_len) {
-		pr_warn("i_depth %u lf_depth %u index %u\n", dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
+		pr_warn("i_depth %u lf_depth %u index %u\n",
+			dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
 		gfs2_consist_inode(dip);
 		error = -EIO;
 		goto fail_brelse;
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index ca0be6c..52f7478 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -468,7 +470,7 @@ retry:
 			do_xmote(gl, gh, LM_ST_UNLOCKED);
 			break;
 		default: /* Everything else */
-			printk(KERN_ERR "GFS2: wanted %u got %u\n", gl->gl_target, state);
+			pr_err("wanted %u got %u\n", gl->gl_target, state);
 			GLOCK_BUG_ON(gl, 1);
 		}
 		spin_unlock(&gl->gl_spin);
@@ -542,7 +544,7 @@ __acquires(&gl->gl_spin)
 		/* lock_dlm */
 		ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
 		if (ret) {
-			printk(KERN_ERR "GFS2: lm_lock ret %d\n", ret);
+			pr_err("lm_lock ret %d\n", ret);
 			GLOCK_BUG_ON(gl, 1);
 		}
 	} else { /* lock_nolock */
@@ -935,7 +937,7 @@ void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...)
 		vaf.fmt = fmt;
 		vaf.va = &args;
 
-		printk(KERN_ERR " %pV", &vaf);
+		pr_err("%pV", &vaf);
 	}
 
 	va_end(args);
@@ -1010,13 +1012,13 @@ do_cancel:
 	return;
 
 trap_recursive:
-	printk(KERN_ERR "original: %pSR\n", (void *)gh2->gh_ip);
-	printk(KERN_ERR "pid: %d\n", pid_nr(gh2->gh_owner_pid));
-	printk(KERN_ERR "lock type: %d req lock state : %d\n",
+	pr_err("original: %pSR\n", (void *)gh2->gh_ip);
+	pr_err("pid: %d\n", pid_nr(gh2->gh_owner_pid));
+	pr_err("lock type: %d req lock state : %d\n",
 	       gh2->gh_gl->gl_name.ln_type, gh2->gh_state);
-	printk(KERN_ERR "new: %pSR\n", (void *)gh->gh_ip);
-	printk(KERN_ERR "pid: %d\n", pid_nr(gh->gh_owner_pid));
-	printk(KERN_ERR "lock type: %d req lock state : %d\n",
+	pr_err("new: %pSR\n", (void *)gh->gh_ip);
+	pr_err("pid: %d\n", pid_nr(gh->gh_owner_pid));
+	pr_err("lock type: %d req lock state : %d\n",
 	       gh->gh_gl->gl_name.ln_type, gh->gh_state);
 	gfs2_dump_glock(NULL, gl);
 	BUG();
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index a664ddd..c1eb555 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/fs.h>
 #include <linux/dlm.h>
 #include <linux/slab.h>
@@ -176,7 +178,7 @@ static void gdlm_bast(void *arg, int mode)
 		gfs2_glock_cb(gl, LM_ST_SHARED);
 		break;
 	default:
-		pr_err("unknown bast mode %d", mode);
+		pr_err("unknown bast mode %d\n", mode);
 		BUG();
 	}
 }
@@ -195,7 +197,7 @@ static int make_mode(const unsigned int lmstate)
 	case LM_ST_SHARED:
 		return DLM_LOCK_PR;
 	}
-	pr_err("unknown LM state %d", lmstate);
+	pr_err("unknown LM state %d\n", lmstate);
 	BUG();
 	return -1;
 }
@@ -308,7 +310,8 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
 	error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK,
 			   NULL, gl);
 	if (error) {
-		pr_err("gdlm_unlock %x,%llx err=%d\n", gl->gl_name.ln_type,
+		pr_err("gdlm_unlock %x,%llx err=%d\n",
+		       gl->gl_name.ln_type,
 		       (unsigned long long)gl->gl_name.ln_number, error);
 		return;
 	}
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index c272e73..82b6ac8 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
@@ -165,7 +167,7 @@ static int __init init_gfs2_fs(void)
 
 	gfs2_register_debugfs();
 
-	printk("GFS2 installed\n");
+	pr_info("GFS2 installed\n");
 
 	return 0;
 
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 247ceef..ff78932 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -152,7 +154,7 @@ static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)
 	if (sb->sb_magic != GFS2_MAGIC ||
 	    sb->sb_type != GFS2_METATYPE_SB) {
 		if (!silent)
-			pr_warn("GFS2: not a GFS2 filesystem\n");
+			pr_warn("not a GFS2 filesystem\n");
 		return -EINVAL;
 	}
 
@@ -174,7 +176,7 @@ static void end_bio_io_page(struct bio *bio, int error)
 	if (!error)
 		SetPageUptodate(page);
 	else
-		pr_warn("gfs2: error %d reading superblock\n", error);
+		pr_warn("error %d reading superblock\n", error);
 	unlock_page(page);
 }
 
@@ -553,16 +555,15 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
 		rc = gfs2_block_map(jd->jd_inode, lb, &bh, 0);
 		db = bh.b_blocknr;
 		if (rc || !db) {
-			printk(KERN_INFO "GFS2 journal mapping error %d: lb="
-			       "%u db=%llu\n", rc, lb, (unsigned long long)db);
+			pr_info("journal mapping error %d: lb=%u db=%llu\n",
+				rc, lb, (unsigned long long)db);
 			break;
 		}
 		if (!prev_db || db != prev_db + 1) {
 			jext = kzalloc(sizeof(struct gfs2_journal_extent),
 				       GFP_KERNEL);
 			if (!jext) {
-				printk(KERN_INFO "GFS2 error: out of memory "
-				       "mapping journal extents.\n");
+				pr_info("out of memory mapping journal extents\n");
 				rc = -ENOMEM;
 				break;
 			}
@@ -1006,7 +1007,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
 		lm = &gfs2_dlm_ops;
 #endif
 	} else {
-		pr_info("GFS2: can't find protocol %s\n", proto);
+		pr_info("can't find protocol %s\n", proto);
 		return -ENOENT;
 	}
 
@@ -1113,7 +1114,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
 
 	sdp = init_sbd(sb);
 	if (!sdp) {
-		pr_warn("GFS2: can't alloc struct gfs2_sbd\n");
+		pr_warn("can't alloc struct gfs2_sbd\n");
 		return -ENOMEM;
 	}
 	sdp->sd_args = *args;
@@ -1361,7 +1362,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
 
 	error = gfs2_mount_args(&args, data);
 	if (error) {
-		pr_warn("GFS2: can't parse mount arguments\n");
+		pr_warn("can't parse mount arguments\n");
 		goto error_super;
 	}
 
@@ -1411,15 +1412,15 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
 
 	error = kern_path(dev_name, LOOKUP_FOLLOW, &path);
 	if (error) {
-		pr_warn("GFS2: path_lookup on %s returned error %d\n",
-		       dev_name, error);
+		pr_warn("path_lookup on %s returned error %d\n",
+			dev_name, error);
 		return ERR_PTR(error);
 	}
 	s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags,
 		 path.dentry->d_inode->i_sb->s_bdev);
 	path_put(&path);
 	if (IS_ERR(s)) {
-		pr_warn("GFS2: gfs2 mount does not exist\n");
+		pr_warn("gfs2 mount does not exist\n");
 		return ERR_CAST(s);
 	}
 	if ((flags ^ s->s_flags) & MS_RDONLY) {
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index a5cccf6..73ed925 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -36,6 +36,8 @@
  * the quota file, so it is not being constantly read.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
@@ -1081,10 +1083,10 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
 {
 	struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
 
-	printk(KERN_INFO "GFS2: fsid=%s: quota %s for %s %u\n",
-	       sdp->sd_fsname, type,
-	       (qd->qd_id.type == USRQUOTA) ? "user" : "group",
-	       from_kqid(&init_user_ns, qd->qd_id));
+	pr_info("fsid=%s: quota %s for %s %u\n",
+		sdp->sd_fsname, type,
+		(qd->qd_id.type == USRQUOTA) ? "user" : "group",
+		from_kqid(&init_user_ns, qd->qd_id));
 
 	return 0;
 }
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index f72c74d..281a771 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
@@ -99,12 +101,12 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
 	cur_state = (*byte1 >> bit) & GFS2_BIT_MASK;
 
 	if (unlikely(!valid_change[new_state * 4 + cur_state])) {
-		pr_warn("GFS2: buf_blk = 0x%x old_state=%d, "
-		       "new_state=%d\n", rbm->offset, cur_state, new_state);
-		pr_warn("GFS2: rgrp=0x%llx bi_start=0x%x\n",
-		       (unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
-		pr_warn("GFS2: bi_offset=0x%x bi_len=0x%x\n",
-		       bi->bi_offset, bi->bi_len);
+		pr_warn("buf_blk = 0x%x old_state=%d, new_state=%d\n",
+			rbm->offset, cur_state, new_state);
+		pr_warn("rgrp=0x%llx bi_start=0x%x\n",
+			(unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
+		pr_warn("bi_offset=0x%x bi_len=0x%x\n",
+			bi->bi_offset, bi->bi_len);
 		dump_stack();
 		gfs2_consist_rgrpd(rbm->rgd);
 		return;
@@ -736,11 +738,11 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
 
 static void gfs2_rindex_print(const struct gfs2_rgrpd *rgd)
 {
-	printk(KERN_INFO "  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
-	printk(KERN_INFO "  ri_length = %u\n", rgd->rd_length);
-	printk(KERN_INFO "  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
-	printk(KERN_INFO "  ri_data = %u\n", rgd->rd_data);
-	printk(KERN_INFO "  ri_bitbytes = %u\n", rgd->rd_bitbytes);
+	pr_info("ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
+	pr_info("ri_length = %u\n", rgd->rd_length);
+	pr_info("ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
+	pr_info("ri_data = %u\n", rgd->rd_data);
+	pr_info("ri_bitbytes = %u\n", rgd->rd_bitbytes);
 }
 
 /**
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index b8ca74f..39d7e30 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/bio.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
@@ -175,8 +177,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 			break;
 		case Opt_debug:
 			if (args->ar_errors == GFS2_ERRORS_PANIC) {
-				pr_warn("GFS2: -o debug and -o errors=panic "
-				       "are mutually exclusive.\n");
+				pr_warn("-o debug and -o errors=panic are mutually exclusive\n");
 				return -EINVAL;
 			}
 			args->ar_debug = 1;
@@ -228,21 +229,21 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 		case Opt_commit:
 			rv = match_int(&tmp[0], &args->ar_commit);
 			if (rv || args->ar_commit <= 0) {
-				pr_warn("GFS2: commit mount option requires a positive numeric argument\n");
+				pr_warn("commit mount option requires a positive numeric argument\n");
 				return rv ? rv : -EINVAL;
 			}
 			break;
 		case Opt_statfs_quantum:
 			rv = match_int(&tmp[0], &args->ar_statfs_quantum);
 			if (rv || args->ar_statfs_quantum < 0) {
-				pr_warn("GFS2: statfs_quantum mount option requires a non-negative numeric argument\n");
+				pr_warn("statfs_quantum mount option requires a non-negative numeric argument\n");
 				return rv ? rv : -EINVAL;
 			}
 			break;
 		case Opt_quota_quantum:
 			rv = match_int(&tmp[0], &args->ar_quota_quantum);
 			if (rv || args->ar_quota_quantum <= 0) {
-				pr_warn("GFS2: quota_quantum mount option requires a positive numeric argument\n");
+				pr_warn("quota_quantum mount option requires a positive numeric argument\n");
 				return rv ? rv : -EINVAL;
 			}
 			break;
@@ -259,8 +260,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 			break;
 		case Opt_err_panic:
 			if (args->ar_debug) {
-				pr_warn("GFS2: -o debug and -o errors=panic "
-					"are mutually exclusive.\n");
+				pr_warn("-o debug and -o errors=panic are mutually exclusive\n");
 				return -EINVAL;
 			}
 			args->ar_errors = GFS2_ERRORS_PANIC;
@@ -279,7 +279,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 			break;
 		case Opt_error:
 		default:
-			pr_warn("GFS2: invalid mount option: %s\n", o);
+			pr_warn("invalid mount option: %s\n", o);
 			return -EINVAL;
 		}
 	}
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index d09f6ed..256354c 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/sched.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 3fe8e34..bead90d 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -99,13 +101,13 @@ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
 
 static void gfs2_print_trans(const struct gfs2_trans *tr)
 {
-	pr_warn("GFS2: Transaction created at: %pSR\n", (void *)tr->tr_ip);
-	pr_warn("GFS2: blocks=%u revokes=%u reserved=%u touched=%u\n",
-	       tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
-	pr_warn("GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
-	       tr->tr_num_buf_new, tr->tr_num_buf_rm,
-	       tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
-	       tr->tr_num_revoke, tr->tr_num_revoke_rm);
+	pr_warn("Transaction created at: %pSR\n", (void *)tr->tr_ip);
+	pr_warn("blocks=%u revokes=%u reserved=%u touched=%u\n",
+		tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
+	pr_warn("Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
+		tr->tr_num_buf_new, tr->tr_num_buf_rm,
+		tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
+		tr->tr_num_revoke, tr->tr_num_revoke_rm);
 }
 
 void gfs2_trans_end(struct gfs2_sbd *sdp)
@@ -231,8 +233,7 @@ static void meta_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
 	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
 	mh = (struct gfs2_meta_header *)bd->bd_bh->b_data;
 	if (unlikely(mh->mh_magic != cpu_to_be32(GFS2_MAGIC))) {
-		pr_err("Attempting to add uninitialised block to journal "
-		       "(inplace block=%lld)\n",
+		pr_err("Attempting to add uninitialised block to journal (inplace block=%lld)\n",
 		       (unsigned long long)bd->bd_bh->b_blocknr);
 		BUG();
 	}
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index 541ecdc..02fb38d 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
@@ -30,8 +32,7 @@ mempool_t *gfs2_page_pool __read_mostly;
 
 void gfs2_assert_i(struct gfs2_sbd *sdp)
 {
-	printk(KERN_EMERG "GFS2: fsid=%s: fatal assertion failed\n",
-	       sdp->sd_fsname);
+	pr_emerg("fsid=%s: fatal assertion failed\n", sdp->sd_fsname);
 }
 
 int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
@@ -66,7 +67,7 @@ int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
 	}
 
 	if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC)
-		panic("GFS2: fsid=%s: panic requested.\n", sdp->sd_fsname);
+		panic("GFS2: fsid=%s: panic requested\n", sdp->sd_fsname);
 
 	return -1;
 }
@@ -105,10 +106,8 @@ int gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
 		return -2;
 
 	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW)
-		pr_warn("GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
-		       "GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		       sdp->sd_fsname, assertion,
-		       sdp->sd_fsname, function, file, line);
+		pr_warn("fsid=%s: warning: assertion \"%s\" failed at function = %s, file = %s, line = %u\n",
+			sdp->sd_fsname, assertion, function, file, line);
 
 	if (sdp->sd_args.ar_debug)
 		BUG();
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
index b7ffb09..d365733 100644
--- a/fs/gfs2/util.h
+++ b/fs/gfs2/util.h
@@ -10,22 +10,21 @@
 #ifndef __UTIL_DOT_H__
 #define __UTIL_DOT_H__
 
+#ifdef pr_fmt
+#undef pr_fmt
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#endif
+
 #include <linux/mempool.h>
 
 #include "incore.h"
 
-#define fs_printk(level, fs, fmt, arg...) \
-	printk(level "GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
-
-#define fs_info(fs, fmt, arg...) \
-	fs_printk(KERN_INFO , fs , fmt , ## arg)
-
-#define fs_warn(fs, fmt, arg...) \
-	fs_printk(KERN_WARNING , fs , fmt , ## arg)
-
-#define fs_err(fs, fmt, arg...) \
-	fs_printk(KERN_ERR, fs , fmt , ## arg)
-
+#define fs_warn(fs, fmt, ...)						\
+	pr_warn("fsid=%s: " fmt, (fs)->sd_fsname, ##__VA_ARGS__)
+#define fs_err(fs, fmt, ...)						\
+	pr_err("fsid=%s: " fmt, (fs)->sd_fsname, ##__VA_ARGS__)
+#define fs_info(fs, fmt, ...)						\
+	pr_info("fsid=%s: " fmt, (fs)->sd_fsname, ##__VA_ARGS__)
 
 void gfs2_assert_i(struct gfs2_sbd *sdp);
 
@@ -85,7 +84,7 @@ static inline int gfs2_meta_check(struct gfs2_sbd *sdp,
 	struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data;
 	u32 magic = be32_to_cpu(mh->mh_magic);
 	if (unlikely(magic != GFS2_MAGIC)) {
-		printk(KERN_ERR "GFS2: Magic number missing at %llu\n",
+		pr_err("Magic number missing at %llu\n",
 		       (unsigned long long)bh->b_blocknr);
 		return -EIO;
 	}



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

* Re: [PATCH 1/1] fs: gfs2: global conversion to pr_foo()
  2014-03-06  9:24   ` Fabian Frederick
@ 2014-03-06 17:57     ` Steven Whitehouse
  2014-03-06 10:27       ` Fabian Frederick
  0 siblings, 1 reply; 14+ messages in thread
From: Steven Whitehouse @ 2014-03-06 17:57 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-kernel, akpm

Hi,

On Thu, 2014-03-06 at 17:24 +0800, Fabian Frederick wrote:
> On Thu, 06 Mar 2014 15:44:04 +0000
> Steven Whitehouse <swhiteho@redhat.com> wrote:
> 
> > Hi,
> > 
> > On Wed, 2014-03-05 at 22:06 +0800, Fabian Frederick wrote:
> > > -All printk(KERN_foo converted to pr_foo().
> > > -Messages updated to fit in 80 columns.
> > > -fs_macros converted as well.
> > > -fs_printk removed.
> > > 
> > > Signed-off-by: Fabian Frederick <fabf@skynet.be>
> > 
> > Due to various other patches, this didn't apply directly, so I've fixed
> > it up by hand. I have pushed it to the -nmw tree, so please do take a
> > look and check that I didn't miss anything. Thanks,
> > 
> > Steve.
> 
> Hi Steve,
> 
>    Maybe I'm not looking at the right place (steve/gfs2-3.0-nmw.git/) but gfs2 in that tree (with patch applied) still has 25 printk entries. Original patch just keeps 3 printk : 1 commented line, "GFS2 installed" and vprintk(fmt...
> 
> Fabian
> 
Yes, I see now... I think git didn't give me the full list of files with
rejects or something like that. Anyway I've picked up the other bits
that were missing now and I think it should now be complete,

Steve.

> 
> 
> > 
> > > ---
> > >  fs/gfs2/dir.c        |  7 ++++---
> > >  fs/gfs2/glock.c      | 19 ++++++++++---------
> > >  fs/gfs2/lock_dlm.c   |  6 +++---
> > >  fs/gfs2/log.c        |  4 ++--
> > >  fs/gfs2/ops_fstype.c | 18 +++++++++---------
> > >  fs/gfs2/quota.c      |  2 +-
> > >  fs/gfs2/rgrp.c       | 18 +++++++++---------
> > >  fs/gfs2/super.c      | 21 ++++++++++++++-------
> > >  fs/gfs2/trans.c      |  8 ++++----
> > >  fs/gfs2/util.c       | 12 ++++++------
> > >  fs/gfs2/util.h       | 11 ++++-------
> > >  11 files changed, 66 insertions(+), 60 deletions(-)
> > > 
> > > diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
> > > index fa32655..abcac94 100644
> > > --- a/fs/gfs2/dir.c
> > > +++ b/fs/gfs2/dir.c
> > > @@ -507,7 +507,7 @@ static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset,
> > >  		goto error;
> > >  	return 0;
> > >  error:
> > > -	printk(KERN_WARNING "gfs2_check_dirent: %s (%s)\n", msg,
> > > +	pr_warn("gfs2_check_dirent: %s (%s)\n", msg,
> > >  	       first ? "first in block" : "not first in block");
> > >  	return -EIO;
> > >  }
> > > @@ -531,7 +531,7 @@ static int gfs2_dirent_offset(const void *buf)
> > >  	}
> > >  	return offset;
> > >  wrong_type:
> > > -	printk(KERN_WARNING "gfs2_scan_dirent: wrong block type %u\n",
> > > +	pr_warn("gfs2_scan_dirent: wrong block type %u\n",
> > >  	       be32_to_cpu(h->mh_type));
> > >  	return -1;
> > >  }
> > > @@ -1006,7 +1006,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
> > >  	len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth));
> > >  	half_len = len >> 1;
> > >  	if (!half_len) {
> > > -		printk(KERN_WARNING "i_depth %u lf_depth %u index %u\n", dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
> > > +		pr_warn("i_depth %u lf_depth %u index %u\n", dip->i_depth,
> > > +			be16_to_cpu(oleaf->lf_depth), index);
> > >  		gfs2_consist_inode(dip);
> > >  		error = -EIO;
> > >  		goto fail_brelse;
> > > diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> > > index ca0be6c..eac3d24 100644
> > > --- a/fs/gfs2/glock.c
> > > +++ b/fs/gfs2/glock.c
> > > @@ -468,7 +468,8 @@ retry:
> > >  			do_xmote(gl, gh, LM_ST_UNLOCKED);
> > >  			break;
> > >  		default: /* Everything else */
> > > -			printk(KERN_ERR "GFS2: wanted %u got %u\n", gl->gl_target, state);
> > > +			pr_err("GFS2: wanted %u got %u\n",
> > > +			       gl->gl_target, state);
> > >  			GLOCK_BUG_ON(gl, 1);
> > >  		}
> > >  		spin_unlock(&gl->gl_spin);
> > > @@ -542,7 +543,7 @@ __acquires(&gl->gl_spin)
> > >  		/* lock_dlm */
> > >  		ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
> > >  		if (ret) {
> > > -			printk(KERN_ERR "GFS2: lm_lock ret %d\n", ret);
> > > +			pr_err("GFS2: lm_lock ret %d\n", ret);
> > >  			GLOCK_BUG_ON(gl, 1);
> > >  		}
> > >  	} else { /* lock_nolock */
> > > @@ -935,7 +936,7 @@ void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...)
> > >  		vaf.fmt = fmt;
> > >  		vaf.va = &args;
> > >  
> > > -		printk(KERN_ERR " %pV", &vaf);
> > > +		pr_err(" %pV", &vaf);
> > >  	}
> > >  
> > >  	va_end(args);
> > > @@ -1010,13 +1011,13 @@ do_cancel:
> > >  	return;
> > >  
> > >  trap_recursive:
> > > -	printk(KERN_ERR "original: %pSR\n", (void *)gh2->gh_ip);
> > > -	printk(KERN_ERR "pid: %d\n", pid_nr(gh2->gh_owner_pid));
> > > -	printk(KERN_ERR "lock type: %d req lock state : %d\n",
> > > +	pr_err("original: %pSR\n", (void *)gh2->gh_ip);
> > > +	pr_err("pid: %d\n", pid_nr(gh2->gh_owner_pid));
> > > +	pr_err("lock type: %d req lock state : %d\n",
> > >  	       gh2->gh_gl->gl_name.ln_type, gh2->gh_state);
> > > -	printk(KERN_ERR "new: %pSR\n", (void *)gh->gh_ip);
> > > -	printk(KERN_ERR "pid: %d\n", pid_nr(gh->gh_owner_pid));
> > > -	printk(KERN_ERR "lock type: %d req lock state : %d\n",
> > > +	pr_err("new: %pSR\n", (void *)gh->gh_ip);
> > > +	pr_err("pid: %d\n", pid_nr(gh->gh_owner_pid));
> > > +	pr_err("lock type: %d req lock state : %d\n",
> > >  	       gh->gh_gl->gl_name.ln_type, gh->gh_state);
> > >  	gfs2_dump_glock(NULL, gl);
> > >  	BUG();
> > > diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
> > > index 2a6ba06..93a14ad 100644
> > > --- a/fs/gfs2/lock_dlm.c
> > > +++ b/fs/gfs2/lock_dlm.c
> > > @@ -176,7 +176,7 @@ static void gdlm_bast(void *arg, int mode)
> > >  		gfs2_glock_cb(gl, LM_ST_SHARED);
> > >  		break;
> > >  	default:
> > > -		printk(KERN_ERR "unknown bast mode %d", mode);
> > > +		pr_err("unknown bast mode %d", mode);
> > >  		BUG();
> > >  	}
> > >  }
> > > @@ -195,7 +195,7 @@ static int make_mode(const unsigned int lmstate)
> > >  	case LM_ST_SHARED:
> > >  		return DLM_LOCK_PR;
> > >  	}
> > > -	printk(KERN_ERR "unknown LM state %d", lmstate);
> > > +	pr_err("unknown LM state %d", lmstate);
> > >  	BUG();
> > >  	return -1;
> > >  }
> > > @@ -308,7 +308,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
> > >  	error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK,
> > >  			   NULL, gl);
> > >  	if (error) {
> > > -		printk(KERN_ERR "gdlm_unlock %x,%llx err=%d\n",
> > > +		pr_err("gdlm_unlock %x,%llx err=%d\n",
> > >  		       gl->gl_name.ln_type,
> > >  		       (unsigned long long)gl->gl_name.ln_number, error);
> > >  		return;
> > > diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
> > > index 9dcb977..8606e5e 100644
> > > --- a/fs/gfs2/log.c
> > > +++ b/fs/gfs2/log.c
> > > @@ -690,12 +690,12 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
> > >  	}
> > >  
> > >  	if (sdp->sd_log_num_buf != sdp->sd_log_commited_buf) {
> > > -		printk(KERN_INFO "GFS2: log buf %u %u\n", sdp->sd_log_num_buf,
> > > +		pr_info("GFS2: log buf %u %u\n", sdp->sd_log_num_buf,
> > >  		       sdp->sd_log_commited_buf);
> > >  		gfs2_assert_withdraw(sdp, 0);
> > >  	}
> > >  	if (sdp->sd_log_num_databuf != sdp->sd_log_commited_databuf) {
> > > -		printk(KERN_INFO "GFS2: log databuf %u %u\n",
> > > +		pr_info("GFS2: log databuf %u %u\n",
> > >  		       sdp->sd_log_num_databuf, sdp->sd_log_commited_databuf);
> > >  		gfs2_assert_withdraw(sdp, 0);
> > >  	}
> > > diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> > > index c6872d0..6db84b7 100644
> > > --- a/fs/gfs2/ops_fstype.c
> > > +++ b/fs/gfs2/ops_fstype.c
> > > @@ -154,7 +154,7 @@ static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)
> > >  	if (sb->sb_magic != GFS2_MAGIC ||
> > >  	    sb->sb_type != GFS2_METATYPE_SB) {
> > >  		if (!silent)
> > > -			printk(KERN_WARNING "GFS2: not a GFS2 filesystem\n");
> > > +			pr_warn("GFS2: not a GFS2 filesystem\n");
> > >  		return -EINVAL;
> > >  	}
> > >  
> > > @@ -176,7 +176,7 @@ static void end_bio_io_page(struct bio *bio, int error)
> > >  	if (!error)
> > >  		SetPageUptodate(page);
> > >  	else
> > > -		printk(KERN_WARNING "gfs2: error %d reading superblock\n", error);
> > > +		pr_warn("gfs2: error %d reading superblock\n", error);
> > >  	unlock_page(page);
> > >  }
> > >  
> > > @@ -555,7 +555,7 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
> > >  		rc = gfs2_block_map(jd->jd_inode, lb, &bh, 0);
> > >  		db = bh.b_blocknr;
> > >  		if (rc || !db) {
> > > -			printk(KERN_INFO "GFS2 journal mapping error %d: lb="
> > > +			pr_info("GFS2 journal mapping error %d: lb="
> > >  			       "%u db=%llu\n", rc, lb, (unsigned long long)db);
> > >  			break;
> > >  		}
> > > @@ -563,7 +563,7 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
> > >  			jext = kzalloc(sizeof(struct gfs2_journal_extent),
> > >  				       GFP_KERNEL);
> > >  			if (!jext) {
> > > -				printk(KERN_INFO "GFS2 error: out of memory "
> > > +				pr_info("GFS2 error: out of memory "
> > >  				       "mapping journal extents.\n");
> > >  				rc = -ENOMEM;
> > >  				break;
> > > @@ -1008,7 +1008,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
> > >  		lm = &gfs2_dlm_ops;
> > >  #endif
> > >  	} else {
> > > -		printk(KERN_INFO "GFS2: can't find protocol %s\n", proto);
> > > +		pr_info("GFS2: can't find protocol %s\n", proto);
> > >  		return -ENOENT;
> > >  	}
> > >  
> > > @@ -1115,7 +1115,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
> > >  
> > >  	sdp = init_sbd(sb);
> > >  	if (!sdp) {
> > > -		printk(KERN_WARNING "GFS2: can't alloc struct gfs2_sbd\n");
> > > +		pr_warn("GFS2: can't alloc struct gfs2_sbd\n");
> > >  		return -ENOMEM;
> > >  	}
> > >  	sdp->sd_args = *args;
> > > @@ -1363,7 +1363,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
> > >  
> > >  	error = gfs2_mount_args(&args, data);
> > >  	if (error) {
> > > -		printk(KERN_WARNING "GFS2: can't parse mount arguments\n");
> > > +		pr_warn("GFS2: can't parse mount arguments\n");
> > >  		goto error_super;
> > >  	}
> > >  
> > > @@ -1413,7 +1413,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
> > >  
> > >  	error = kern_path(dev_name, LOOKUP_FOLLOW, &path);
> > >  	if (error) {
> > > -		printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n",
> > > +		pr_warn("GFS2: path_lookup on %s returned error %d\n",
> > >  		       dev_name, error);
> > >  		return ERR_PTR(error);
> > >  	}
> > > @@ -1421,7 +1421,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
> > >  		 path.dentry->d_inode->i_sb->s_bdev);
> > >  	path_put(&path);
> > >  	if (IS_ERR(s)) {
> > > -		printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n");
> > > +		pr_warn("GFS2: gfs2 mount does not exist\n");
> > >  		return ERR_CAST(s);
> > >  	}
> > >  	if ((flags ^ s->s_flags) & MS_RDONLY) {
> > > diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
> > > index 8bec0e31..96a592f 100644
> > > --- a/fs/gfs2/quota.c
> > > +++ b/fs/gfs2/quota.c
> > > @@ -1081,7 +1081,7 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
> > >  {
> > >  	struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
> > >  
> > > -	printk(KERN_INFO "GFS2: fsid=%s: quota %s for %s %u\n",
> > > +	pr_info("GFS2: fsid=%s: quota %s for %s %u\n",
> > >  	       sdp->sd_fsname, type,
> > >  	       (qd->qd_id.type == USRQUOTA) ? "user" : "group",
> > >  	       from_kqid(&init_user_ns, qd->qd_id));
> > > diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
> > > index a1da213..e95cc17 100644
> > > --- a/fs/gfs2/rgrp.c
> > > +++ b/fs/gfs2/rgrp.c
> > > @@ -99,11 +99,11 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
> > >  	cur_state = (*byte1 >> bit) & GFS2_BIT_MASK;
> > >  
> > >  	if (unlikely(!valid_change[new_state * 4 + cur_state])) {
> > > -		printk(KERN_WARNING "GFS2: buf_blk = 0x%x old_state=%d, "
> > > +		pr_warn("GFS2: buf_blk = 0x%x old_state=%d, "
> > >  		       "new_state=%d\n", rbm->offset, cur_state, new_state);
> > > -		printk(KERN_WARNING "GFS2: rgrp=0x%llx bi_start=0x%x\n",
> > > +		pr_warn("GFS2: rgrp=0x%llx bi_start=0x%x\n",
> > >  		       (unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
> > > -		printk(KERN_WARNING "GFS2: bi_offset=0x%x bi_len=0x%x\n",
> > > +		pr_warn("GFS2: bi_offset=0x%x bi_len=0x%x\n",
> > >  		       bi->bi_offset, bi->bi_len);
> > >  		dump_stack();
> > >  		gfs2_consist_rgrpd(rbm->rgd);
> > > @@ -736,11 +736,11 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
> > >  
> > >  static void gfs2_rindex_print(const struct gfs2_rgrpd *rgd)
> > >  {
> > > -	printk(KERN_INFO "  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
> > > -	printk(KERN_INFO "  ri_length = %u\n", rgd->rd_length);
> > > -	printk(KERN_INFO "  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
> > > -	printk(KERN_INFO "  ri_data = %u\n", rgd->rd_data);
> > > -	printk(KERN_INFO "  ri_bitbytes = %u\n", rgd->rd_bitbytes);
> > > +	pr_info("  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
> > > +	pr_info("  ri_length = %u\n", rgd->rd_length);
> > > +	pr_info("  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
> > > +	pr_info("  ri_data = %u\n", rgd->rd_data);
> > > +	pr_info("  ri_bitbytes = %u\n", rgd->rd_bitbytes);
> > >  }
> > >  
> > >  /**
> > > @@ -2278,7 +2278,7 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
> > >  		}
> > >  	}
> > >  	if (rbm.rgd->rd_free < *nblocks) {
> > > -		printk(KERN_WARNING "nblocks=%u\n", *nblocks);
> > > +		pr_warn("nblocks=%u\n", *nblocks);
> > >  		goto rgrp_error;
> > >  	}
> > >  
> > > diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> > > index 60f60f6..0dfe0aa 100644
> > > --- a/fs/gfs2/super.c
> > > +++ b/fs/gfs2/super.c
> > > @@ -175,7 +175,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> > >  			break;
> > >  		case Opt_debug:
> > >  			if (args->ar_errors == GFS2_ERRORS_PANIC) {
> > > -				printk(KERN_WARNING "GFS2: -o debug and -o errors=panic "
> > > +				pr_warn("GFS2: -o debug and -o errors=panic "
> > >  				       "are mutually exclusive.\n");
> > >  				return -EINVAL;
> > >  			}
> > > @@ -228,21 +228,26 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> > >  		case Opt_commit:
> > >  			rv = match_int(&tmp[0], &args->ar_commit);
> > >  			if (rv || args->ar_commit <= 0) {
> > > -				printk(KERN_WARNING "GFS2: commit mount option requires a positive numeric argument\n");
> > > +				pr_warn("GFS2: commit mount option requires"
> > > +					" a positive numeric argument\n");
> > >  				return rv ? rv : -EINVAL;
> > >  			}
> > >  			break;
> > >  		case Opt_statfs_quantum:
> > >  			rv = match_int(&tmp[0], &args->ar_statfs_quantum);
> > >  			if (rv || args->ar_statfs_quantum < 0) {
> > > -				printk(KERN_WARNING "GFS2: statfs_quantum mount option requires a non-negative numeric argument\n");
> > > +				pr_warn("GFS2: statfs_quantum mount option"
> > > +					" requires a non-negative numeric"
> > > +					" argument\n");
> > >  				return rv ? rv : -EINVAL;
> > >  			}
> > >  			break;
> > >  		case Opt_quota_quantum:
> > >  			rv = match_int(&tmp[0], &args->ar_quota_quantum);
> > >  			if (rv || args->ar_quota_quantum <= 0) {
> > > -				printk(KERN_WARNING "GFS2: quota_quantum mount option requires a positive numeric argument\n");
> > > +				pr_warn("GFS2: quota_quantum mount option"
> > > +					" requires a positive numeric"
> > > +					" argument\n");
> > >  				return rv ? rv : -EINVAL;
> > >  			}
> > >  			break;
> > > @@ -250,7 +255,9 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> > >  			rv = match_int(&tmp[0], &args->ar_statfs_percent);
> > >  			if (rv || args->ar_statfs_percent < 0 ||
> > >  			    args->ar_statfs_percent > 100) {
> > > -				printk(KERN_WARNING "statfs_percent mount option requires a numeric argument between 0 and 100\n");
> > > +				pr_warn("statfs_percent mount option requires"
> > > +					" a numeric argument between 0"
> > > +					" and 100\n");
> > >  				return rv ? rv : -EINVAL;
> > >  			}
> > >  			break;
> > > @@ -259,7 +266,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> > >  			break;
> > >  		case Opt_err_panic:
> > >  			if (args->ar_debug) {
> > > -				printk(KERN_WARNING "GFS2: -o debug and -o errors=panic "
> > > +				pr_warn("GFS2: -o debug and -o errors=panic "
> > >  					"are mutually exclusive.\n");
> > >  				return -EINVAL;
> > >  			}
> > > @@ -279,7 +286,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
> > >  			break;
> > >  		case Opt_error:
> > >  		default:
> > > -			printk(KERN_WARNING "GFS2: invalid mount option: %s\n", o);
> > > +			pr_warn("GFS2: invalid mount option: %s\n", o);
> > >  			return -EINVAL;
> > >  		}
> > >  	}
> > > diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
> > > index 2b20d70..f570819 100644
> > > --- a/fs/gfs2/trans.c
> > > +++ b/fs/gfs2/trans.c
> > > @@ -96,11 +96,11 @@ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
> > >  
> > >  static void gfs2_print_trans(const struct gfs2_trans *tr)
> > >  {
> > > -	printk(KERN_WARNING "GFS2: Transaction created at: %pSR\n",
> > > +	pr_warn("GFS2: Transaction created at: %pSR\n",
> > >  	       (void *)tr->tr_ip);
> > > -	printk(KERN_WARNING "GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n",
> > > +	pr_warn("GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n",
> > >  	       tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
> > > -	printk(KERN_WARNING "GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
> > > +	pr_warn("GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
> > >  	       tr->tr_num_buf_new, tr->tr_num_buf_rm,
> > >  	       tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
> > >  	       tr->tr_num_revoke, tr->tr_num_revoke_rm);
> > > @@ -230,7 +230,7 @@ static void meta_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
> > >  	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
> > >  	mh = (struct gfs2_meta_header *)bd->bd_bh->b_data;
> > >  	if (unlikely(mh->mh_magic != cpu_to_be32(GFS2_MAGIC))) {
> > > -		printk(KERN_ERR
> > > +		pr_err(
> > >  		       "Attempting to add uninitialised block to journal (inplace block=%lld)\n",
> > >  		       (unsigned long long)bd->bd_bh->b_blocknr);
> > >  		BUG();
> > > diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
> > > index f7109f6..c83765a 100644
> > > --- a/fs/gfs2/util.c
> > > +++ b/fs/gfs2/util.c
> > > @@ -30,7 +30,7 @@ mempool_t *gfs2_page_pool __read_mostly;
> > >  
> > >  void gfs2_assert_i(struct gfs2_sbd *sdp)
> > >  {
> > > -	printk(KERN_EMERG "GFS2: fsid=%s: fatal assertion failed\n",
> > > +	pr_emerg("GFS2: fsid=%s: fatal assertion failed\n",
> > >  	       sdp->sd_fsname);
> > >  }
> > >  
> > > @@ -105,11 +105,11 @@ int gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
> > >  		return -2;
> > >  
> > >  	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW)
> > > -		printk(KERN_WARNING
> > > -		       "GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
> > > -		       "GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
> > > -		       sdp->sd_fsname, assertion,
> > > -		       sdp->sd_fsname, function, file, line);
> > > +		pr_warn("GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
> > > +			"GFS2: fsid=%s:   function = %s, file = %s,"
> > > +			" line = %u\n",
> > > +			sdp->sd_fsname, assertion,
> > > +			sdp->sd_fsname, function, file, line);
> > >  
> > >  	if (sdp->sd_args.ar_debug)
> > >  		BUG();
> > > diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
> > > index b7ffb09..7c90b1e 100644
> > > --- a/fs/gfs2/util.h
> > > +++ b/fs/gfs2/util.h
> > > @@ -14,17 +14,14 @@
> > >  
> > >  #include "incore.h"
> > >  
> > > -#define fs_printk(level, fs, fmt, arg...) \
> > > -	printk(level "GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> > > -
> > >  #define fs_info(fs, fmt, arg...) \
> > > -	fs_printk(KERN_INFO , fs , fmt , ## arg)
> > > +	pr_info("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> > >  
> > >  #define fs_warn(fs, fmt, arg...) \
> > > -	fs_printk(KERN_WARNING , fs , fmt , ## arg)
> > > +	pr_warn("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> > >  
> > >  #define fs_err(fs, fmt, arg...) \
> > > -	fs_printk(KERN_ERR, fs , fmt , ## arg)
> > > +	pr_err("GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> > >  
> > > 
> > >  void gfs2_assert_i(struct gfs2_sbd *sdp);
> > > @@ -85,7 +82,7 @@ static inline int gfs2_meta_check(struct gfs2_sbd *sdp,
> > >  	struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data;
> > >  	u32 magic = be32_to_cpu(mh->mh_magic);
> > >  	if (unlikely(magic != GFS2_MAGIC)) {
> > > -		printk(KERN_ERR "GFS2: Magic number missing at %llu\n",
> > > +		pr_err("GFS2: Magic number missing at %llu\n",
> > >  		       (unsigned long long)bh->b_blocknr);
> > >  		return -EIO;
> > >  	}
> > 
> > 



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

* Re: [PATCH 1/1] fs: gfs2: global conversion to pr_foo()
  2014-03-06 17:47   ` [PATCH 1/1] fs: gfs2: global conversion to pr_foo() Joe Perches
@ 2014-03-06 17:59     ` Steven Whitehouse
  2014-03-06 18:32       ` Joe Perches
  0 siblings, 1 reply; 14+ messages in thread
From: Steven Whitehouse @ 2014-03-06 17:59 UTC (permalink / raw)
  To: Joe Perches; +Cc: Fabian Frederick, linux-kernel, akpm

Hi,

On Thu, 2014-03-06 at 09:47 -0800, Joe Perches wrote:
> On Thu, 2014-03-06 at 15:44 +0000, Steven Whitehouse wrote:
> > On Wed, 2014-03-05 at 22:06 +0800, Fabian Frederick wrote:
> > > -All printk(KERN_foo converted to pr_foo().
> > > -Messages updated to fit in 80 columns.
> > > -fs_macros converted as well.
> > > -fs_printk removed.
> > > 
> > > Signed-off-by: Fabian Frederick <fabf@skynet.be>
> > 
> > Due to various other patches, this didn't apply directly, so I've fixed
> > it up by hand. I have pushed it to the -nmw tree, so please do take a
> > look and check that I didn't miss anything. Thanks,
> 
> Fabian's patch had a few more changes.
> 
> The biggest benefit to pr_<level> is automatic
> prefixing with pr_fmt().
> 
> That wasn't done by Fabian's patch.
> 
> There were also printks that didn't have any
> "GFS2: " prefix at all.
> 

Ok, I think I've got all of Fabian's patch now. Can you send me an
updated patch that I can put into my tree based on top of whats in the
-nmw tree now? Otherwise I think things will be a bit too confusing,

Steve.

> Here's a proposal on top of what's applied.
> 
> This adds pr_fmt, converts the rest of the printks,
> removes the embedded "GFS2: " prefixes, and
> standardizes on "gfs2: " as the prefix.
> 
> It also does a few conversions of embedded function
> names to "%s: ", __func__
> 
> Dunno if that "GFS2:" -> "gfs2: " is a good thing,
> but at least it's consistent.
> 
> unsigned...
> ---
>  fs/gfs2/dir.c        | 14 ++++++++------
>  fs/gfs2/glock.c      | 20 +++++++++++---------
>  fs/gfs2/lock_dlm.c   |  9 ++++++---
>  fs/gfs2/main.c       |  4 +++-
>  fs/gfs2/ops_fstype.c | 25 +++++++++++++------------
>  fs/gfs2/quota.c      | 10 ++++++----
>  fs/gfs2/rgrp.c       | 24 +++++++++++++-----------
>  fs/gfs2/super.c      | 16 ++++++++--------
>  fs/gfs2/sys.c        |  2 ++
>  fs/gfs2/trans.c      | 19 ++++++++++---------
>  fs/gfs2/util.c       | 13 ++++++-------
>  fs/gfs2/util.h       | 25 ++++++++++++-------------
>  12 files changed, 98 insertions(+), 83 deletions(-)
> 
> diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
> index 39c7081..1a349f9 100644
> --- a/fs/gfs2/dir.c
> +++ b/fs/gfs2/dir.c
> @@ -53,6 +53,8 @@
>   * but never before the maximum hash table size has been reached.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
>  #include <linux/buffer_head.h>
> @@ -507,8 +509,8 @@ static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset,
>  		goto error;
>  	return 0;
>  error:
> -	pr_warn("gfs2_check_dirent: %s (%s)\n", msg,
> -	       first ? "first in block" : "not first in block");
> +	pr_warn("%s: %s (%s)\n",
> +		__func__, msg, first ? "first in block" : "not first in block");
>  	return -EIO;
>  }
>  
> @@ -531,8 +533,7 @@ static int gfs2_dirent_offset(const void *buf)
>  	}
>  	return offset;
>  wrong_type:
> -	pr_warn("gfs2_scan_dirent: wrong block type %u\n",
> -	        be32_to_cpu(h->mh_type));
> +	pr_warn("%s: wrong block type %u\n", __func__, be32_to_cpu(h->mh_type));
>  	return -1;
>  }
>  
> @@ -728,7 +729,7 @@ static int get_leaf(struct gfs2_inode *dip, u64 leaf_no,
>  
>  	error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_WAIT, bhp);
>  	if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) {
> -		/* printk(KERN_INFO "block num=%llu\n", leaf_no); */
> +		/* pr_info("block num=%llu\n", leaf_no); */
>  		error = -EIO;
>  	}
>  
> @@ -1006,7 +1007,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
>  	len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth));
>  	half_len = len >> 1;
>  	if (!half_len) {
> -		pr_warn("i_depth %u lf_depth %u index %u\n", dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
> +		pr_warn("i_depth %u lf_depth %u index %u\n",
> +			dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
>  		gfs2_consist_inode(dip);
>  		error = -EIO;
>  		goto fail_brelse;
> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> index ca0be6c..52f7478 100644
> --- a/fs/gfs2/glock.c
> +++ b/fs/gfs2/glock.c
> @@ -7,6 +7,8 @@
>   * of the GNU General Public License version 2.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/sched.h>
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
> @@ -468,7 +470,7 @@ retry:
>  			do_xmote(gl, gh, LM_ST_UNLOCKED);
>  			break;
>  		default: /* Everything else */
> -			printk(KERN_ERR "GFS2: wanted %u got %u\n", gl->gl_target, state);
> +			pr_err("wanted %u got %u\n", gl->gl_target, state);
>  			GLOCK_BUG_ON(gl, 1);
>  		}
>  		spin_unlock(&gl->gl_spin);
> @@ -542,7 +544,7 @@ __acquires(&gl->gl_spin)
>  		/* lock_dlm */
>  		ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
>  		if (ret) {
> -			printk(KERN_ERR "GFS2: lm_lock ret %d\n", ret);
> +			pr_err("lm_lock ret %d\n", ret);
>  			GLOCK_BUG_ON(gl, 1);
>  		}
>  	} else { /* lock_nolock */
> @@ -935,7 +937,7 @@ void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...)
>  		vaf.fmt = fmt;
>  		vaf.va = &args;
>  
> -		printk(KERN_ERR " %pV", &vaf);
> +		pr_err("%pV", &vaf);
>  	}
>  
>  	va_end(args);
> @@ -1010,13 +1012,13 @@ do_cancel:
>  	return;
>  
>  trap_recursive:
> -	printk(KERN_ERR "original: %pSR\n", (void *)gh2->gh_ip);
> -	printk(KERN_ERR "pid: %d\n", pid_nr(gh2->gh_owner_pid));
> -	printk(KERN_ERR "lock type: %d req lock state : %d\n",
> +	pr_err("original: %pSR\n", (void *)gh2->gh_ip);
> +	pr_err("pid: %d\n", pid_nr(gh2->gh_owner_pid));
> +	pr_err("lock type: %d req lock state : %d\n",
>  	       gh2->gh_gl->gl_name.ln_type, gh2->gh_state);
> -	printk(KERN_ERR "new: %pSR\n", (void *)gh->gh_ip);
> -	printk(KERN_ERR "pid: %d\n", pid_nr(gh->gh_owner_pid));
> -	printk(KERN_ERR "lock type: %d req lock state : %d\n",
> +	pr_err("new: %pSR\n", (void *)gh->gh_ip);
> +	pr_err("pid: %d\n", pid_nr(gh->gh_owner_pid));
> +	pr_err("lock type: %d req lock state : %d\n",
>  	       gh->gh_gl->gl_name.ln_type, gh->gh_state);
>  	gfs2_dump_glock(NULL, gl);
>  	BUG();
> diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
> index a664ddd..c1eb555 100644
> --- a/fs/gfs2/lock_dlm.c
> +++ b/fs/gfs2/lock_dlm.c
> @@ -7,6 +7,8 @@
>   * of the GNU General Public License version 2.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/fs.h>
>  #include <linux/dlm.h>
>  #include <linux/slab.h>
> @@ -176,7 +178,7 @@ static void gdlm_bast(void *arg, int mode)
>  		gfs2_glock_cb(gl, LM_ST_SHARED);
>  		break;
>  	default:
> -		pr_err("unknown bast mode %d", mode);
> +		pr_err("unknown bast mode %d\n", mode);
>  		BUG();
>  	}
>  }
> @@ -195,7 +197,7 @@ static int make_mode(const unsigned int lmstate)
>  	case LM_ST_SHARED:
>  		return DLM_LOCK_PR;
>  	}
> -	pr_err("unknown LM state %d", lmstate);
> +	pr_err("unknown LM state %d\n", lmstate);
>  	BUG();
>  	return -1;
>  }
> @@ -308,7 +310,8 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
>  	error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK,
>  			   NULL, gl);
>  	if (error) {
> -		pr_err("gdlm_unlock %x,%llx err=%d\n", gl->gl_name.ln_type,
> +		pr_err("gdlm_unlock %x,%llx err=%d\n",
> +		       gl->gl_name.ln_type,
>  		       (unsigned long long)gl->gl_name.ln_number, error);
>  		return;
>  	}
> diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
> index c272e73..82b6ac8 100644
> --- a/fs/gfs2/main.c
> +++ b/fs/gfs2/main.c
> @@ -7,6 +7,8 @@
>   * of the GNU General Public License version 2.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
>  #include <linux/completion.h>
> @@ -165,7 +167,7 @@ static int __init init_gfs2_fs(void)
>  
>  	gfs2_register_debugfs();
>  
> -	printk("GFS2 installed\n");
> +	pr_info("GFS2 installed\n");
>  
>  	return 0;
>  
> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index 247ceef..ff78932 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -7,6 +7,8 @@
>   * of the GNU General Public License version 2.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/sched.h>
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
> @@ -152,7 +154,7 @@ static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)
>  	if (sb->sb_magic != GFS2_MAGIC ||
>  	    sb->sb_type != GFS2_METATYPE_SB) {
>  		if (!silent)
> -			pr_warn("GFS2: not a GFS2 filesystem\n");
> +			pr_warn("not a GFS2 filesystem\n");
>  		return -EINVAL;
>  	}
>  
> @@ -174,7 +176,7 @@ static void end_bio_io_page(struct bio *bio, int error)
>  	if (!error)
>  		SetPageUptodate(page);
>  	else
> -		pr_warn("gfs2: error %d reading superblock\n", error);
> +		pr_warn("error %d reading superblock\n", error);
>  	unlock_page(page);
>  }
>  
> @@ -553,16 +555,15 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
>  		rc = gfs2_block_map(jd->jd_inode, lb, &bh, 0);
>  		db = bh.b_blocknr;
>  		if (rc || !db) {
> -			printk(KERN_INFO "GFS2 journal mapping error %d: lb="
> -			       "%u db=%llu\n", rc, lb, (unsigned long long)db);
> +			pr_info("journal mapping error %d: lb=%u db=%llu\n",
> +				rc, lb, (unsigned long long)db);
>  			break;
>  		}
>  		if (!prev_db || db != prev_db + 1) {
>  			jext = kzalloc(sizeof(struct gfs2_journal_extent),
>  				       GFP_KERNEL);
>  			if (!jext) {
> -				printk(KERN_INFO "GFS2 error: out of memory "
> -				       "mapping journal extents.\n");
> +				pr_info("out of memory mapping journal extents\n");
>  				rc = -ENOMEM;
>  				break;
>  			}
> @@ -1006,7 +1007,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
>  		lm = &gfs2_dlm_ops;
>  #endif
>  	} else {
> -		pr_info("GFS2: can't find protocol %s\n", proto);
> +		pr_info("can't find protocol %s\n", proto);
>  		return -ENOENT;
>  	}
>  
> @@ -1113,7 +1114,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
>  
>  	sdp = init_sbd(sb);
>  	if (!sdp) {
> -		pr_warn("GFS2: can't alloc struct gfs2_sbd\n");
> +		pr_warn("can't alloc struct gfs2_sbd\n");
>  		return -ENOMEM;
>  	}
>  	sdp->sd_args = *args;
> @@ -1361,7 +1362,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
>  
>  	error = gfs2_mount_args(&args, data);
>  	if (error) {
> -		pr_warn("GFS2: can't parse mount arguments\n");
> +		pr_warn("can't parse mount arguments\n");
>  		goto error_super;
>  	}
>  
> @@ -1411,15 +1412,15 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
>  
>  	error = kern_path(dev_name, LOOKUP_FOLLOW, &path);
>  	if (error) {
> -		pr_warn("GFS2: path_lookup on %s returned error %d\n",
> -		       dev_name, error);
> +		pr_warn("path_lookup on %s returned error %d\n",
> +			dev_name, error);
>  		return ERR_PTR(error);
>  	}
>  	s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags,
>  		 path.dentry->d_inode->i_sb->s_bdev);
>  	path_put(&path);
>  	if (IS_ERR(s)) {
> -		pr_warn("GFS2: gfs2 mount does not exist\n");
> +		pr_warn("gfs2 mount does not exist\n");
>  		return ERR_CAST(s);
>  	}
>  	if ((flags ^ s->s_flags) & MS_RDONLY) {
> diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
> index a5cccf6..73ed925 100644
> --- a/fs/gfs2/quota.c
> +++ b/fs/gfs2/quota.c
> @@ -36,6 +36,8 @@
>   * the quota file, so it is not being constantly read.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/sched.h>
>  #include <linux/slab.h>
>  #include <linux/mm.h>
> @@ -1081,10 +1083,10 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
>  {
>  	struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
>  
> -	printk(KERN_INFO "GFS2: fsid=%s: quota %s for %s %u\n",
> -	       sdp->sd_fsname, type,
> -	       (qd->qd_id.type == USRQUOTA) ? "user" : "group",
> -	       from_kqid(&init_user_ns, qd->qd_id));
> +	pr_info("fsid=%s: quota %s for %s %u\n",
> +		sdp->sd_fsname, type,
> +		(qd->qd_id.type == USRQUOTA) ? "user" : "group",
> +		from_kqid(&init_user_ns, qd->qd_id));
>  
>  	return 0;
>  }
> diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
> index f72c74d..281a771 100644
> --- a/fs/gfs2/rgrp.c
> +++ b/fs/gfs2/rgrp.c
> @@ -7,6 +7,8 @@
>   * of the GNU General Public License version 2.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
>  #include <linux/completion.h>
> @@ -99,12 +101,12 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
>  	cur_state = (*byte1 >> bit) & GFS2_BIT_MASK;
>  
>  	if (unlikely(!valid_change[new_state * 4 + cur_state])) {
> -		pr_warn("GFS2: buf_blk = 0x%x old_state=%d, "
> -		       "new_state=%d\n", rbm->offset, cur_state, new_state);
> -		pr_warn("GFS2: rgrp=0x%llx bi_start=0x%x\n",
> -		       (unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
> -		pr_warn("GFS2: bi_offset=0x%x bi_len=0x%x\n",
> -		       bi->bi_offset, bi->bi_len);
> +		pr_warn("buf_blk = 0x%x old_state=%d, new_state=%d\n",
> +			rbm->offset, cur_state, new_state);
> +		pr_warn("rgrp=0x%llx bi_start=0x%x\n",
> +			(unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
> +		pr_warn("bi_offset=0x%x bi_len=0x%x\n",
> +			bi->bi_offset, bi->bi_len);
>  		dump_stack();
>  		gfs2_consist_rgrpd(rbm->rgd);
>  		return;
> @@ -736,11 +738,11 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
>  
>  static void gfs2_rindex_print(const struct gfs2_rgrpd *rgd)
>  {
> -	printk(KERN_INFO "  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
> -	printk(KERN_INFO "  ri_length = %u\n", rgd->rd_length);
> -	printk(KERN_INFO "  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
> -	printk(KERN_INFO "  ri_data = %u\n", rgd->rd_data);
> -	printk(KERN_INFO "  ri_bitbytes = %u\n", rgd->rd_bitbytes);
> +	pr_info("ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
> +	pr_info("ri_length = %u\n", rgd->rd_length);
> +	pr_info("ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
> +	pr_info("ri_data = %u\n", rgd->rd_data);
> +	pr_info("ri_bitbytes = %u\n", rgd->rd_bitbytes);
>  }
>  
>  /**
> diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> index b8ca74f..39d7e30 100644
> --- a/fs/gfs2/super.c
> +++ b/fs/gfs2/super.c
> @@ -7,6 +7,8 @@
>   * of the GNU General Public License version 2.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/bio.h>
>  #include <linux/sched.h>
>  #include <linux/slab.h>
> @@ -175,8 +177,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
>  			break;
>  		case Opt_debug:
>  			if (args->ar_errors == GFS2_ERRORS_PANIC) {
> -				pr_warn("GFS2: -o debug and -o errors=panic "
> -				       "are mutually exclusive.\n");
> +				pr_warn("-o debug and -o errors=panic are mutually exclusive\n");
>  				return -EINVAL;
>  			}
>  			args->ar_debug = 1;
> @@ -228,21 +229,21 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
>  		case Opt_commit:
>  			rv = match_int(&tmp[0], &args->ar_commit);
>  			if (rv || args->ar_commit <= 0) {
> -				pr_warn("GFS2: commit mount option requires a positive numeric argument\n");
> +				pr_warn("commit mount option requires a positive numeric argument\n");
>  				return rv ? rv : -EINVAL;
>  			}
>  			break;
>  		case Opt_statfs_quantum:
>  			rv = match_int(&tmp[0], &args->ar_statfs_quantum);
>  			if (rv || args->ar_statfs_quantum < 0) {
> -				pr_warn("GFS2: statfs_quantum mount option requires a non-negative numeric argument\n");
> +				pr_warn("statfs_quantum mount option requires a non-negative numeric argument\n");
>  				return rv ? rv : -EINVAL;
>  			}
>  			break;
>  		case Opt_quota_quantum:
>  			rv = match_int(&tmp[0], &args->ar_quota_quantum);
>  			if (rv || args->ar_quota_quantum <= 0) {
> -				pr_warn("GFS2: quota_quantum mount option requires a positive numeric argument\n");
> +				pr_warn("quota_quantum mount option requires a positive numeric argument\n");
>  				return rv ? rv : -EINVAL;
>  			}
>  			break;
> @@ -259,8 +260,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
>  			break;
>  		case Opt_err_panic:
>  			if (args->ar_debug) {
> -				pr_warn("GFS2: -o debug and -o errors=panic "
> -					"are mutually exclusive.\n");
> +				pr_warn("-o debug and -o errors=panic are mutually exclusive\n");
>  				return -EINVAL;
>  			}
>  			args->ar_errors = GFS2_ERRORS_PANIC;
> @@ -279,7 +279,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
>  			break;
>  		case Opt_error:
>  		default:
> -			pr_warn("GFS2: invalid mount option: %s\n", o);
> +			pr_warn("invalid mount option: %s\n", o);
>  			return -EINVAL;
>  		}
>  	}
> diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
> index d09f6ed..256354c 100644
> --- a/fs/gfs2/sys.c
> +++ b/fs/gfs2/sys.c
> @@ -7,6 +7,8 @@
>   * of the GNU General Public License version 2.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/sched.h>
>  #include <linux/spinlock.h>
>  #include <linux/completion.h>
> diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
> index 3fe8e34..bead90d 100644
> --- a/fs/gfs2/trans.c
> +++ b/fs/gfs2/trans.c
> @@ -7,6 +7,8 @@
>   * of the GNU General Public License version 2.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/sched.h>
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
> @@ -99,13 +101,13 @@ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
>  
>  static void gfs2_print_trans(const struct gfs2_trans *tr)
>  {
> -	pr_warn("GFS2: Transaction created at: %pSR\n", (void *)tr->tr_ip);
> -	pr_warn("GFS2: blocks=%u revokes=%u reserved=%u touched=%u\n",
> -	       tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
> -	pr_warn("GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
> -	       tr->tr_num_buf_new, tr->tr_num_buf_rm,
> -	       tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
> -	       tr->tr_num_revoke, tr->tr_num_revoke_rm);
> +	pr_warn("Transaction created at: %pSR\n", (void *)tr->tr_ip);
> +	pr_warn("blocks=%u revokes=%u reserved=%u touched=%u\n",
> +		tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
> +	pr_warn("Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
> +		tr->tr_num_buf_new, tr->tr_num_buf_rm,
> +		tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
> +		tr->tr_num_revoke, tr->tr_num_revoke_rm);
>  }
>  
>  void gfs2_trans_end(struct gfs2_sbd *sdp)
> @@ -231,8 +233,7 @@ static void meta_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
>  	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
>  	mh = (struct gfs2_meta_header *)bd->bd_bh->b_data;
>  	if (unlikely(mh->mh_magic != cpu_to_be32(GFS2_MAGIC))) {
> -		pr_err("Attempting to add uninitialised block to journal "
> -		       "(inplace block=%lld)\n",
> +		pr_err("Attempting to add uninitialised block to journal (inplace block=%lld)\n",
>  		       (unsigned long long)bd->bd_bh->b_blocknr);
>  		BUG();
>  	}
> diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
> index 541ecdc..02fb38d 100644
> --- a/fs/gfs2/util.c
> +++ b/fs/gfs2/util.c
> @@ -7,6 +7,8 @@
>   * of the GNU General Public License version 2.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/spinlock.h>
>  #include <linux/completion.h>
>  #include <linux/buffer_head.h>
> @@ -30,8 +32,7 @@ mempool_t *gfs2_page_pool __read_mostly;
>  
>  void gfs2_assert_i(struct gfs2_sbd *sdp)
>  {
> -	printk(KERN_EMERG "GFS2: fsid=%s: fatal assertion failed\n",
> -	       sdp->sd_fsname);
> +	pr_emerg("fsid=%s: fatal assertion failed\n", sdp->sd_fsname);
>  }
>  
>  int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
> @@ -66,7 +67,7 @@ int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
>  	}
>  
>  	if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC)
> -		panic("GFS2: fsid=%s: panic requested.\n", sdp->sd_fsname);
> +		panic("GFS2: fsid=%s: panic requested\n", sdp->sd_fsname);
>  
>  	return -1;
>  }
> @@ -105,10 +106,8 @@ int gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
>  		return -2;
>  
>  	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW)
> -		pr_warn("GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
> -		       "GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
> -		       sdp->sd_fsname, assertion,
> -		       sdp->sd_fsname, function, file, line);
> +		pr_warn("fsid=%s: warning: assertion \"%s\" failed at function = %s, file = %s, line = %u\n",
> +			sdp->sd_fsname, assertion, function, file, line);
>  
>  	if (sdp->sd_args.ar_debug)
>  		BUG();
> diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
> index b7ffb09..d365733 100644
> --- a/fs/gfs2/util.h
> +++ b/fs/gfs2/util.h
> @@ -10,22 +10,21 @@
>  #ifndef __UTIL_DOT_H__
>  #define __UTIL_DOT_H__
>  
> +#ifdef pr_fmt
> +#undef pr_fmt
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +#endif
> +
>  #include <linux/mempool.h>
>  
>  #include "incore.h"
>  
> -#define fs_printk(level, fs, fmt, arg...) \
> -	printk(level "GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
> -
> -#define fs_info(fs, fmt, arg...) \
> -	fs_printk(KERN_INFO , fs , fmt , ## arg)
> -
> -#define fs_warn(fs, fmt, arg...) \
> -	fs_printk(KERN_WARNING , fs , fmt , ## arg)
> -
> -#define fs_err(fs, fmt, arg...) \
> -	fs_printk(KERN_ERR, fs , fmt , ## arg)
> -
> +#define fs_warn(fs, fmt, ...)						\
> +	pr_warn("fsid=%s: " fmt, (fs)->sd_fsname, ##__VA_ARGS__)
> +#define fs_err(fs, fmt, ...)						\
> +	pr_err("fsid=%s: " fmt, (fs)->sd_fsname, ##__VA_ARGS__)
> +#define fs_info(fs, fmt, ...)						\
> +	pr_info("fsid=%s: " fmt, (fs)->sd_fsname, ##__VA_ARGS__)
>  
>  void gfs2_assert_i(struct gfs2_sbd *sdp);
>  
> @@ -85,7 +84,7 @@ static inline int gfs2_meta_check(struct gfs2_sbd *sdp,
>  	struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data;
>  	u32 magic = be32_to_cpu(mh->mh_magic);
>  	if (unlikely(magic != GFS2_MAGIC)) {
> -		printk(KERN_ERR "GFS2: Magic number missing at %llu\n",
> +		pr_err("Magic number missing at %llu\n",
>  		       (unsigned long long)bh->b_blocknr);
>  		return -EIO;
>  	}
> 
> 



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

* Re: [PATCH 1/1] fs: gfs2: global conversion to pr_foo()
  2014-03-06 17:59     ` Steven Whitehouse
@ 2014-03-06 18:32       ` Joe Perches
  0 siblings, 0 replies; 14+ messages in thread
From: Joe Perches @ 2014-03-06 18:32 UTC (permalink / raw)
  To: Steven Whitehouse; +Cc: Fabian Frederick, linux-kernel, akpm

On Thu, 2014-03-06 at 17:59 +0000, Steven Whitehouse wrote:
> Ok, I think I've got all of Fabian's patch now. Can you send me an
> updated patch that I can put into my tree based on top of whats in the
> -nmw tree now? Otherwise I think things will be a bit too confusing,

No worries, but maybe you need to push the change?
As far as I can tell, what's there now is the same.



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

* [PATCH 0/3] gfs: More logging neatening
  2014-03-06 10:27       ` Fabian Frederick
@ 2014-03-06 20:10         ` Joe Perches
  2014-03-06 20:10           ` [PATCH 1/3] gfs2: Use pr_<level> more consistently Joe Perches
                             ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Joe Perches @ 2014-03-06 20:10 UTC (permalink / raw)
  To: Steven Whitehouse
  Cc: Fabian Frederick, linux-kernel, Andrew Morton, cluster-devel

Joe Perches (3):
  gfs2: Use pr_<level> more consistently
  gfs2: Use fs_<level> more often
  gfs2: Convert gfs2_lm_withdraw to use fs_err

 fs/gfs2/dir.c        | 14 ++++----
 fs/gfs2/glock.c      |  8 +++--
 fs/gfs2/lock_dlm.c   |  9 +++--
 fs/gfs2/main.c       |  2 ++
 fs/gfs2/ops_fstype.c | 25 ++++++-------
 fs/gfs2/quota.c      | 10 +++---
 fs/gfs2/rgrp.c       | 24 +++++++------
 fs/gfs2/super.c      | 16 ++++-----
 fs/gfs2/sys.c        |  6 ++--
 fs/gfs2/trans.c      | 19 +++++-----
 fs/gfs2/util.c       | 99 +++++++++++++++++++++++++---------------------------
 fs/gfs2/util.h       | 31 ++++++++--------
 12 files changed, 138 insertions(+), 125 deletions(-)

-- 
1.8.1.2.459.gbcd45b4.dirty


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

* [PATCH 1/3] gfs2: Use pr_<level> more consistently
  2014-03-06 20:10         ` [PATCH 0/3] gfs: More logging neatening Joe Perches
@ 2014-03-06 20:10           ` Joe Perches
  2014-03-06 20:10           ` [PATCH 2/3] gfs2: Use fs_<level> more often Joe Perches
                             ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Joe Perches @ 2014-03-06 20:10 UTC (permalink / raw)
  To: Steven Whitehouse
  Cc: Fabian Frederick, linux-kernel, Andrew Morton, Steven Whitehouse,
	cluster-devel

Add pr_fmt, remove embedded "GFS2: " prefixes.
This now consistently emits lower case "gfs2: " for each message.

Other miscellanea around these changes:

o Add missing newlines
o Coalesce formats
o Realign arguments

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/gfs2/dir.c        | 14 ++++++++------
 fs/gfs2/glock.c      |  8 +++++---
 fs/gfs2/lock_dlm.c   |  9 ++++++---
 fs/gfs2/main.c       |  2 ++
 fs/gfs2/ops_fstype.c | 25 +++++++++++++------------
 fs/gfs2/quota.c      | 10 ++++++----
 fs/gfs2/rgrp.c       | 24 +++++++++++++-----------
 fs/gfs2/super.c      | 16 ++++++++--------
 fs/gfs2/sys.c        |  2 ++
 fs/gfs2/trans.c      | 19 ++++++++++---------
 fs/gfs2/util.c       | 12 ++++++------
 fs/gfs2/util.h       | 25 ++++++++++++-------------
 12 files changed, 91 insertions(+), 75 deletions(-)

diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 39c7081..1a349f9 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -53,6 +53,8 @@
  * but never before the maximum hash table size has been reached.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/buffer_head.h>
@@ -507,8 +509,8 @@ static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset,
 		goto error;
 	return 0;
 error:
-	pr_warn("gfs2_check_dirent: %s (%s)\n", msg,
-	       first ? "first in block" : "not first in block");
+	pr_warn("%s: %s (%s)\n",
+		__func__, msg, first ? "first in block" : "not first in block");
 	return -EIO;
 }
 
@@ -531,8 +533,7 @@ static int gfs2_dirent_offset(const void *buf)
 	}
 	return offset;
 wrong_type:
-	pr_warn("gfs2_scan_dirent: wrong block type %u\n",
-	        be32_to_cpu(h->mh_type));
+	pr_warn("%s: wrong block type %u\n", __func__, be32_to_cpu(h->mh_type));
 	return -1;
 }
 
@@ -728,7 +729,7 @@ static int get_leaf(struct gfs2_inode *dip, u64 leaf_no,
 
 	error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_WAIT, bhp);
 	if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) {
-		/* printk(KERN_INFO "block num=%llu\n", leaf_no); */
+		/* pr_info("block num=%llu\n", leaf_no); */
 		error = -EIO;
 	}
 
@@ -1006,7 +1007,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
 	len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth));
 	half_len = len >> 1;
 	if (!half_len) {
-		pr_warn("i_depth %u lf_depth %u index %u\n", dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
+		pr_warn("i_depth %u lf_depth %u index %u\n",
+			dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
 		gfs2_consist_inode(dip);
 		error = -EIO;
 		goto fail_brelse;
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 329dc80..52f7478 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -468,7 +470,7 @@ retry:
 			do_xmote(gl, gh, LM_ST_UNLOCKED);
 			break;
 		default: /* Everything else */
-			pr_err("GFS2: wanted %u got %u\n", gl->gl_target, state);
+			pr_err("wanted %u got %u\n", gl->gl_target, state);
 			GLOCK_BUG_ON(gl, 1);
 		}
 		spin_unlock(&gl->gl_spin);
@@ -542,7 +544,7 @@ __acquires(&gl->gl_spin)
 		/* lock_dlm */
 		ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
 		if (ret) {
-			pr_err("GFS2: lm_lock ret %d\n", ret);
+			pr_err("lm_lock ret %d\n", ret);
 			GLOCK_BUG_ON(gl, 1);
 		}
 	} else { /* lock_nolock */
@@ -935,7 +937,7 @@ void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...)
 		vaf.fmt = fmt;
 		vaf.va = &args;
 
-		pr_err(" %pV", &vaf);
+		pr_err("%pV", &vaf);
 	}
 
 	va_end(args);
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index a664ddd..c1eb555 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/fs.h>
 #include <linux/dlm.h>
 #include <linux/slab.h>
@@ -176,7 +178,7 @@ static void gdlm_bast(void *arg, int mode)
 		gfs2_glock_cb(gl, LM_ST_SHARED);
 		break;
 	default:
-		pr_err("unknown bast mode %d", mode);
+		pr_err("unknown bast mode %d\n", mode);
 		BUG();
 	}
 }
@@ -195,7 +197,7 @@ static int make_mode(const unsigned int lmstate)
 	case LM_ST_SHARED:
 		return DLM_LOCK_PR;
 	}
-	pr_err("unknown LM state %d", lmstate);
+	pr_err("unknown LM state %d\n", lmstate);
 	BUG();
 	return -1;
 }
@@ -308,7 +310,8 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
 	error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK,
 			   NULL, gl);
 	if (error) {
-		pr_err("gdlm_unlock %x,%llx err=%d\n", gl->gl_name.ln_type,
+		pr_err("gdlm_unlock %x,%llx err=%d\n",
+		       gl->gl_name.ln_type,
 		       (unsigned long long)gl->gl_name.ln_number, error);
 		return;
 	}
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index ae9b02b..82b6ac8 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 247ceef..ff78932 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -152,7 +154,7 @@ static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)
 	if (sb->sb_magic != GFS2_MAGIC ||
 	    sb->sb_type != GFS2_METATYPE_SB) {
 		if (!silent)
-			pr_warn("GFS2: not a GFS2 filesystem\n");
+			pr_warn("not a GFS2 filesystem\n");
 		return -EINVAL;
 	}
 
@@ -174,7 +176,7 @@ static void end_bio_io_page(struct bio *bio, int error)
 	if (!error)
 		SetPageUptodate(page);
 	else
-		pr_warn("gfs2: error %d reading superblock\n", error);
+		pr_warn("error %d reading superblock\n", error);
 	unlock_page(page);
 }
 
@@ -553,16 +555,15 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
 		rc = gfs2_block_map(jd->jd_inode, lb, &bh, 0);
 		db = bh.b_blocknr;
 		if (rc || !db) {
-			printk(KERN_INFO "GFS2 journal mapping error %d: lb="
-			       "%u db=%llu\n", rc, lb, (unsigned long long)db);
+			pr_info("journal mapping error %d: lb=%u db=%llu\n",
+				rc, lb, (unsigned long long)db);
 			break;
 		}
 		if (!prev_db || db != prev_db + 1) {
 			jext = kzalloc(sizeof(struct gfs2_journal_extent),
 				       GFP_KERNEL);
 			if (!jext) {
-				printk(KERN_INFO "GFS2 error: out of memory "
-				       "mapping journal extents.\n");
+				pr_info("out of memory mapping journal extents\n");
 				rc = -ENOMEM;
 				break;
 			}
@@ -1006,7 +1007,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
 		lm = &gfs2_dlm_ops;
 #endif
 	} else {
-		pr_info("GFS2: can't find protocol %s\n", proto);
+		pr_info("can't find protocol %s\n", proto);
 		return -ENOENT;
 	}
 
@@ -1113,7 +1114,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
 
 	sdp = init_sbd(sb);
 	if (!sdp) {
-		pr_warn("GFS2: can't alloc struct gfs2_sbd\n");
+		pr_warn("can't alloc struct gfs2_sbd\n");
 		return -ENOMEM;
 	}
 	sdp->sd_args = *args;
@@ -1361,7 +1362,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
 
 	error = gfs2_mount_args(&args, data);
 	if (error) {
-		pr_warn("GFS2: can't parse mount arguments\n");
+		pr_warn("can't parse mount arguments\n");
 		goto error_super;
 	}
 
@@ -1411,15 +1412,15 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
 
 	error = kern_path(dev_name, LOOKUP_FOLLOW, &path);
 	if (error) {
-		pr_warn("GFS2: path_lookup on %s returned error %d\n",
-		       dev_name, error);
+		pr_warn("path_lookup on %s returned error %d\n",
+			dev_name, error);
 		return ERR_PTR(error);
 	}
 	s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags,
 		 path.dentry->d_inode->i_sb->s_bdev);
 	path_put(&path);
 	if (IS_ERR(s)) {
-		pr_warn("GFS2: gfs2 mount does not exist\n");
+		pr_warn("gfs2 mount does not exist\n");
 		return ERR_CAST(s);
 	}
 	if ((flags ^ s->s_flags) & MS_RDONLY) {
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 6e25ee4..73ed925 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -36,6 +36,8 @@
  * the quota file, so it is not being constantly read.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
@@ -1081,10 +1083,10 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
 {
 	struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
 
-	pr_info("GFS2: fsid=%s: quota %s for %s %u\n",
-	       sdp->sd_fsname, type,
-	       (qd->qd_id.type == USRQUOTA) ? "user" : "group",
-	       from_kqid(&init_user_ns, qd->qd_id));
+	pr_info("fsid=%s: quota %s for %s %u\n",
+		sdp->sd_fsname, type,
+		(qd->qd_id.type == USRQUOTA) ? "user" : "group",
+		from_kqid(&init_user_ns, qd->qd_id));
 
 	return 0;
 }
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 8d12038..281a771 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
@@ -99,12 +101,12 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
 	cur_state = (*byte1 >> bit) & GFS2_BIT_MASK;
 
 	if (unlikely(!valid_change[new_state * 4 + cur_state])) {
-		pr_warn("GFS2: buf_blk = 0x%x old_state=%d, "
-		       "new_state=%d\n", rbm->offset, cur_state, new_state);
-		pr_warn("GFS2: rgrp=0x%llx bi_start=0x%x\n",
-		       (unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
-		pr_warn("GFS2: bi_offset=0x%x bi_len=0x%x\n",
-		       bi->bi_offset, bi->bi_len);
+		pr_warn("buf_blk = 0x%x old_state=%d, new_state=%d\n",
+			rbm->offset, cur_state, new_state);
+		pr_warn("rgrp=0x%llx bi_start=0x%x\n",
+			(unsigned long long)rbm->rgd->rd_addr, bi->bi_start);
+		pr_warn("bi_offset=0x%x bi_len=0x%x\n",
+			bi->bi_offset, bi->bi_len);
 		dump_stack();
 		gfs2_consist_rgrpd(rbm->rgd);
 		return;
@@ -736,11 +738,11 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
 
 static void gfs2_rindex_print(const struct gfs2_rgrpd *rgd)
 {
-	pr_info("  ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
-	pr_info("  ri_length = %u\n", rgd->rd_length);
-	pr_info("  ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
-	pr_info("  ri_data = %u\n", rgd->rd_data);
-	pr_info("  ri_bitbytes = %u\n", rgd->rd_bitbytes);
+	pr_info("ri_addr = %llu\n", (unsigned long long)rgd->rd_addr);
+	pr_info("ri_length = %u\n", rgd->rd_length);
+	pr_info("ri_data0 = %llu\n", (unsigned long long)rgd->rd_data0);
+	pr_info("ri_data = %u\n", rgd->rd_data);
+	pr_info("ri_bitbytes = %u\n", rgd->rd_bitbytes);
 }
 
 /**
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index b8ca74f..39d7e30 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/bio.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
@@ -175,8 +177,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 			break;
 		case Opt_debug:
 			if (args->ar_errors == GFS2_ERRORS_PANIC) {
-				pr_warn("GFS2: -o debug and -o errors=panic "
-				       "are mutually exclusive.\n");
+				pr_warn("-o debug and -o errors=panic are mutually exclusive\n");
 				return -EINVAL;
 			}
 			args->ar_debug = 1;
@@ -228,21 +229,21 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 		case Opt_commit:
 			rv = match_int(&tmp[0], &args->ar_commit);
 			if (rv || args->ar_commit <= 0) {
-				pr_warn("GFS2: commit mount option requires a positive numeric argument\n");
+				pr_warn("commit mount option requires a positive numeric argument\n");
 				return rv ? rv : -EINVAL;
 			}
 			break;
 		case Opt_statfs_quantum:
 			rv = match_int(&tmp[0], &args->ar_statfs_quantum);
 			if (rv || args->ar_statfs_quantum < 0) {
-				pr_warn("GFS2: statfs_quantum mount option requires a non-negative numeric argument\n");
+				pr_warn("statfs_quantum mount option requires a non-negative numeric argument\n");
 				return rv ? rv : -EINVAL;
 			}
 			break;
 		case Opt_quota_quantum:
 			rv = match_int(&tmp[0], &args->ar_quota_quantum);
 			if (rv || args->ar_quota_quantum <= 0) {
-				pr_warn("GFS2: quota_quantum mount option requires a positive numeric argument\n");
+				pr_warn("quota_quantum mount option requires a positive numeric argument\n");
 				return rv ? rv : -EINVAL;
 			}
 			break;
@@ -259,8 +260,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 			break;
 		case Opt_err_panic:
 			if (args->ar_debug) {
-				pr_warn("GFS2: -o debug and -o errors=panic "
-					"are mutually exclusive.\n");
+				pr_warn("-o debug and -o errors=panic are mutually exclusive\n");
 				return -EINVAL;
 			}
 			args->ar_errors = GFS2_ERRORS_PANIC;
@@ -279,7 +279,7 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
 			break;
 		case Opt_error:
 		default:
-			pr_warn("GFS2: invalid mount option: %s\n", o);
+			pr_warn("invalid mount option: %s\n", o);
 			return -EINVAL;
 		}
 	}
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index d09f6ed..256354c 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/sched.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 3fe8e34..bead90d 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -99,13 +101,13 @@ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
 
 static void gfs2_print_trans(const struct gfs2_trans *tr)
 {
-	pr_warn("GFS2: Transaction created at: %pSR\n", (void *)tr->tr_ip);
-	pr_warn("GFS2: blocks=%u revokes=%u reserved=%u touched=%u\n",
-	       tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
-	pr_warn("GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
-	       tr->tr_num_buf_new, tr->tr_num_buf_rm,
-	       tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
-	       tr->tr_num_revoke, tr->tr_num_revoke_rm);
+	pr_warn("Transaction created at: %pSR\n", (void *)tr->tr_ip);
+	pr_warn("blocks=%u revokes=%u reserved=%u touched=%u\n",
+		tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
+	pr_warn("Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
+		tr->tr_num_buf_new, tr->tr_num_buf_rm,
+		tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
+		tr->tr_num_revoke, tr->tr_num_revoke_rm);
 }
 
 void gfs2_trans_end(struct gfs2_sbd *sdp)
@@ -231,8 +233,7 @@ static void meta_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
 	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
 	mh = (struct gfs2_meta_header *)bd->bd_bh->b_data;
 	if (unlikely(mh->mh_magic != cpu_to_be32(GFS2_MAGIC))) {
-		pr_err("Attempting to add uninitialised block to journal "
-		       "(inplace block=%lld)\n",
+		pr_err("Attempting to add uninitialised block to journal (inplace block=%lld)\n",
 		       (unsigned long long)bd->bd_bh->b_blocknr);
 		BUG();
 	}
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index e9d7001..02fb38d 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -7,6 +7,8 @@
  * of the GNU General Public License version 2.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
@@ -30,7 +32,7 @@ mempool_t *gfs2_page_pool __read_mostly;
 
 void gfs2_assert_i(struct gfs2_sbd *sdp)
 {
-	pr_emerg("GFS2: fsid=%s: fatal assertion failed\n", sdp->sd_fsname);
+	pr_emerg("fsid=%s: fatal assertion failed\n", sdp->sd_fsname);
 }
 
 int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
@@ -65,7 +67,7 @@ int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
 	}
 
 	if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC)
-		panic("GFS2: fsid=%s: panic requested.\n", sdp->sd_fsname);
+		panic("GFS2: fsid=%s: panic requested\n", sdp->sd_fsname);
 
 	return -1;
 }
@@ -104,10 +106,8 @@ int gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
 		return -2;
 
 	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW)
-		pr_warn("GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
-		       "GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		       sdp->sd_fsname, assertion,
-		       sdp->sd_fsname, function, file, line);
+		pr_warn("fsid=%s: warning: assertion \"%s\" failed at function = %s, file = %s, line = %u\n",
+			sdp->sd_fsname, assertion, function, file, line);
 
 	if (sdp->sd_args.ar_debug)
 		BUG();
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
index b7ffb09..d365733 100644
--- a/fs/gfs2/util.h
+++ b/fs/gfs2/util.h
@@ -10,22 +10,21 @@
 #ifndef __UTIL_DOT_H__
 #define __UTIL_DOT_H__
 
+#ifdef pr_fmt
+#undef pr_fmt
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#endif
+
 #include <linux/mempool.h>
 
 #include "incore.h"
 
-#define fs_printk(level, fs, fmt, arg...) \
-	printk(level "GFS2: fsid=%s: " fmt , (fs)->sd_fsname , ## arg)
-
-#define fs_info(fs, fmt, arg...) \
-	fs_printk(KERN_INFO , fs , fmt , ## arg)
-
-#define fs_warn(fs, fmt, arg...) \
-	fs_printk(KERN_WARNING , fs , fmt , ## arg)
-
-#define fs_err(fs, fmt, arg...) \
-	fs_printk(KERN_ERR, fs , fmt , ## arg)
-
+#define fs_warn(fs, fmt, ...)						\
+	pr_warn("fsid=%s: " fmt, (fs)->sd_fsname, ##__VA_ARGS__)
+#define fs_err(fs, fmt, ...)						\
+	pr_err("fsid=%s: " fmt, (fs)->sd_fsname, ##__VA_ARGS__)
+#define fs_info(fs, fmt, ...)						\
+	pr_info("fsid=%s: " fmt, (fs)->sd_fsname, ##__VA_ARGS__)
 
 void gfs2_assert_i(struct gfs2_sbd *sdp);
 
@@ -85,7 +84,7 @@ static inline int gfs2_meta_check(struct gfs2_sbd *sdp,
 	struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data;
 	u32 magic = be32_to_cpu(mh->mh_magic);
 	if (unlikely(magic != GFS2_MAGIC)) {
-		printk(KERN_ERR "GFS2: Magic number missing at %llu\n",
+		pr_err("Magic number missing at %llu\n",
 		       (unsigned long long)bh->b_blocknr);
 		return -EIO;
 	}
-- 
1.8.1.2.459.gbcd45b4.dirty


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

* [PATCH 2/3] gfs2: Use fs_<level> more often
  2014-03-06 20:10         ` [PATCH 0/3] gfs: More logging neatening Joe Perches
  2014-03-06 20:10           ` [PATCH 1/3] gfs2: Use pr_<level> more consistently Joe Perches
@ 2014-03-06 20:10           ` Joe Perches
  2014-03-06 20:10           ` [PATCH 3/3] gfs2: Convert gfs2_lm_withdraw to use fs_err Joe Perches
  2014-03-07 10:08           ` [PATCH 0/3] gfs: More logging neatening Steven Whitehouse
  3 siblings, 0 replies; 14+ messages in thread
From: Joe Perches @ 2014-03-06 20:10 UTC (permalink / raw)
  To: Steven Whitehouse
  Cc: Fabian Frederick, linux-kernel, Andrew Morton, Steven Whitehouse,
	cluster-devel

Convert a couple of uses of pr_<level> to fs_<level>
Add and use fs_emerg.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/gfs2/quota.c | 4 ++--
 fs/gfs2/util.c  | 6 +++---
 fs/gfs2/util.h  | 2 ++
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 73ed925..27f9435 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1083,8 +1083,8 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
 {
 	struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
 
-	pr_info("fsid=%s: quota %s for %s %u\n",
-		sdp->sd_fsname, type,
+	fs_info(sdp, "quota %s for %s %u\n",
+		type,
 		(qd->qd_id.type == USRQUOTA) ? "user" : "group",
 		from_kqid(&init_user_ns, qd->qd_id));
 
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index 02fb38d..84bf853 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -32,7 +32,7 @@ mempool_t *gfs2_page_pool __read_mostly;
 
 void gfs2_assert_i(struct gfs2_sbd *sdp)
 {
-	pr_emerg("fsid=%s: fatal assertion failed\n", sdp->sd_fsname);
+	fs_emerg(sdp, "fatal assertion failed\n");
 }
 
 int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
@@ -106,8 +106,8 @@ int gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
 		return -2;
 
 	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW)
-		pr_warn("fsid=%s: warning: assertion \"%s\" failed at function = %s, file = %s, line = %u\n",
-			sdp->sd_fsname, assertion, function, file, line);
+		fs_warn(sdp, "warning: assertion \"%s\" failed at function = %s, file = %s, line = %u\n",
+			assertion, function, file, line);
 
 	if (sdp->sd_args.ar_debug)
 		BUG();
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
index d365733..515cce2 100644
--- a/fs/gfs2/util.h
+++ b/fs/gfs2/util.h
@@ -19,6 +19,8 @@
 
 #include "incore.h"
 
+#define fs_emerg(fs, fmt, ...)						\
+	pr_emerg("fsid=%s: " fmt, (fs)->sd_fsname, ##__VA_ARGS__)
 #define fs_warn(fs, fmt, ...)						\
 	pr_warn("fsid=%s: " fmt, (fs)->sd_fsname, ##__VA_ARGS__)
 #define fs_err(fs, fmt, ...)						\
-- 
1.8.1.2.459.gbcd45b4.dirty


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

* [PATCH 3/3] gfs2: Convert gfs2_lm_withdraw to use fs_err
  2014-03-06 20:10         ` [PATCH 0/3] gfs: More logging neatening Joe Perches
  2014-03-06 20:10           ` [PATCH 1/3] gfs2: Use pr_<level> more consistently Joe Perches
  2014-03-06 20:10           ` [PATCH 2/3] gfs2: Use fs_<level> more often Joe Perches
@ 2014-03-06 20:10           ` Joe Perches
  2014-03-06 20:17             ` [PATCH V2 " Joe Perches
  2014-03-07 10:08           ` [PATCH 0/3] gfs: More logging neatening Steven Whitehouse
  3 siblings, 1 reply; 14+ messages in thread
From: Joe Perches @ 2014-03-06 20:10 UTC (permalink / raw)
  To: Steven Whitehouse
  Cc: Fabian Frederick, linux-kernel, Andrew Morton, Steven Whitehouse,
	cluster-devel

vprintk use is not prefixed by a KERN_<LEVEL>,
so emit these messages at KERN_ERR level.

Using %pV can save some code and allow fs_err to
be used, so do it.

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/gfs2/sys.c  |  4 +--
 fs/gfs2/util.c | 87 ++++++++++++++++++++++++++++------------------------------
 fs/gfs2/util.h |  4 +--
 3 files changed, 45 insertions(+), 50 deletions(-)

diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 256354c..5403d42 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -140,9 +140,7 @@ static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
 	if (simple_strtol(buf, NULL, 0) != 1)
 		return -EINVAL;
 
-	gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: withdrawing from cluster at user's request\n",
-		sdp->sd_fsname);
+	gfs2_lm_withdraw(sdp, "withdrawing from cluster at user's request\n");
 	return len;
 }
 
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index 84bf853..5a3ef98 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -35,18 +35,24 @@ void gfs2_assert_i(struct gfs2_sbd *sdp)
 	fs_emerg(sdp, "fatal assertion failed\n");
 }
 
-int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
+int gfs2_lm_withdraw(struct gfs2_sbd *sdp, const char *fmt, ...)
 {
 	struct lm_lockstruct *ls = &sdp->sd_lockstruct;
 	const struct lm_lockops *lm = ls->ls_ops;
 	va_list args;
+	struct va_format vaf;
 
 	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW &&
 	    test_and_set_bit(SDF_SHUTDOWN, &sdp->sd_flags))
 		return 0;
 
 	va_start(args, fmt);
-	vprintk(fmt, args);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	fs_err(sdp, "%pV", &vaf);
+
 	va_end(args);
 
 	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW) {
@@ -83,10 +89,9 @@ int gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion,
 {
 	int me;
 	me = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: assertion \"%s\" failed\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname, assertion,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: assertion \"%s\" failed\n"
+			      "   function = %s, file = %s, line = %u\n",
+			      assertion, function, file, line);
 	dump_stack();
 	return (me) ? -1 : -2;
 }
@@ -136,10 +141,8 @@ int gfs2_consist_i(struct gfs2_sbd *sdp, int cluster_wide, const char *function,
 {
 	int rv;
 	rv = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: filesystem consistency error\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: filesystem consistency error - function = %s, file = %s, line = %u\n",
+			      function, file, line);
 	return rv;
 }
 
@@ -155,13 +158,12 @@ int gfs2_consist_inode_i(struct gfs2_inode *ip, int cluster_wide,
 	struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
 	int rv;
 	rv = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: filesystem consistency error\n"
-		"GFS2: fsid=%s:   inode = %llu %llu\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, (unsigned long long)ip->i_no_formal_ino,
-		(unsigned long long)ip->i_no_addr,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: filesystem consistency error\n"
+			      "  inode = %llu %llu\n"
+			      "  function = %s, file = %s, line = %u\n",
+			      (unsigned long long)ip->i_no_formal_ino,
+			      (unsigned long long)ip->i_no_addr,
+			      function, file, line);
 	return rv;
 }
 
@@ -177,12 +179,11 @@ int gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, int cluster_wide,
 	struct gfs2_sbd *sdp = rgd->rd_sbd;
 	int rv;
 	rv = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: filesystem consistency error\n"
-		"GFS2: fsid=%s:   RG = %llu\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, (unsigned long long)rgd->rd_addr,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: filesystem consistency error\n"
+			      "  RG = %llu\n"
+			      "  function = %s, file = %s, line = %u\n",
+			      (unsigned long long)rgd->rd_addr,
+			      function, file, line);
 	return rv;
 }
 
@@ -198,12 +199,11 @@ int gfs2_meta_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh,
 {
 	int me;
 	me = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: invalid metadata block\n"
-		"GFS2: fsid=%s:   bh = %llu (%s)\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, (unsigned long long)bh->b_blocknr, type,
-		sdp->sd_fsname, function, file, line);
+		"fatal: invalid metadata block\n"
+		"  bh = %llu (%s)\n"
+		"  function = %s, file = %s, line = %u\n",
+			      (unsigned long long)bh->b_blocknr, type,
+			      function, file, line);
 	return (me) ? -1 : -2;
 }
 
@@ -219,12 +219,11 @@ int gfs2_metatype_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh,
 {
 	int me;
 	me = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: invalid metadata block\n"
-		"GFS2: fsid=%s:   bh = %llu (type: exp=%u, found=%u)\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, (unsigned long long)bh->b_blocknr, type, t,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: invalid metadata block\n"
+			      "  bh = %llu (type: exp=%u, found=%u)\n"
+			      "  function = %s, file = %s, line = %u\n",
+			      (unsigned long long)bh->b_blocknr, type, t,
+			      function, file, line);
 	return (me) ? -1 : -2;
 }
 
@@ -239,10 +238,9 @@ int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function, char *file,
 {
 	int rv;
 	rv = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: I/O error\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: I/O error\n"
+			      "  function = %s, file = %s, line = %u\n",
+			      function, file, line);
 	return rv;
 }
 
@@ -257,12 +255,11 @@ int gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh,
 {
 	int rv;
 	rv = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: I/O error\n"
-		"GFS2: fsid=%s:   block = %llu\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, (unsigned long long)bh->b_blocknr,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: I/O error\n"
+			      "  block = %llu\n"
+			      "  function = %s, file = %s, line = %u\n",
+			      (unsigned long long)bh->b_blocknr,
+			      function, file, line);
 	return rv;
 }
 
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
index 515cce2..cbdcbdf 100644
--- a/fs/gfs2/util.h
+++ b/fs/gfs2/util.h
@@ -165,7 +165,7 @@ static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
 #define gfs2_tune_get(sdp, field) \
 gfs2_tune_get_i(&(sdp)->sd_tune, &(sdp)->sd_tune.field)
 
-int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...);
+__printf(2, 3)
+int gfs2_lm_withdraw(struct gfs2_sbd *sdp, const char *fmt, ...);
 
 #endif /* __UTIL_DOT_H__ */
-
-- 
1.8.1.2.459.gbcd45b4.dirty


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

* [PATCH V2 3/3] gfs2: Convert gfs2_lm_withdraw to use fs_err
  2014-03-06 20:10           ` [PATCH 3/3] gfs2: Convert gfs2_lm_withdraw to use fs_err Joe Perches
@ 2014-03-06 20:17             ` Joe Perches
  0 siblings, 0 replies; 14+ messages in thread
From: Joe Perches @ 2014-03-06 20:17 UTC (permalink / raw)
  To: Steven Whitehouse
  Cc: Fabian Frederick, linux-kernel, Andrew Morton, Steven Whitehouse,
	cluster-devel

vprintk use is not prefixed by a KERN_<LEVEL>,
so emit these messages at KERN_ERR level.

Using %pV can save some code and allow fs_err to
be used, so do it.

Signed-off-by: Joe Perches <joe@perches.com>
---

V2: A bit more neatening and argument alignment.

 fs/gfs2/sys.c  |  5 ++--
 fs/gfs2/util.c | 87 ++++++++++++++++++++++++++++------------------------------
 fs/gfs2/util.h |  4 +--
 3 files changed, 46 insertions(+), 50 deletions(-)

diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 256354c..de25d55 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -140,9 +140,8 @@ static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
 	if (simple_strtol(buf, NULL, 0) != 1)
 		return -EINVAL;
 
-	gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: withdrawing from cluster at user's request\n",
-		sdp->sd_fsname);
+	gfs2_lm_withdraw(sdp, "withdrawing from cluster at user's request\n");
+
 	return len;
 }
 
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index 84bf853..86d2035 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -35,18 +35,24 @@ void gfs2_assert_i(struct gfs2_sbd *sdp)
 	fs_emerg(sdp, "fatal assertion failed\n");
 }
 
-int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
+int gfs2_lm_withdraw(struct gfs2_sbd *sdp, const char *fmt, ...)
 {
 	struct lm_lockstruct *ls = &sdp->sd_lockstruct;
 	const struct lm_lockops *lm = ls->ls_ops;
 	va_list args;
+	struct va_format vaf;
 
 	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW &&
 	    test_and_set_bit(SDF_SHUTDOWN, &sdp->sd_flags))
 		return 0;
 
 	va_start(args, fmt);
-	vprintk(fmt, args);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	fs_err(sdp, "%pV", &vaf);
+
 	va_end(args);
 
 	if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW) {
@@ -83,10 +89,9 @@ int gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion,
 {
 	int me;
 	me = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: assertion \"%s\" failed\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname, assertion,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: assertion \"%s\" failed\n"
+			      "   function = %s, file = %s, line = %u\n",
+			      assertion, function, file, line);
 	dump_stack();
 	return (me) ? -1 : -2;
 }
@@ -136,10 +141,8 @@ int gfs2_consist_i(struct gfs2_sbd *sdp, int cluster_wide, const char *function,
 {
 	int rv;
 	rv = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: filesystem consistency error\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: filesystem consistency error - function = %s, file = %s, line = %u\n",
+			      function, file, line);
 	return rv;
 }
 
@@ -155,13 +158,12 @@ int gfs2_consist_inode_i(struct gfs2_inode *ip, int cluster_wide,
 	struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
 	int rv;
 	rv = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: filesystem consistency error\n"
-		"GFS2: fsid=%s:   inode = %llu %llu\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, (unsigned long long)ip->i_no_formal_ino,
-		(unsigned long long)ip->i_no_addr,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: filesystem consistency error\n"
+			      "  inode = %llu %llu\n"
+			      "  function = %s, file = %s, line = %u\n",
+			      (unsigned long long)ip->i_no_formal_ino,
+			      (unsigned long long)ip->i_no_addr,
+			      function, file, line);
 	return rv;
 }
 
@@ -177,12 +179,11 @@ int gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, int cluster_wide,
 	struct gfs2_sbd *sdp = rgd->rd_sbd;
 	int rv;
 	rv = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: filesystem consistency error\n"
-		"GFS2: fsid=%s:   RG = %llu\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, (unsigned long long)rgd->rd_addr,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: filesystem consistency error\n"
+			      "  RG = %llu\n"
+			      "  function = %s, file = %s, line = %u\n",
+			      (unsigned long long)rgd->rd_addr,
+			      function, file, line);
 	return rv;
 }
 
@@ -198,12 +199,11 @@ int gfs2_meta_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh,
 {
 	int me;
 	me = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: invalid metadata block\n"
-		"GFS2: fsid=%s:   bh = %llu (%s)\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, (unsigned long long)bh->b_blocknr, type,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: invalid metadata block\n"
+			      "  bh = %llu (%s)\n"
+			      "  function = %s, file = %s, line = %u\n",
+			      (unsigned long long)bh->b_blocknr, type,
+			      function, file, line);
 	return (me) ? -1 : -2;
 }
 
@@ -219,12 +219,11 @@ int gfs2_metatype_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh,
 {
 	int me;
 	me = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: invalid metadata block\n"
-		"GFS2: fsid=%s:   bh = %llu (type: exp=%u, found=%u)\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, (unsigned long long)bh->b_blocknr, type, t,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: invalid metadata block\n"
+			      "  bh = %llu (type: exp=%u, found=%u)\n"
+			      "  function = %s, file = %s, line = %u\n",
+			      (unsigned long long)bh->b_blocknr, type, t,
+			      function, file, line);
 	return (me) ? -1 : -2;
 }
 
@@ -239,10 +238,9 @@ int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function, char *file,
 {
 	int rv;
 	rv = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: I/O error\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: I/O error\n"
+			      "  function = %s, file = %s, line = %u\n",
+			      function, file, line);
 	return rv;
 }
 
@@ -257,12 +255,11 @@ int gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh,
 {
 	int rv;
 	rv = gfs2_lm_withdraw(sdp,
-		"GFS2: fsid=%s: fatal: I/O error\n"
-		"GFS2: fsid=%s:   block = %llu\n"
-		"GFS2: fsid=%s:   function = %s, file = %s, line = %u\n",
-		sdp->sd_fsname,
-		sdp->sd_fsname, (unsigned long long)bh->b_blocknr,
-		sdp->sd_fsname, function, file, line);
+			      "fatal: I/O error\n"
+			      "  block = %llu\n"
+			      "  function = %s, file = %s, line = %u\n",
+			      (unsigned long long)bh->b_blocknr,
+			      function, file, line);
 	return rv;
 }
 
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
index 515cce2..cbdcbdf 100644
--- a/fs/gfs2/util.h
+++ b/fs/gfs2/util.h
@@ -165,7 +165,7 @@ static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
 #define gfs2_tune_get(sdp, field) \
 gfs2_tune_get_i(&(sdp)->sd_tune, &(sdp)->sd_tune.field)
 
-int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...);
+__printf(2, 3)
+int gfs2_lm_withdraw(struct gfs2_sbd *sdp, const char *fmt, ...);
 
 #endif /* __UTIL_DOT_H__ */
-
-- 
1.8.1.2.459.gbcd45b4.dirty


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

* Re: [PATCH 0/3] gfs: More logging neatening
  2014-03-06 20:10         ` [PATCH 0/3] gfs: More logging neatening Joe Perches
                             ` (2 preceding siblings ...)
  2014-03-06 20:10           ` [PATCH 3/3] gfs2: Convert gfs2_lm_withdraw to use fs_err Joe Perches
@ 2014-03-07 10:08           ` Steven Whitehouse
  3 siblings, 0 replies; 14+ messages in thread
From: Steven Whitehouse @ 2014-03-07 10:08 UTC (permalink / raw)
  To: Joe Perches; +Cc: Fabian Frederick, linux-kernel, Andrew Morton, cluster-devel

Hi,

On Thu, 2014-03-06 at 12:10 -0800, Joe Perches wrote:
> Joe Perches (3):
>   gfs2: Use pr_<level> more consistently
>   gfs2: Use fs_<level> more often
>   gfs2: Convert gfs2_lm_withdraw to use fs_err
> 
>  fs/gfs2/dir.c        | 14 ++++----
>  fs/gfs2/glock.c      |  8 +++--
>  fs/gfs2/lock_dlm.c   |  9 +++--
>  fs/gfs2/main.c       |  2 ++
>  fs/gfs2/ops_fstype.c | 25 ++++++-------
>  fs/gfs2/quota.c      | 10 +++---
>  fs/gfs2/rgrp.c       | 24 +++++++------
>  fs/gfs2/super.c      | 16 ++++-----
>  fs/gfs2/sys.c        |  6 ++--
>  fs/gfs2/trans.c      | 19 +++++-----
>  fs/gfs2/util.c       | 99 +++++++++++++++++++++++++---------------------------
>  fs/gfs2/util.h       | 31 ++++++++--------
>  12 files changed, 138 insertions(+), 125 deletions(-)
> 

Thanks for the patches. I've added them to the -nmw tree, and I did spot
the V2 patch of the third one,

Steve.



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

end of thread, other threads:[~2014-03-07 10:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-05 14:06 [PATCH 1/1] fs: gfs2: global conversion to pr_foo() Fabian Frederick
2014-03-06 15:44 ` Steven Whitehouse
2014-03-06  9:24   ` Fabian Frederick
2014-03-06 17:57     ` Steven Whitehouse
2014-03-06 10:27       ` Fabian Frederick
2014-03-06 20:10         ` [PATCH 0/3] gfs: More logging neatening Joe Perches
2014-03-06 20:10           ` [PATCH 1/3] gfs2: Use pr_<level> more consistently Joe Perches
2014-03-06 20:10           ` [PATCH 2/3] gfs2: Use fs_<level> more often Joe Perches
2014-03-06 20:10           ` [PATCH 3/3] gfs2: Convert gfs2_lm_withdraw to use fs_err Joe Perches
2014-03-06 20:17             ` [PATCH V2 " Joe Perches
2014-03-07 10:08           ` [PATCH 0/3] gfs: More logging neatening Steven Whitehouse
2014-03-06 17:47   ` [PATCH 1/1] fs: gfs2: global conversion to pr_foo() Joe Perches
2014-03-06 17:59     ` Steven Whitehouse
2014-03-06 18:32       ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox