Re: [PATCH] btrfs: Remove never-reached WARN_ON

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 17, 2017 at 10:52:28AM +0300, Nikolay Borisov wrote:
> We have a WARN_ON(!var) inside an if branch which is executed (among others)
> only when var is true.
> 
> Signed-off-by: Nikolay Borisov <nborisov@xxxxxxxx>
> ---
>  fs/btrfs/extent-tree.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 21c78c48e15b..8552d550a048 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -6755,7 +6755,6 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,
>  		if (!readonly && return_free_space &&
>  		    global_rsv->space_info == space_info) {
>  			u64 to_add = len;
> -			WARN_ON(!return_free_space);

Right. And also an example where the coding style can be improved as a
sideefect, ie. the missing line between declarations and statements.

>  			spin_lock(&global_rsv->lock);
>  			if (!global_rsv->full) {
>  				to_add = min(len, global_rsv->size -
> -- 
> 2.7.4
> 
> --
> 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
--
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




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux