Lines Matching defs:root
56 #include "root-tree.h"
252 struct btrfs_root *root = binode->root;
259 if (btrfs_root_readonly(root))
300 trans = btrfs_start_transaction(root, 1);
363 trans = btrfs_start_transaction(root, 3);
388 ret = btrfs_update_inode(trans, root, BTRFS_I(inode));
563 * 1 to add root block
564 * 1 to add root item
565 * 1 to add root ref
566 * 1 to add root backref
593 struct btrfs_root *root = BTRFS_I(dir)->root;
639 ret = btrfs_subvolume_reserve_metadata(root, &block_rsv,
644 trans = btrfs_start_transaction(root, 0);
647 btrfs_subvolume_release_metadata(root, &block_rsv);
652 /* Tree log can't currently deal with an inode which is a new root. */
659 leaf = btrfs_alloc_tree_block(trans, root, 0, objectid, NULL, 0, 0, 0,
710 * extent tree with a backreference for a root that does not
732 BTRFS_I(new_inode_args.inode)->root = new_root;
760 btrfs_subvolume_release_metadata(root, &block_rsv);
775 static int create_snapshot(struct btrfs_root *root, struct inode *dir,
793 if (btrfs_root_refs(&root->root_item) == 0)
796 if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))
799 if (atomic_read(&root->nr_swapfiles)) {
828 ret = btrfs_subvolume_reserve_metadata(BTRFS_I(dir)->root,
835 pending_snapshot->root = root;
840 trans = btrfs_start_transaction(root, 0);
874 btrfs_subvolume_release_metadata(root, &pending_snapshot->block_rsv);
900 * 9. We can't remove a root or mountpoint.
987 error = btrfs_check_dir_item_collision(BTRFS_I(dir)->root,
994 if (btrfs_root_refs(&BTRFS_I(dir)->root->root_item) == 0)
1016 struct btrfs_root *root,
1028 btrfs_drew_read_lock(&root->snapshot_lock);
1030 ret = btrfs_start_delalloc_snapshot(root, false);
1039 atomic_inc(&root->snapshot_force_cow);
1042 btrfs_wait_ordered_extents(root, U64_MAX, 0, (u64)-1);
1045 root, readonly, inherit);
1048 atomic_dec(&root->snapshot_force_cow);
1049 btrfs_drew_read_unlock(&root->snapshot_lock);
1104 struct btrfs_root *root = BTRFS_I(inode)->root;
1221 trans = btrfs_start_transaction(root, 0);
1287 btrfs_info(BTRFS_I(file_inode(file))->root->fs_info,
1308 BTRFS_I(src_inode)->root,
1409 struct btrfs_root *root = BTRFS_I(inode)->root;
1417 if (btrfs_root_readonly(root))
1432 struct btrfs_root *root = BTRFS_I(inode)->root;
1463 if (!!(flags & BTRFS_SUBVOL_RDONLY) == btrfs_root_readonly(root))
1466 root_flags = btrfs_root_flags(&root->root_item);
1468 btrfs_set_root_flags(&root->root_item,
1475 spin_lock(&root->root_item_lock);
1476 if (root->send_in_progress == 0) {
1477 btrfs_set_root_flags(&root->root_item,
1479 spin_unlock(&root->root_item_lock);
1481 spin_unlock(&root->root_item_lock);
1484 root->root_key.objectid);
1490 trans = btrfs_start_transaction(root, 1);
1497 &root->root_key, &root->root_item);
1507 btrfs_set_root_flags(&root->root_item, root_flags);
1679 struct btrfs_root *root;
1696 /* search the root of the inode that was passed */
1697 root = btrfs_grab_root(BTRFS_I(inode)->root);
1699 root = btrfs_get_fs_root(info, sk->tree_id, true);
1700 if (IS_ERR(root)) {
1702 return PTR_ERR(root);
1720 ret = btrfs_search_forward(root, &key, path, sk->min_transid);
1737 btrfs_put_root(root);
1812 struct btrfs_root *root;
1834 root = btrfs_get_fs_root(info, tree_id, true);
1835 if (IS_ERR(root)) {
1836 ret = PTR_ERR(root);
1837 root = NULL;
1846 ret = btrfs_search_backwards(root, &key, path);
1881 btrfs_put_root(root);
1890 struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
1893 u64 treeid = BTRFS_I(inode)->root->root_key.objectid;
1899 struct btrfs_root *root = NULL;
1921 root = btrfs_get_fs_root(fs_info, treeid, true);
1922 if (IS_ERR(root)) {
1923 ret = PTR_ERR(root);
1931 ret = btrfs_search_backwards(root, &key, path);
1956 ret = btrfs_previous_item(root, path, dirid,
1976 * btrfs_iget() needs to lookup the inode from its root
1980 temp_inode = btrfs_iget(sb, key2.objectid, root);
2007 btrfs_put_root(root);
2008 root = NULL;
2044 btrfs_put_root(root);
2050 static noinline int btrfs_ioctl_ino_lookup(struct btrfs_root *root,
2061 * Unprivileged query to obtain the containing subvolume root id. The
2065 args->treeid = root->root_key.objectid;
2077 ret = btrfs_search_path_in_tree(root->fs_info,
2137 struct btrfs_root *root;
2158 fs_info = BTRFS_I(inode)->root->fs_info;
2161 key.objectid = BTRFS_I(inode)->root->root_key.objectid;
2162 root = btrfs_get_fs_root(fs_info, key.objectid, true);
2163 if (IS_ERR(root)) {
2164 ret = PTR_ERR(root);
2167 root_item = &root->root_item;
2197 /* Search root tree for ROOT_BACKREF of this subvolume */
2242 btrfs_put_root(root);
2253 static int btrfs_ioctl_get_subvol_rootref(struct btrfs_root *root,
2276 objectid = root->root_key.objectid;
2282 root = root->fs_info->tree_root;
2283 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
2288 ret = btrfs_next_leaf(root, path);
2317 ret = btrfs_next_item(root, path);
2353 struct btrfs_root *root = BTRFS_I(dir)->root;
2505 dest = BTRFS_I(inode)->root;
2510 * subvol root, and when rmdir(2) would have been
2527 * must be called on the dentry referencing the root
2532 if (root == dest)
2576 struct btrfs_root *root = BTRFS_I(inode)->root;
2584 if (btrfs_root_readonly(root)) {
2595 ret = btrfs_defrag_root(root);
2904 struct btrfs_root *root = BTRFS_I(inode)->root;
2946 trans = btrfs_start_transaction(root, 1);
3131 static noinline long btrfs_ioctl_start_sync(struct btrfs_root *root,
3138 * Start orphan cleanup here for the given root in case it hasn't been
3142 btrfs_orphan_cleanup(root);
3144 trans = btrfs_attach_transaction_barrier(root);
3150 transid = root->fs_info->last_trans_committed;
3335 static long btrfs_ioctl_ino_to_path(struct btrfs_root *root, void __user *arg)
3362 ipath = init_ipath(size, root, path);
3554 struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
3555 struct btrfs_fs_info *fs_info = root->fs_info;
3737 struct btrfs_root *root = BTRFS_I(inode)->root;
3756 trans = btrfs_join_transaction(root);
3789 struct btrfs_root *root = BTRFS_I(inode)->root;
3818 trans = btrfs_join_transaction(root);
3844 struct btrfs_root *root = BTRFS_I(inode)->root;
3864 trans = btrfs_join_transaction(root);
3873 qgroupid = root->root_key.objectid;
3957 struct btrfs_root *root = BTRFS_I(inode)->root;
3958 struct btrfs_root_item *root_item = &root->root_item;
3978 if (btrfs_root_readonly(root)) {
3984 * 1 - root item
3987 trans = btrfs_start_transaction(root, 3);
4004 root->root_key.objectid);
4020 &root->root_key, &root->root_item);
4028 root->root_key.objectid);
4145 struct btrfs_root *root = BTRFS_I(inode)->root;
4168 trans = btrfs_start_transaction(root, 0);
4288 struct btrfs_root *root = BTRFS_I(inode)->root;
4325 trans = btrfs_start_transaction(root, 0);
4579 struct btrfs_root *root = BTRFS_I(inode)->root;
4630 return btrfs_ioctl_ino_lookup(root, argp);
4632 return btrfs_ioctl_ino_to_path(root, argp);
4655 return btrfs_ioctl_start_sync(root, argp);
4709 return btrfs_ioctl_get_subvol_rootref(root, argp);