Re: [PATCH] ext4: Add missing KERN_CONT to a few more debugging uses

From: Andreas Dilger
Date: Thu Oct 13 2016 - 17:24:30 EST


On Oct 13, 2016, at 12:50 PM, Joe Perches <joe@xxxxxxxxxxx> wrote:
>
> Recent commits require line continuing printks to always use
> pr_cont or KERN_CONT. Add these markings to a few more printks.
>
> Miscellaneaous:
>
> o Integrate the ea_idebug and ea_bdebug macros to use a single
> call to printk(KERN_DEBUG instead of 3 separate printks
> o Use the more common varargs macro style
>
> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>

Looks fine.

Reviewed-by: Andreas Dilger <adilger@xxxxxxxxx>

> ---
> fs/ext4/block_validity.c | 4 ++--
> fs/ext4/mballoc.h | 17 ++++++++---------
> fs/ext4/namei.c | 18 ++++++++++--------
> fs/ext4/xattr.c | 18 ++++++------------
> 4 files changed, 26 insertions(+), 31 deletions(-)
>
> diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
> index 02ddec6d8a7d..fdb19543af1e 100644
> --- a/fs/ext4/block_validity.c
> +++ b/fs/ext4/block_validity.c
> @@ -128,12 +128,12 @@ static void debug_print_tree(struct ext4_sb_info *sbi)
> node = rb_first(&sbi->system_blks);
> while (node) {
> entry = rb_entry(node, struct ext4_system_zone, node);
> - printk("%s%llu-%llu", first ? "" : ", ",
> + printk(KERN_CONT "%s%llu-%llu", first ? "" : ", ",
> entry->start_blk, entry->start_blk + entry->count - 1);
> first = 0;
> node = rb_next(node);
> }
> - printk("\n");
> + printk(KERN_CONT "\n");
> }
>
> int ext4_setup_system_zone(struct super_block *sb)
> diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
> index 3ef1df6ae9ec..1aba469f8220 100644
> --- a/fs/ext4/mballoc.h
> +++ b/fs/ext4/mballoc.h
> @@ -27,16 +27,15 @@
> #ifdef CONFIG_EXT4_DEBUG
> extern ushort ext4_mballoc_debug;
>
> -#define mb_debug(n, fmt, a...) \
> - do { \
> - if ((n) <= ext4_mballoc_debug) { \
> - printk(KERN_DEBUG "(%s, %d): %s: ", \
> - __FILE__, __LINE__, __func__); \
> - printk(fmt, ## a); \
> - } \
> - } while (0)
> +#define mb_debug(n, fmt, ...) \
> +do { \
> + if ((n) <= ext4_mballoc_debug) { \
> + printk(KERN_DEBUG "(%s, %d): %s: " fmt, \
> + __FILE__, __LINE__, __func__, ##__VA_ARGS__); \
> + } \
> +} while (0)
> #else
> -#define mb_debug(n, fmt, a...) no_printk(fmt, ## a)
> +#define mb_debug(n, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
> #endif
>
> #define EXT4_MB_HISTORY_ALLOC 1 /* allocation */
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index f92f10d4f66a..104f8bfba718 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -577,12 +577,13 @@ static inline unsigned dx_node_limit(struct inode *dir)
> static void dx_show_index(char * label, struct dx_entry *entries)
> {
> int i, n = dx_get_count (entries);
> - printk(KERN_DEBUG "%s index ", label);
> + printk(KERN_DEBUG "%s index", label);
> for (i = 0; i < n; i++) {
> - printk("%x->%lu ", i ? dx_get_hash(entries + i) :
> - 0, (unsigned long)dx_get_block(entries + i));
> + printk(KERN_CONT " %x->%lu",
> + i ? dx_get_hash(entries + i) : 0,
> + (unsigned long)dx_get_block(entries + i));
> }
> - printk("\n");
> + printk(KERN_CONT "\n");
> }
>
> struct stats
> @@ -679,7 +680,7 @@ static struct stats dx_show_leaf(struct inode *dir,
> }
> de = ext4_next_entry(de, size);
> }
> - printk("(%i)\n", names);
> + printk(KERN_CONT "(%i)\n", names);
> return (struct stats) { names, space, 1 };
> }
>
> @@ -798,7 +799,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
> q = entries + count - 1;
> while (p <= q) {
> m = p + (q - p) / 2;
> - dxtrace(printk("."));
> + dxtrace(printk(KERN_CONT "."));
> if (dx_get_hash(m) > hash)
> q = m - 1;
> else
> @@ -810,7 +811,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
> at = entries;
> while (n--)
> {
> - dxtrace(printk(","));
> + dxtrace(printk(KERN_CONT ","));
> if (dx_get_hash(++at) > hash)
> {
> at--;
> @@ -821,7 +822,8 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
> }
>
> at = p - 1;
> - dxtrace(printk(" %x->%u\n", at == entries ? 0 : dx_get_hash(at),
> + dxtrace(printk(KERN_CONT " %x->%u\n",
> + at == entries ? 0 : dx_get_hash(at),
> dx_get_block(at)));
> frame->entries = entries;
> frame->at = at;
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index c15d63389957..151027736c84 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -61,18 +61,12 @@
> #include "acl.h"
>
> #ifdef EXT4_XATTR_DEBUG
> -# define ea_idebug(inode, f...) do { \
> - printk(KERN_DEBUG "inode %s:%lu: ", \
> - inode->i_sb->s_id, inode->i_ino); \
> - printk(f); \
> - printk("\n"); \
> - } while (0)
> -# define ea_bdebug(bh, f...) do { \
> - printk(KERN_DEBUG "block %pg:%lu: ", \
> - bh->b_bdev, (unsigned long) bh->b_blocknr); \
> - printk(f); \
> - printk("\n"); \
> - } while (0)
> +# define ea_idebug(inode, fmt, ...) \
> + printk(KERN_DEBUG "inode %s:%lu: " fmt "\n", \
> + inode->i_sb->s_id, inode->i_ino, ##__VA_ARGS__)
> +# define ea_bdebug(bh, fmt, ...) \
> + printk(KERN_DEBUG "block %pg:%lu: " fmt "\n", \
> + bh->b_bdev, (unsigned long)bh->b_blocknr, ##__VA_ARGS__)
> #else
> # define ea_idebug(inode, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
> # define ea_bdebug(bh, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
> --
> 2.10.0.rc2.1.g053435c
>


Cheers, Andreas





Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail