linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] btrfs: use ASSERT to report logical error in cow_file_range()
Date: Thu, 15 Feb 2018 12:09:10 +0200	[thread overview]
Message-ID: <b64c97e2-0aac-ef3f-c63e-021884ab166b@suse.com> (raw)
In-Reply-To: <20180215100759.11647-1-anand.jain@oracle.com>



On 15.02.2018 12:07, Anand Jain wrote:
> Use ASSERT to report logical error in cow_file_range(), also move
> it a bit closer to when the num_bytes is derived.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
> v1->v2:
>    ASSERT logic changed. Thanks Nikolay.
> 
>  fs/btrfs/inode.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 4b156e191592..260fd8139951 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -976,6 +976,7 @@ static noinline int cow_file_range(struct inode *inode,
>  
>  	num_bytes = ALIGN(end - start + 1, blocksize);
>  	num_bytes = max(blocksize,  num_bytes);
> +	ASSERT(num_bytes <= btrfs_super_total_bytes(fs_info->super_copy));
>  
>  	inode_should_defrag(BTRFS_I(inode), start, end, num_bytes, SZ_64K);
>  
> @@ -1006,9 +1007,6 @@ static noinline int cow_file_range(struct inode *inode,
>  		}
>  	}
>  
> -	BUG_ON(num_bytes >
> -	       btrfs_super_total_bytes(fs_info->super_copy));
> -
>  	alloc_hint = get_extent_allocation_hint(inode, start, num_bytes);
>  	btrfs_drop_extent_cache(BTRFS_I(inode), start,
>  			start + num_bytes - 1, 0);
> 

  reply	other threads:[~2018-02-15 10:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15  4:30 [PATCH] btrfs: use ASSERT to report logical error in cow_file_range() Anand Jain
2018-02-15  8:43 ` Nikolay Borisov
2018-02-15 10:07   ` [PATCH v2] " Anand Jain
2018-02-15 10:09     ` Nikolay Borisov [this message]
2018-02-19 15:19     ` David Sterba

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=b64c97e2-0aac-ef3f-c63e-021884ab166b@suse.com \
    --to=nborisov@suse.com \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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).