linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Yu Zhe' <yuzhe@nfschina.com>, "tytso@mit.edu" <tytso@mit.edu>,
	"adilger.kernel@dilger.ca" <adilger.kernel@dilger.ca>
Cc: "linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"liqiong@nfschina.com" <liqiong@nfschina.com>
Subject: RE: [PATCH] ext4: add KERN_<LEVEL> for printk()
Date: Wed, 25 May 2022 15:18:01 +0000	[thread overview]
Message-ID: <e562426e9cf94621a2a8a1481730f5bd@AcuMS.aculab.com> (raw)
In-Reply-To: <20220525124816.86915-1-yuzhe@nfschina.com>

From: Yu Zhe
> Sent: 25 May 2022 13:48
> 
> printk() should include KERN_<LEVEL> facility level, add them.

They should also have an "ext3: " prefix.

Isn't pr_warn() the function you are really looking for?

	David

> 
> Signed-off-by: Yu Zhe <yuzhe@nfschina.com>
> ---
>  fs/ext4/inode.c |  2 +-
>  fs/ext4/namei.c | 14 +++++++-------
>  fs/ext4/super.c |  4 ++--
>  3 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 3dce7d058985..6d6899191779 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -462,7 +462,7 @@ static void ext4_map_blocks_es_recheck(handle_t *handle,
>  	if (es_map->m_lblk != map->m_lblk ||
>  	    es_map->m_flags != map->m_flags ||
>  	    es_map->m_pblk != map->m_pblk) {
> -		printk("ES cache assertion failed for inode: %lu "
> +		printk(KERN_WARNING "ES cache assertion failed for inode: %lu "
>  		       "es_cached ex [%d/%d/%llu/%x] != "
>  		       "found ex [%d/%d/%llu/%x] retval %d flags %x\n",
>  		       inode->i_ino, es_map->m_lblk, es_map->m_len,
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 47d0ca4c795b..89445661f71d 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -628,7 +628,7 @@ static struct stats dx_show_leaf(struct inode *dir,
>  	char *base = (char *) de;
>  	struct dx_hash_info h = *hinfo;
> 
> -	printk("names: ");
> +	printk(KERN_WARNING "names: ");
>  	while ((char *) de < base + size)
>  	{
>  		if (de->inode)
> @@ -648,7 +648,7 @@ static struct stats dx_show_leaf(struct inode *dir,
>  					/* Directory is not encrypted */
>  					ext4fs_dirhash(dir, de->name,
>  						de->name_len, &h);
> -					printk("%*.s:(U)%x.%u ", len,
> +					printk(KERN_WARNING "%*.s:(U)%x.%u ", len,
>  					       name, h.hash,
>  					       (unsigned) ((char *) de
>  							   - base));
> @@ -683,7 +683,7 @@ static struct stats dx_show_leaf(struct inode *dir,
>  					else
>  						ext4fs_dirhash(dir, de->name,
>  						       de->name_len, &h);
> -					printk("%*.s:(E)%x.%u ", len, name,
> +					printk(KERN_WARNING "%*.s:(E)%x.%u ", len, name,
>  					       h.hash, (unsigned) ((char *) de
>  								   - base));
>  					fscrypt_fname_free_buffer(
> @@ -693,7 +693,7 @@ static struct stats dx_show_leaf(struct inode *dir,
>  				int len = de->name_len;
>  				char *name = de->name;
>  				ext4fs_dirhash(dir, de->name, de->name_len, &h);
> -				printk("%*.s:%x.%u ", len, name, h.hash,
> +				printk(KERN_WARNING "%*.s:%x.%u ", len, name, h.hash,
>  				       (unsigned) ((char *) de - base));
>  #endif
>  			}
> @@ -713,14 +713,14 @@ struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
>  	unsigned count = dx_get_count(entries), names = 0, space = 0, i;
>  	unsigned bcount = 0;
>  	struct buffer_head *bh;
> -	printk("%i indexed blocks...\n", count);
> +	printk(KERN_WARNING "%i indexed blocks...\n", count);
>  	for (i = 0; i < count; i++, entries++)
>  	{
>  		ext4_lblk_t block = dx_get_block(entries);
>  		ext4_lblk_t hash  = i ? dx_get_hash(entries): 0;
>  		u32 range = i < count - 1? (dx_get_hash(entries + 1) - hash): ~hash;
>  		struct stats stats;
> -		printk("%s%3u:%03u hash %8x/%8x ",levels?"":"   ", i, block, hash, range);
> +		printk(KERN_WARNING "%s%3u:%03u hash %8x/%8x ",levels?"":"   ", i, block, hash, range);
>  		bh = ext4_bread(NULL,dir, block, 0);
>  		if (!bh || IS_ERR(bh))
>  			continue;
> @@ -855,7 +855,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
>  		goto fail;
>  	}
> 
> -	dxtrace(printk("Look up %x", hash));
> +	dxtrace(printk(KERN_WARNING "Look up %x", hash));
>  	level = 0;
>  	blocks[0] = 0;
>  	while (1) {
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 450c918d68fc..f1f0427b55a6 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -941,9 +941,9 @@ void __ext4_msg(struct super_block *sb,
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
>  	if (sb)
> -		printk("%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
> +		printk(KERN_WARNING "%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
>  	else
> -		printk("%sEXT4-fs: %pV\n", prefix, &vaf);
> +		printk(KERN_WARNING "%sEXT4-fs: %pV\n", prefix, &vaf);
>  	va_end(args);
>  }
> 
> --
> 2.25.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2022-05-25 15:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 12:48 [PATCH] ext4: add KERN_<LEVEL> for printk() Yu Zhe
2022-05-25 15:18 ` David Laight [this message]
2022-05-25 15:18 ` Joe Perches
2022-05-25 19:25   ` Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e562426e9cf94621a2a8a1481730f5bd@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liqiong@nfschina.com \
    --cc=tytso@mit.edu \
    --cc=yuzhe@nfschina.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).