Lines Matching defs:trans

240 static int update_backref_cache(struct btrfs_trans_handle *trans,
247 cache->last_trans = trans->transid;
251 if (cache->last_trans == trans->transid)
535 static int clone_backref_node(struct btrfs_trans_handle *trans,
549 update_backref_cache(trans, cache);
599 btrfs_backref_panic(trans->fs_info, new_node->bytenr, -EEXIST);
728 static struct btrfs_root *create_reloc_root(struct btrfs_trans_handle *trans,
751 ret = btrfs_copy_root(trans, root, root->commit_root, &eb,
774 ret = btrfs_copy_root(trans, root, root->node, &eb,
789 btrfs_set_root_generation(root_item, trans->transid);
801 ret = btrfs_insert_root(trans, fs_info->tree_root,
814 reloc_root->last_trans = trans->transid;
820 btrfs_abort_transaction(trans, ret);
831 int btrfs_init_reloc_root(struct btrfs_trans_handle *trans,
854 * corresponding fs root, and then here we update the last trans for the
861 reloc_root->last_trans = trans->transid;
873 if (!trans->reloc_reserved) {
874 rsv = trans->block_rsv;
875 trans->block_rsv = rc->block_rsv;
878 reloc_root = create_reloc_root(trans, root, root->root_key.objectid);
880 trans->block_rsv = rsv;
891 int btrfs_update_reloc_root(struct btrfs_trans_handle *trans,
931 ret = btrfs_update_root(trans, fs_info->tree_root,
1043 int replace_file_extents(struct btrfs_trans_handle *trans,
1142 ret = btrfs_inc_extent_ref(trans, &ref);
1144 btrfs_abort_transaction(trans, ret);
1153 ret = btrfs_free_extent(trans, &ref);
1155 btrfs_abort_transaction(trans, ret);
1187 int replace_path(struct btrfs_trans_handle *trans, struct reloc_control *rc,
1227 ret = btrfs_cow_block(trans, dest, eb, NULL, 0, &eb,
1295 ret = btrfs_cow_block(trans, dest, eb, parent,
1321 ret = btrfs_search_slot(trans, src, &key, path, 0, 1);
1339 ret = btrfs_qgroup_add_swapped_blocks(trans, dest,
1362 ret = btrfs_inc_extent_ref(trans, &ref);
1368 ret = btrfs_inc_extent_ref(trans, &ref);
1375 ret = btrfs_free_extent(trans, &ref);
1382 ret = btrfs_free_extent(trans, &ref);
1582 static void insert_dirty_subvol(struct btrfs_trans_handle *trans,
1598 btrfs_update_reloc_root(trans, root);
1664 struct btrfs_trans_handle *trans = NULL;
1729 trans = btrfs_start_transaction(root, 0);
1730 if (IS_ERR(trans)) {
1731 err = PTR_ERR(trans);
1732 trans = NULL;
1740 * But that's ok, we started the trans handle on our
1746 reloc_root->last_trans = trans->transid;
1747 trans->block_rsv = rc->block_rsv;
1764 ret = replace_path(trans, rc, root, reloc_root, path,
1792 btrfs_end_transaction_throttle(trans);
1793 trans = NULL;
1806 ret = btrfs_cow_block(trans, root, leaf, NULL, 0, &leaf,
1816 insert_dirty_subvol(trans, rc, root);
1818 if (trans)
1819 btrfs_end_transaction_throttle(trans);
1835 struct btrfs_trans_handle *trans;
1854 trans = btrfs_join_transaction(rc->extent_root);
1855 if (IS_ERR(trans)) {
1859 return PTR_ERR(trans);
1864 btrfs_end_transaction(trans);
1889 btrfs_update_reloc_root(trans, root);
1898 err = btrfs_commit_transaction(trans);
1900 btrfs_end_transaction(trans);
2015 static int record_reloc_root_in_trans(struct btrfs_trans_handle *trans,
2022 if (reloc_root->last_trans == trans->transid)
2028 ret = btrfs_record_root_in_trans(trans, root);
2035 struct btrfs_root *select_reloc_root(struct btrfs_trans_handle *trans,
2053 record_reloc_root_in_trans(trans, root);
2057 btrfs_record_root_in_trans(trans, root);
2172 static int reserve_metadata_space(struct btrfs_trans_handle *trans,
2184 trans->block_rsv = rc->block_rsv;
2220 static int do_relocation(struct btrfs_trans_handle *trans,
2250 root = select_reloc_root(trans, rc, upper, edges);
2269 ret = btrfs_search_slot(trans, root, key, path, 0, 1);
2333 ret = btrfs_cow_block(trans, root, eb, upper->eb,
2346 trans->transid);
2355 ret = btrfs_inc_extent_ref(trans, &ref);
2358 ret = btrfs_drop_subtree(trans, root, eb, upper->eb);
2381 static int link_to_upper(struct btrfs_trans_handle *trans,
2389 return do_relocation(trans, rc, node, &key, path, 0);
2392 static int finish_pending_nodes(struct btrfs_trans_handle *trans,
2410 ret = link_to_upper(trans, rc, node, path);
2487 static int relocate_tree_block(struct btrfs_trans_handle *trans,
2503 ret = reserve_metadata_space(trans, rc, node);
2518 btrfs_record_root_in_trans(trans, root);
2527 ret = btrfs_search_slot(trans, root, key, path, 0, 1);
2535 ret = do_relocation(trans, rc, node, key, path, 1);
2547 int relocate_tree_blocks(struct btrfs_trans_handle *trans,
2588 ret = relocate_tree_block(trans, rc, node, &block->key,
2596 err = finish_pending_nodes(trans, rc, path, err);
2998 struct btrfs_trans_handle *trans;
3014 trans = btrfs_join_transaction(root);
3015 if (IS_ERR(trans)) {
3016 ret = PTR_ERR(trans);
3020 ret = btrfs_truncate_free_space_cache(trans, block_group, inode);
3022 btrfs_end_transaction(trans);
3238 struct btrfs_trans_handle *trans;
3263 trans = btrfs_join_transaction(rc->extent_root);
3264 if (IS_ERR(trans)) {
3271 return PTR_ERR(trans);
3274 ret = btrfs_commit_transaction(trans);
3286 struct btrfs_trans_handle *trans = NULL;
3316 trans = btrfs_start_transaction(rc->extent_root, 0);
3317 if (IS_ERR(trans)) {
3318 err = PTR_ERR(trans);
3319 trans = NULL;
3323 if (update_backref_cache(trans, &rc->backref_cache)) {
3324 btrfs_end_transaction(trans);
3325 trans = NULL;
3346 btrfs_print_v0_err(trans->fs_info);
3347 btrfs_abort_transaction(trans, err);
3368 ret = relocate_tree_blocks(trans, rc, &blocks);
3379 btrfs_end_transaction_throttle(trans);
3381 trans = NULL;
3398 if (trans && progress && err == -ENOSPC) {
3399 ret = btrfs_force_chunk_alloc(trans, rc->block_group->flags);
3410 if (trans) {
3411 btrfs_end_transaction_throttle(trans);
3445 trans = btrfs_join_transaction(rc->extent_root);
3446 if (IS_ERR(trans)) {
3447 err = PTR_ERR(trans);
3450 ret = btrfs_commit_transaction(trans);
3462 static int __insert_orphan_inode(struct btrfs_trans_handle *trans,
3474 ret = btrfs_insert_empty_inode(trans, root, path, objectid);
3501 struct btrfs_trans_handle *trans;
3507 trans = btrfs_start_transaction(root, 6);
3508 if (IS_ERR(trans)) {
3510 return ERR_CAST(trans);
3517 err = __insert_orphan_inode(trans, root, objectid);
3524 err = btrfs_orphan_add(trans, BTRFS_I(inode));
3527 btrfs_end_transaction(trans);
3717 struct btrfs_trans_handle *trans;
3720 trans = btrfs_start_transaction(fs_info->tree_root, 0);
3721 if (IS_ERR(trans))
3722 return PTR_ERR(trans);
3728 ret = btrfs_update_root(trans, fs_info->tree_root,
3731 err = btrfs_end_transaction(trans);
3753 struct btrfs_trans_handle *trans;
3834 trans = btrfs_join_transaction(rc->extent_root);
3835 if (IS_ERR(trans)) {
3836 err = PTR_ERR(trans);
3858 btrfs_end_transaction(trans);
3868 err = btrfs_commit_transaction(trans);
3876 trans = btrfs_join_transaction(rc->extent_root);
3877 if (IS_ERR(trans)) {
3878 err = PTR_ERR(trans);
3881 err = btrfs_commit_transaction(trans);
3955 int btrfs_reloc_cow_block(struct btrfs_trans_handle *trans,
4005 ret = replace_file_extents(trans, rc, root, cow);
4048 int btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans,
4072 reloc_root = create_reloc_root(trans, root->reloc_root,
4082 ret = clone_backref_node(trans, rc, root, reloc_root);