diff mbox series

[1/3] btrfs: Remove WARN_ON in walk_log_tree

Message ID 20191202094015.19444-2-nborisov@suse.com (mailing list archive)
State New, archived
Headers show
Series Cleanups from pinned rework try | expand

Commit Message

Nikolay Borisov Dec. 2, 2019, 9:40 a.m. UTC
The log_root passed to walk_log_tree is guaranteed to have its
root_key.objectid always be BTRFS_TREE_LOG_OBJECTID. This is by
merit that all log roots of an ordinary root are allocated in
alloc_log_tree which hard-codes objectid to be BTRFS_TREE_LOG_OBJECTID.

In case walk_log_tree is called for a log tree found by btrfs_read_fs_root
in btrfs_recover_log_trees, that function already ensures
found_key.objectid is BTRFS_TREE_LOG_OBJECTID.

No functional changes.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/tree-log.c | 2 --
 1 file changed, 2 deletions(-)

Comments

David Sterba Dec. 3, 2019, 5:21 p.m. UTC | #1
On Mon, Dec 02, 2019 at 11:40:13AM +0200, Nikolay Borisov wrote:
> The log_root passed to walk_log_tree is guaranteed to have its
> root_key.objectid always be BTRFS_TREE_LOG_OBJECTID. This is by
> merit that all log roots of an ordinary root are allocated in
> alloc_log_tree which hard-codes objectid to be BTRFS_TREE_LOG_OBJECTID.
> 
> In case walk_log_tree is called for a log tree found by btrfs_read_fs_root
> in btrfs_recover_log_trees, that function already ensures
> found_key.objectid is BTRFS_TREE_LOG_OBJECTID.

Agreed, if anything the warning should have been an assert at the
beginning of the function.
diff mbox series

Patch

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index a30057feff2a..33d329f22534 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2893,8 +2893,6 @@  static int walk_log_tree(struct btrfs_trans_handle *trans,
 					clear_extent_buffer_dirty(next);
 			}
 
-			WARN_ON(log->root_key.objectid !=
-				BTRFS_TREE_LOG_OBJECTID);
 			ret = btrfs_pin_reserved_extent(fs_info, next->start,
 							next->len);
 			if (ret)