Lines Matching defs:root

885 				  struct btrfs_root *root)
904 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
917 ret = btrfs_del_items(trans, root, path, 0, nr);
972 * check if someone else created the quota root in the meanwhile. If so,
982 * 1 for quota root item
1213 * root while we are deleting the root. This is like dropping fs roots
1243 * 1 For the root item
1894 * incremented. The root node will never be freed.
1901 * If we increment the root nodes slot counter past the number of
1920 * Don't free the root - we will detect this
2745 /* Search commit root to find old_roots */
2761 * root. It's safe inside commit_transaction().
2804 * disable operation (ioctl) and access a freed quota root.
2962 * We call inherit after we clone the root in order to make sure
2964 * difference between the two roots should be the root node.
3071 static int qgroup_reserve(struct btrfs_root *root, u64 num_bytes, bool enforce,
3075 struct btrfs_fs_info *fs_info = root->fs_info;
3076 u64 ref_root = root->root_key.objectid;
3342 * Rescan should only search for commit root, and any later difference
3602 node = reserved->range_changed.root.rb_node;
3660 * possible, so we need to flush the whole root.
3672 static int try_flush_qgroup(struct btrfs_root *root)
3696 if (test_and_set_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state)) {
3707 wait_event(root->qgroup_flush_wait,
3708 !test_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state));
3712 ret = btrfs_start_delalloc_snapshot(root);
3715 btrfs_wait_ordered_extents(root, U64_MAX, 0, (u64)-1);
3717 trans = btrfs_join_transaction(root);
3728 clear_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state);
3729 wake_up(&root->qgroup_flush_wait);
3737 struct btrfs_root *root = inode->root;
3744 if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &root->fs_info->flags) ||
3745 !is_fstree(root->root_key.objectid) || len == 0)
3769 ret = qgroup_reserve(root, to_reserve, true, BTRFS_QGROUP_RSV_DATA);
3808 ret = try_flush_qgroup(inode->root);
3818 struct btrfs_root *root = inode->root;
3826 len = round_up(start + len, root->fs_info->sectorsize);
3827 start = round_down(start, root->fs_info->sectorsize);
3861 btrfs_qgroup_free_refroot(root->fs_info, root->root_key.objectid, freed,
3877 if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &inode->root->fs_info->flags))
3895 btrfs_qgroup_free_refroot(inode->root->fs_info,
3896 inode->root->root_key.objectid,
3926 * FILE_EXTENT is inserted into corresponding root.
3942 static void add_root_meta_rsv(struct btrfs_root *root, int num_bytes,
3951 spin_lock(&root->qgroup_meta_rsv_lock);
3953 root->qgroup_meta_rsv_prealloc += num_bytes;
3955 root->qgroup_meta_rsv_pertrans += num_bytes;
3956 spin_unlock(&root->qgroup_meta_rsv_lock);
3959 static int sub_root_meta_rsv(struct btrfs_root *root, int num_bytes,
3968 spin_lock(&root->qgroup_meta_rsv_lock);
3970 num_bytes = min_t(u64, root->qgroup_meta_rsv_prealloc,
3972 root->qgroup_meta_rsv_prealloc -= num_bytes;
3974 num_bytes = min_t(u64, root->qgroup_meta_rsv_pertrans,
3976 root->qgroup_meta_rsv_pertrans -= num_bytes;
3978 spin_unlock(&root->qgroup_meta_rsv_lock);
3982 int btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes,
3985 struct btrfs_fs_info *fs_info = root->fs_info;
3989 !is_fstree(root->root_key.objectid) || num_bytes == 0)
3993 trace_qgroup_meta_reserve(root, (s64)num_bytes, type);
3994 ret = qgroup_reserve(root, num_bytes, enforce, type);
3998 * Record what we have reserved into root.
4002 * (since quota was disabled), so record what we reserved into root.
4005 add_root_meta_rsv(root, num_bytes, type);
4009 int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes,
4014 ret = btrfs_qgroup_reserve_meta(root, num_bytes, type, enforce);
4018 ret = try_flush_qgroup(root);
4021 return btrfs_qgroup_reserve_meta(root, num_bytes, type, enforce);
4024 void btrfs_qgroup_free_meta_all_pertrans(struct btrfs_root *root)
4026 struct btrfs_fs_info *fs_info = root->fs_info;
4029 !is_fstree(root->root_key.objectid))
4033 trace_qgroup_meta_free_all_pertrans(root);
4035 btrfs_qgroup_free_refroot(fs_info, root->root_key.objectid, (u64)-1,
4039 void __btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes,
4042 struct btrfs_fs_info *fs_info = root->fs_info;
4045 !is_fstree(root->root_key.objectid))
4053 num_bytes = sub_root_meta_rsv(root, num_bytes, type);
4055 trace_qgroup_meta_reserve(root, -(s64)num_bytes, type);
4056 btrfs_qgroup_free_refroot(fs_info, root->root_key.objectid,
4105 void btrfs_qgroup_convert_reserved_meta(struct btrfs_root *root, int num_bytes)
4107 struct btrfs_fs_info *fs_info = root->fs_info;
4110 !is_fstree(root->root_key.objectid))
4113 num_bytes = sub_root_meta_rsv(root, num_bytes,
4115 trace_qgroup_meta_convert(root, num_bytes);
4116 qgroup_convert_meta(fs_info, root->root_key.objectid, num_bytes);
4138 btrfs_warn(inode->root->fs_info,
4142 btrfs_qgroup_free_refroot(inode->root->fs_info,
4143 inode->root->root_key.objectid,
4162 * Delete all swapped blocks record of @root.
4167 void btrfs_qgroup_clean_swapped_blocks(struct btrfs_root *root)
4172 swapped_blocks = &root->swapped_blocks;
4195 * @subvol_root: tree root of the subvolume tree get swapped
4197 * @subvol_parent/slot: pointer to the subtree root in subvolume tree
4198 * @reloc_parent/slot: pointer to the subtree root in reloc tree
4307 * Check if the tree block is a subtree root, and if so do the needed
4313 struct btrfs_root *root,
4316 struct btrfs_fs_info *fs_info = root->fs_info;
4317 struct btrfs_qgroup_swapped_blocks *blocks = &root->swapped_blocks;
4329 if (!is_fstree(root->root_key.objectid) || !root->reloc_root)
4365 /* Read out reloc subtree root */
4398 struct rb_root *root;
4400 root = &trans->delayed_refs.dirty_extent_root;
4401 rbtree_postorder_for_each_entry_safe(entry, next, root, node) {
4405 *root = RB_ROOT;