/* this does all the record keeping required to make sure that a reference counted root is properly recorded in a given transaction. This is required to make sure the old root from before we joined the transaction is deleted when the transaction commits  */
static noinline int record_root_in_trans(struct btrfs_trans_handle *trans, struct btrfs_root *root)
/* this does all the record keeping required to make sure that a reference counted root is properly recorded in a given transaction. This is required to make sure the old root from before we joined the transaction is deleted when the transaction commits  */
static noinline int record_root_in_trans(struct btrfs_trans_handle *trans, struct btrfs_root *root)
{
	if (root->ref_cows && root->last_trans < trans->transid) {
		WARN_ON(root == root->fs_info->extent_root);
		WARN_ON(root->commit_root != root->node);
		radix_tree_tag_set(&root->fs_info->fs_roots_radix,
			   (unsigned long)root->root_key.objectid,
			   BTRFS_ROOT_TRANS_TAG);
		root->last_trans = trans->transid;
		btrfs_init_reloc_root(trans, root);
	}
	return 0;
}