Lines Matching defs:root

68 	struct btrfs_root *root;
308 "Send: inconsistent snapshot, found %s %s for inode %llu without updated inode item, send root is %llu, parent root is %llu",
819 static int __get_inode_info(struct btrfs_root *root, struct btrfs_path *path,
830 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
855 static int get_inode_info(struct btrfs_root *root,
866 ret = __get_inode_info(root, path, ino, size, gen, mode, uid, gid,
884 static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path,
948 start = btrfs_ref_to_path(root, tmp_path, name_len,
961 start = btrfs_ref_to_path(root, tmp_path,
1004 static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path,
1057 BTRFS_MAX_XATTR_SIZE(root->fs_info)) {
1135 static int get_inode_path(struct btrfs_root *root,
1152 ret = btrfs_search_slot_for_read(root, &key, p, 1, 0);
1167 ret = iterate_inode_ref(root, p, &found_key, 1,
1203 u64 root = (u64)(uintptr_t)key;
1206 if (root < cr->root->root_key.objectid)
1208 if (root > cr->root->root_key.objectid)
1218 if (cr1->root->root_key.objectid < cr2->root->root_key.objectid)
1220 if (cr1->root->root_key.objectid > cr2->root->root_key.objectid)
1229 static int __iterate_backrefs(u64 ino, u64 offset, u64 root, void *ctx_)
1234 /* First check if the root is in the list of accepted clone sources */
1235 found = bsearch((void *)(uintptr_t)root, bctx->sctx->clone_roots,
1242 if (found->root == bctx->sctx->send_root &&
1252 if (found->root == bctx->sctx->send_root) {
1461 else if (sctx->clone_roots[i].root == sctx->send_root)
1481 static int read_symlink(struct btrfs_root *root,
1501 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
1513 btrfs_err(root->fs_info,
1514 "Found empty symlink inode %llu at root %llu",
1515 ino, root->root_key.objectid);
1538 * Helper function to generate a file name that is unique in the root of
1704 static int lookup_dir_item_inode(struct btrfs_root *root,
1718 di = btrfs_lookup_dir_item(NULL, root, path,
1741 static int get_first_ref(struct btrfs_root *root, u64 ino,
1759 ret = btrfs_search_slot_for_read(root, &key, path, 1, 0);
1795 ret = get_inode_info(root, parent_dir, NULL, dir_gen, NULL,
1808 static int is_first_ref(struct btrfs_root *root,
1820 ret = get_first_ref(root, ino, &tmp_dir, NULL, tmp_name);
1863 * If we have a parent root we need to verify that the parent dir was
2137 * Used by get_cur_path for each ref up to the root.
2258 * We walk the path up to the root. For every inode in between, we check if it
2943 struct btrfs_root *root = sctx->parent_root;
2952 * Don't try to rmdir the top/root subvolume dir.
2969 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
2977 ret = btrfs_next_leaf(root, path);
3434 * (in the send root) with a higher inode number than ours (sctx->cur_ino) was
3436 * in the parent root) of some other unrelated directory that got its rename
3510 * renamed to. We need to check if that inode is in the send root as
3560 static int check_ino_in_path(struct btrfs_root *root,
3578 ret = get_first_ref(root, ino, &parent, &parent_gen, fs_path);
3589 * Check if ino ino1 is an ancestor of inode ino2 in the given root for any
3593 static int is_ancestor(struct btrfs_root *root,
3621 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
3632 ret = btrfs_next_leaf(root, path);
3669 ret = get_inode_info(root, parent, NULL, &parent_gen,
3673 ret = check_ino_in_path(root, ino1, ino1_gen,
3720 * parent root, we need to delay the rename of the
3911 * This should never happen as the root dir always has the same ref
4354 static int record_ref(struct btrfs_root *root, u64 dir, struct fs_path *name,
4366 ret = get_inode_info(root, dir, NULL, &gen, NULL, NULL,
4435 struct btrfs_root *root;
4454 ret = get_inode_info(ctx->root, dir, NULL, &dir_gen, NULL,
4466 static int find_iref(struct btrfs_root *root,
4478 ctx.root = root;
4480 ret = iterate_inode_ref(root, path, key, 0, __find_iref, &ctx);
4562 struct btrfs_root *root;
4576 root = sctx->send_root;
4579 root = sctx->parent_root;
4591 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
4599 ret = btrfs_next_leaf(root, path);
4614 ret = iterate_inode_ref(root, path, &found_key, 0, cb, sctx);
4787 static int find_xattr(struct btrfs_root *root,
4802 ret = iterate_dir_item(root, path, __find_xattr, &ctx);
4885 struct btrfs_root *root;
4896 root = sctx->send_root;
4901 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
4909 ret = btrfs_next_leaf(root, path);
4926 ret = iterate_dir_item(root, path, __process_new_xattr, sctx);
4958 struct btrfs_root *root = sctx->send_root;
4959 struct btrfs_fs_info *fs_info = root->fs_info;
4972 inode = btrfs_iget(fs_info->sb, sctx->cur_ino, root);
5010 "send: IO error at offset %llu for inode %llu root %llu",
5085 offset, len, clone_root->root->root_key.objectid,
5104 if (clone_root->root == sctx->send_root) {
5111 ret = get_inode_path(clone_root->root, clone_root->ino, p);
5125 if (!btrfs_is_empty_uuid(clone_root->root->root_item.received_uuid))
5127 clone_root->root->root_item.received_uuid);
5130 clone_root->root->root_item.uuid);
5132 le64_to_cpu(clone_root->root->root_item.ctransid));
5352 ret = __get_inode_info(clone_root->root, path, clone_root->ino,
5383 ret = btrfs_search_slot(NULL, clone_root->root, &key, path, 0, 0);
5404 ret = btrfs_next_leaf(clone_root->root, path);
5555 * and using the send root as the clone root, we must stop once
5562 if (clone_root->root == sctx->send_root &&
5806 struct btrfs_root *root = sctx->send_root;
5819 ret = btrfs_search_slot_for_read(root, &key, path, 0, 1);
5839 struct btrfs_root *root = sctx->parent_root;
5850 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
5863 ret = btrfs_next_leaf(root, path);
6005 struct btrfs_root *root;
6012 root = sctx->send_root;
6020 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
6029 ret = btrfs_next_leaf(root, path);
6355 * The cur_ino = root dir case is special here. We can't treat
6357 * stream that tries to delete/mkdir the root dir.
7140 * If orphan cleanup did remove any orphans from a root, it means the tree
7141 * was modified and therefore the commit root is not the same as the current
7142 * root anymore. This is a problem, because send uses the commit root and
7143 * therefore can see inode items that don't exist in the current root anymore,
7145 * on the current root and not on the commit root. Those lookups will fail,
7149 * before it started (meaning that the commit root will be the same as the
7150 * current root) or not.
7163 if (sctx->clone_roots[i].root->node !=
7164 sctx->clone_roots[i].root->commit_root)
7173 /* Use any root, all fs roots will get their commit roots updated. */
7185 * Make sure any existing dellaloc is flushed for any root used by a send
7194 struct btrfs_root *root = sctx->parent_root;
7198 if (root) {
7199 ret = btrfs_start_delalloc_snapshot(root);
7202 btrfs_wait_ordered_extents(root, U64_MAX, 0, U64_MAX);
7206 root = sctx->clone_roots[i].root;
7207 ret = btrfs_start_delalloc_snapshot(root);
7210 btrfs_wait_ordered_extents(root, U64_MAX, 0, U64_MAX);
7216 static void btrfs_root_dec_send_in_progress(struct btrfs_root* root)
7218 spin_lock(&root->root_item_lock);
7219 root->send_in_progress--;
7224 if (root->send_in_progress < 0)
7225 btrfs_err(root->fs_info,
7226 "send_in_progress unbalanced %d root %llu",
7227 root->send_in_progress, root->root_key.objectid);
7228 spin_unlock(&root->root_item_lock);
7231 static void dedupe_in_progress_warn(const struct btrfs_root *root)
7233 btrfs_warn_rl(root->fs_info,
7234 "cannot use root %llu for send while deduplications on it are in progress (%d in progress)",
7235 root->root_key.objectid, root->dedupe_in_progress);
7241 struct btrfs_root *send_root = BTRFS_I(file_inode(mnt_file))->root;
7384 sctx->clone_roots[i].root = clone_root;
7421 sctx->clone_roots[sctx->clone_roots_cnt++].root =
7509 sctx->clone_roots[i].root);
7510 btrfs_put_root(sctx->clone_roots[i].root);
7515 sctx->clone_roots[i].root);
7516 btrfs_put_root(sctx->clone_roots[i].root);