aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/backref.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/backref.c')
-rw-r--r--fs/btrfs/backref.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 982152d3f920..89116afda7a2 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -1465,12 +1465,11 @@ int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
1465 * 1465 *
1466 * Return: 0 if extent is not shared, 1 if it is shared, < 0 on error. 1466 * Return: 0 if extent is not shared, 1 if it is shared, < 0 on error.
1467 */ 1467 */
1468int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr) 1468int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr,
1469 struct ulist *roots, struct ulist *tmp)
1469{ 1470{
1470 struct btrfs_fs_info *fs_info = root->fs_info; 1471 struct btrfs_fs_info *fs_info = root->fs_info;
1471 struct btrfs_trans_handle *trans; 1472 struct btrfs_trans_handle *trans;
1472 struct ulist *tmp = NULL;
1473 struct ulist *roots = NULL;
1474 struct ulist_iterator uiter; 1473 struct ulist_iterator uiter;
1475 struct ulist_node *node; 1474 struct ulist_node *node;
1476 struct seq_list elem = SEQ_LIST_INIT(elem); 1475 struct seq_list elem = SEQ_LIST_INIT(elem);
@@ -1481,12 +1480,8 @@ int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr)
1481 .share_count = 0, 1480 .share_count = 0,
1482 }; 1481 };
1483 1482
1484 tmp = ulist_alloc(GFP_NOFS); 1483 ulist_init(roots);
1485 roots = ulist_alloc(GFP_NOFS); 1484 ulist_init(tmp);
1486 if (!tmp || !roots) {
1487 ret = -ENOMEM;
1488 goto out;
1489 }
1490 1485
1491 trans = btrfs_attach_transaction(root); 1486 trans = btrfs_attach_transaction(root);
1492 if (IS_ERR(trans)) { 1487 if (IS_ERR(trans)) {
@@ -1527,8 +1522,8 @@ int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr)
1527 up_read(&fs_info->commit_root_sem); 1522 up_read(&fs_info->commit_root_sem);
1528 } 1523 }
1529out: 1524out:
1530 ulist_free(tmp); 1525 ulist_release(roots);
1531 ulist_free(roots); 1526 ulist_release(tmp);
1532 return ret; 1527 return ret;
1533} 1528}
1534 1529