btrfs: change insert_dirty_subvol to return errors

This will be able to return errors in the future, so change it to return
an error and handle the errors appropriately.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik
2021-03-12 15:25:17 -05:00
committed by David Sterba
parent 2dd8298eb3
commit ac54da6c37

View File

@@ -1565,7 +1565,7 @@ static int find_next_key(struct btrfs_path *path, int level,
/* /*
* Insert current subvolume into reloc_control::dirty_subvol_roots * Insert current subvolume into reloc_control::dirty_subvol_roots
*/ */
static void insert_dirty_subvol(struct btrfs_trans_handle *trans, static int insert_dirty_subvol(struct btrfs_trans_handle *trans,
struct reloc_control *rc, struct reloc_control *rc,
struct btrfs_root *root) struct btrfs_root *root)
{ {
@@ -1587,6 +1587,8 @@ static void insert_dirty_subvol(struct btrfs_trans_handle *trans,
btrfs_grab_root(root); btrfs_grab_root(root);
list_add_tail(&root->reloc_dirty_list, &rc->dirty_subvol_roots); list_add_tail(&root->reloc_dirty_list, &rc->dirty_subvol_roots);
} }
return 0;
} }
static int clean_dirty_subvols(struct reloc_control *rc) static int clean_dirty_subvols(struct reloc_control *rc)
@@ -1788,8 +1790,11 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc,
out: out:
btrfs_free_path(path); btrfs_free_path(path);
if (ret == 0) if (ret == 0) {
insert_dirty_subvol(trans, rc, root); ret = insert_dirty_subvol(trans, rc, root);
if (ret)
btrfs_abort_transaction(trans, ret);
}
if (trans) if (trans)
btrfs_end_transaction_throttle(trans); btrfs_end_transaction_throttle(trans);