Lines Matching refs:root

52 #include "root-tree.h"
262 struct btrfs_root *root = binode->root;
269 if (btrfs_root_readonly(root))
310 trans = btrfs_start_transaction(root, 1);
373 trans = btrfs_start_transaction(root, 3);
573 * 1 to add root block
574 * 1 to add root item
575 * 1 to add root ref
576 * 1 to add root backref
603 struct btrfs_root *root = BTRFS_I(dir)->root;
650 ret = btrfs_subvolume_reserve_metadata(root, &block_rsv,
656 trans = btrfs_start_transaction(root, 0);
661 ret = btrfs_record_root_in_trans(trans, BTRFS_I(dir)->root);
664 btrfs_qgroup_convert_reserved_meta(root, qgroup_reserved);
668 /* Tree log can't currently deal with an inode which is a new root. */
671 ret = btrfs_qgroup_inherit(trans, 0, objectid, btrfs_root_id(root), inherit);
675 leaf = btrfs_alloc_tree_block(trans, root, 0, objectid, NULL, 0, 0, 0,
726 * extent tree with a backreference for a root that does not
748 BTRFS_I(new_inode_args.inode)->root = new_root;
780 btrfs_qgroup_free_meta_prealloc(root, qgroup_reserved);
793 static int create_snapshot(struct btrfs_root *root, struct inode *dir,
813 if (btrfs_root_refs(&root->root_item) == 0)
816 if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))
819 if (atomic_read(&root->nr_swapfiles)) {
848 ret = btrfs_subvolume_reserve_metadata(BTRFS_I(dir)->root, block_rsv,
855 pending_snapshot->root = root;
860 trans = btrfs_start_transaction(root, 0);
865 ret = btrfs_record_root_in_trans(trans, BTRFS_I(dir)->root);
870 btrfs_qgroup_convert_reserved_meta(root, qgroup_reserved);
903 btrfs_qgroup_free_meta_prealloc(root, qgroup_reserved);
929 * 9. We can't remove a root or mountpoint.
1018 error = btrfs_check_dir_item_collision(BTRFS_I(dir)->root,
1025 if (btrfs_root_refs(&BTRFS_I(dir)->root->root_item) == 0)
1047 struct btrfs_root *root,
1059 btrfs_drew_read_lock(&root->snapshot_lock);
1061 ret = btrfs_start_delalloc_snapshot(root, false);
1070 atomic_inc(&root->snapshot_force_cow);
1073 btrfs_wait_ordered_extents(root, U64_MAX, 0, (u64)-1);
1076 root, readonly, inherit);
1079 atomic_dec(&root->snapshot_force_cow);
1080 btrfs_drew_read_unlock(&root->snapshot_lock);
1135 struct btrfs_root *root = BTRFS_I(inode)->root;
1255 trans = btrfs_start_transaction(root, 0);
1321 btrfs_info(BTRFS_I(file_inode(file))->root->fs_info,
1342 BTRFS_I(src_inode)->root,
1438 struct btrfs_root *root = BTRFS_I(inode)->root;
1446 if (btrfs_root_readonly(root))
1461 struct btrfs_root *root = BTRFS_I(inode)->root;
1492 if (!!(flags & BTRFS_SUBVOL_RDONLY) == btrfs_root_readonly(root))
1495 root_flags = btrfs_root_flags(&root->root_item);
1497 btrfs_set_root_flags(&root->root_item,
1504 spin_lock(&root->root_item_lock);
1505 if (root->send_in_progress == 0) {
1506 btrfs_set_root_flags(&root->root_item,
1508 spin_unlock(&root->root_item_lock);
1510 spin_unlock(&root->root_item_lock);
1513 btrfs_root_id(root));
1519 trans = btrfs_start_transaction(root, 1);
1526 &root->root_key, &root->root_item);
1536 btrfs_set_root_flags(&root->root_item, root_flags);
1708 struct btrfs_root *root;
1725 /* search the root of the inode that was passed */
1726 root = btrfs_grab_root(BTRFS_I(inode)->root);
1728 root = btrfs_get_fs_root(info, sk->tree_id, true);
1729 if (IS_ERR(root)) {
1731 return PTR_ERR(root);
1749 ret = btrfs_search_forward(root, &key, path, sk->min_transid);
1766 btrfs_put_root(root);
1841 struct btrfs_root *root;
1863 root = btrfs_get_fs_root(info, tree_id, true);
1864 if (IS_ERR(root)) {
1865 ret = PTR_ERR(root);
1866 root = NULL;
1875 ret = btrfs_search_backwards(root, &key, path);
1910 btrfs_put_root(root);
1919 struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
1922 u64 treeid = btrfs_root_id(BTRFS_I(inode)->root);
1928 struct btrfs_root *root = NULL;
1950 root = btrfs_get_fs_root(fs_info, treeid, true);
1951 if (IS_ERR(root)) {
1952 ret = PTR_ERR(root);
1960 ret = btrfs_search_backwards(root, &key, path);
1985 ret = btrfs_previous_item(root, path, dirid,
2005 * btrfs_iget() needs to lookup the inode from its root
2009 temp_inode = btrfs_iget(sb, key2.objectid, root);
2036 btrfs_put_root(root);
2037 root = NULL;
2073 btrfs_put_root(root);
2079 static noinline int btrfs_ioctl_ino_lookup(struct btrfs_root *root,
2090 * Unprivileged query to obtain the containing subvolume root id. The
2094 args->treeid = btrfs_root_id(root);
2106 ret = btrfs_search_path_in_tree(root->fs_info,
2166 struct btrfs_root *root;
2187 fs_info = BTRFS_I(inode)->root->fs_info;
2190 key.objectid = btrfs_root_id(BTRFS_I(inode)->root);
2191 root = btrfs_get_fs_root(fs_info, key.objectid, true);
2192 if (IS_ERR(root)) {
2193 ret = PTR_ERR(root);
2196 root_item = &root->root_item;
2226 /* Search root tree for ROOT_BACKREF of this subvolume */
2271 btrfs_put_root(root);
2282 static int btrfs_ioctl_get_subvol_rootref(struct btrfs_root *root,
2305 objectid = btrfs_root_id(root);
2311 root = root->fs_info->tree_root;
2312 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
2317 ret = btrfs_next_leaf(root, path);
2346 ret = btrfs_next_item(root, path);
2382 struct btrfs_root *root = BTRFS_I(dir)->root;
2539 dest = BTRFS_I(inode)->root;
2544 * subvol root, and when rmdir(2) would have been
2561 * must be called on the dentry referencing the root
2566 if (root == dest)
2610 struct btrfs_root *root = BTRFS_I(inode)->root;
2618 if (btrfs_root_readonly(root)) {
2629 ret = btrfs_defrag_root(root);
2953 struct btrfs_root *root = BTRFS_I(inode)->root;
2995 trans = btrfs_start_transaction(root, 1);
3180 static noinline long btrfs_ioctl_start_sync(struct btrfs_root *root,
3187 * Start orphan cleanup here for the given root in case it hasn't been
3191 btrfs_orphan_cleanup(root);
3193 trans = btrfs_attach_transaction_barrier(root);
3199 transid = btrfs_get_last_trans_committed(root->fs_info);
3384 static long btrfs_ioctl_ino_to_path(struct btrfs_root *root, void __user *arg)
3411 ipath = init_ipath(size, root, path);
3603 struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
3604 struct btrfs_fs_info *fs_info = root->fs_info;
3772 * blocks of the quota root while we are deleting the root. This
3814 struct btrfs_root *root = BTRFS_I(inode)->root;
3833 trans = btrfs_join_transaction(root);
3866 struct btrfs_root *root = BTRFS_I(inode)->root;
3895 trans = btrfs_join_transaction(root);
3921 struct btrfs_root *root = BTRFS_I(inode)->root;
3941 trans = btrfs_join_transaction(root);
3950 qgroupid = btrfs_root_id(root);
4034 struct btrfs_root *root = BTRFS_I(inode)->root;
4035 struct btrfs_root_item *root_item = &root->root_item;
4055 if (btrfs_root_readonly(root)) {
4061 * 1 - root item
4064 trans = btrfs_start_transaction(root, 3);
4081 btrfs_root_id(root));
4097 &root->root_key, &root->root_item);
4105 btrfs_root_id(root));
4222 struct btrfs_root *root = BTRFS_I(inode)->root;
4245 trans = btrfs_start_transaction(root, 0);
4365 struct btrfs_root *root = BTRFS_I(inode)->root;
4402 trans = btrfs_start_transaction(root, 0);
4656 struct btrfs_root *root = BTRFS_I(inode)->root;
4707 return btrfs_ioctl_ino_lookup(root, argp);
4709 return btrfs_ioctl_ino_to_path(root, argp);
4732 return btrfs_ioctl_start_sync(root, argp);
4786 return btrfs_ioctl_get_subvol_rootref(root, argp);