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@xxxxxxxxxx> Reviewed-by: Nikolay Borisov <nborisov@xxxxxxxx> > --- > 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); > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
