@@ -974,8 +974,11 @@ static noinline int cow_file_range(struct inode *inode,
}
}
- BUG_ON(disk_num_bytes >
- btrfs_super_total_bytes(root->fs_info->super_copy));
+ WARN_ONCE(disk_num_bytes >
+ btrfs_super_total_bytes(root->fs_info->super_copy),
+ KERN_WARNING "disk_num_bytes(%llu) > btrfs_super_total_bytes(%llu)\n",
+ disk_num_bytes,
+ btrfs_super_total_bytes(root->fs_info->super_copy));
alloc_hint = get_extent_allocation_hint(inode, start, num_bytes);
btrfs_drop_extent_cache(inode, start, start + num_bytes - 1, 0);
This BUG_ON is more like a warning since an invalid btrfs_super_total_bytes() doesn't affect other stuff. Thus, use WARN_ONCE for warning purpose and don't leave a possible kernel panic here. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> --- fs/btrfs/inode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)