btrfs: Remove never-reached WARN_ON
PATCH 1/1 btrfs: Remove never-reached WARN_ON
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 <[email protected]>
--- fs/btrfs/extent-tree.c | 1 - 1 file changed, 1 deletion(-)
fs/btrfs/extent-tree.c +0 -1
@@ -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);spin_lock (&global_rsv->lock);if (!global_rsv->full) { to_add = min(len, global_rsv->size -
Signature · 1 line
2.7.4
Quoted 13 lines · Nikolay Borisov
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 <[email protected]>--- fs/btrfs/extent-tree.c | 1 - 1 file changed, 1 deletion(-)fs/btrfs/extent-tree.c +0
-0
fs/btrfs/extent-tree.c static int unpin_extent_range(struct btrfs_fs_info *fs_info, · line 6758
Quoted 4 lines
fs/btrfs/extent-tree.c +0
-1@@ -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.
Quoted 10 lines
fs/btrfs/extent-tree.c +0
-0spin_lock (&global_rsv->lock);if (!global_rsv->full) { to_add = min(len, global_rsv->size -Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 1/1 btrfs: Remove never-reached WARN_ON
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 <[email protected]>
--- fs/btrfs/extent-tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/extent-tree.c +2 -1
@@ -6755,7 +6755,7 @@ 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); +spin_lock (&global_rsv->lock);if (!global_rsv->full) { to_add = min(len, global_rsv->size -
@@ -6771,6 +6771,7 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info, len -= to_add; }spin_unlock (&global_rsv->lock); +/* Add to any tickets we may have */ if (len) space_info_add_new_bytes(fs_info, space_info,
Signature · 1 line
2.7.4