All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zheng Liu <gnehzuil.liu@gmail.com>
To: linux-ext4@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>
Cc: Zheng Liu <wenqing.lz@taobao.com>
Subject: Re: [PATCH v2] ext4: add WARN_ON to check the length of allocated blocks
Date: Mon, 29 Jul 2013 23:09:16 +0800	[thread overview]
Message-ID: <20130729150915.GC2615@gmail.com> (raw)
In-Reply-To: <1373590852-29544-1-git-send-email-wenqing.lz@taobao.com>

On Fri, Jul 12, 2013 at 09:00:52AM +0800, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
> 
> In this commit (921f266b) a sanity check is added in map_blocks to make
> sure 'retval == map->m_len'.  But we'd better enable this check all the
> time because it can help us to dig some bugs that is hard to be hitted.
> 
> Cc: "Theodore Ts'o" <tytso@mit.edu>
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>

Any comment?

Thanks
                                                - Zheng

> ---
> changelog:
> v2 <- v1:
>  * print more details to help us to dig some bugs that is hard to be hitted
> 
> v1: http://patchwork.ozlabs.org/patch/230406/
> 
> Hi Ted,
> 
> This patch sleeps on my own tree for a very long time so that I almost forgot
> it.  Sorry about that.
> 
> 						- Zheng
> 
>  fs/ext4/inode.c |   39 ++++++++++++++++++---------------------
>  1 file changed, 18 insertions(+), 21 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 19a1643..95bad70 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -556,14 +556,13 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
>  		int ret;
>  		unsigned long long status;
>  
> -#ifdef ES_AGGRESSIVE_TEST
> -		if (retval != map->m_len) {
> -			printk("ES len assertation failed for inode: %lu "
> -			       "retval %d != map->m_len %d "
> -			       "in %s (lookup)\n", inode->i_ino, retval,
> -			       map->m_len, __func__);
> +		if (unlikely(retval != map->m_len)) {
> +			ext4_warning(inode->i_sb,
> +				     "ES len assertation failed for inode: "
> +				     "%lu retval %d != map->m_len %d\n",
> +				     inode->i_ino, retval, map->m_len);
> +			WARN_ON(1);
>  		}
> -#endif
>  
>  		status = map->m_flags & EXT4_MAP_UNWRITTEN ?
>  				EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
> @@ -657,14 +656,13 @@ found:
>  		int ret;
>  		unsigned long long status;
>  
> -#ifdef ES_AGGRESSIVE_TEST
> -		if (retval != map->m_len) {
> -			printk("ES len assertation failed for inode: %lu "
> -			       "retval %d != map->m_len %d "
> -			       "in %s (allocation)\n", inode->i_ino, retval,
> -			       map->m_len, __func__);
> +		if (unlikely(retval != map->m_len)) {
> +			ext4_warning(inode->i_sb,
> +				     "ES len assertation failed for inode: "
> +				     "%lu retval %d != map->m_len %d\n",
> +				     inode->i_ino, retval, map->m_len);
> +			WARN_ON(1);
>  		}
> -#endif
>  
>  		/*
>  		 * If the extent has been zeroed out, we don't need to update
> @@ -1640,14 +1638,13 @@ add_delayed:
>  		int ret;
>  		unsigned long long status;
>  
> -#ifdef ES_AGGRESSIVE_TEST
> -		if (retval != map->m_len) {
> -			printk("ES len assertation failed for inode: %lu "
> -			       "retval %d != map->m_len %d "
> -			       "in %s (lookup)\n", inode->i_ino, retval,
> -			       map->m_len, __func__);
> +		if (unlikely(retval != map->m_len)) {
> +			ext4_warning(inode->i_sb,
> +				     "ES len assertation failed for inode: "
> +				     "%lu retval %d != map->m_len %d\n",
> +				     inode->i_ino, retval, map->m_len);
> +			WARN_ON(1);
>  		}
> -#endif
>  
>  		status = map->m_flags & EXT4_MAP_UNWRITTEN ?
>  				EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
> -- 
> 1.7.9.7
> 

  reply	other threads:[~2013-07-29 15:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12  1:00 [PATCH v2] ext4: add WARN_ON to check the length of allocated blocks Zheng Liu
2013-07-29 15:09 ` Zheng Liu [this message]
2013-07-29 16:52   ` Theodore Ts'o
2013-07-29 23:37     ` Zheng Liu

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=20130729150915.GC2615@gmail.com \
    --to=gnehzuil.liu@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=wenqing.lz@taobao.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.