*/
ASSERT(!btrfs_is_zoned(fs_info) || btrfs_is_data_reloc_root(root));
+ lock_extent(&inode->io_tree, start, end, NULL);
+
path = btrfs_alloc_path();
if (!path) {
ret = -ENOMEM;
const bool zoned = btrfs_is_zoned(inode->root->fs_info);
int ret;
- /*
- * We're unlocked by the different fill functions below.
- */
- lock_extent(&inode->io_tree, start, end, NULL);
-
/*
* The range must cover part of the @locked_page, or a return of 1
* can confuse the caller.
goto out;
}
+ /*
+ * We're unlocked by the different fill functions below.
+ */
+ lock_extent(&inode->io_tree, start, end, NULL);
+
if (btrfs_inode_can_compress(inode) &&
inode_need_compress(inode, start, end) &&
run_delalloc_compressed(inode, locked_page, start, end, wbc))