• Home
  • Raw
  • Download

Lines Matching refs:root

219 	struct btrfs_root *root = ip->root;  in btrfs_ioctl_setflags()  local
230 if (btrfs_root_readonly(root)) in btrfs_ioctl_setflags()
327 if (root->fs_info->compress_type == BTRFS_COMPRESS_LZO) in btrfs_ioctl_setflags()
343 trans = btrfs_start_transaction(root, 1); in btrfs_ioctl_setflags()
352 ret = btrfs_update_inode(trans, root, inode); in btrfs_ioctl_setflags()
354 btrfs_end_transaction(trans, root); in btrfs_ioctl_setflags()
447 struct btrfs_root *root = BTRFS_I(dir)->root; in create_subvol() local
460 ret = btrfs_find_free_objectid(root->fs_info->tree_root, &objectid); in create_subvol()
476 ret = btrfs_subvolume_reserve_metadata(root, &block_rsv, in create_subvol()
481 trans = btrfs_start_transaction(root, 0); in create_subvol()
484 btrfs_subvolume_release_metadata(root, &block_rsv, in create_subvol()
491 ret = btrfs_qgroup_inherit(trans, root->fs_info, 0, objectid, inherit); in create_subvol()
495 leaf = btrfs_alloc_tree_block(trans, root, 0, objectid, NULL, 0, 0, 0); in create_subvol()
507 write_extent_buffer(leaf, root->fs_info->fsid, btrfs_header_fsid(), in create_subvol()
509 write_extent_buffer(leaf, root->fs_info->chunk_tree_uuid, in create_subvol()
520 btrfs_set_stack_inode_nbytes(inode_item, root->nodesize); in create_subvol()
553 ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key, in create_subvol()
559 new_root = btrfs_read_fs_root_no_name(root->fs_info, &key); in create_subvol()
562 btrfs_abort_transaction(trans, root, ret); in create_subvol()
568 ret = btrfs_create_subvol_root(trans, new_root, root, new_dirid); in create_subvol()
571 btrfs_abort_transaction(trans, root, ret); in create_subvol()
584 btrfs_abort_transaction(trans, root, ret); in create_subvol()
588 ret = btrfs_insert_dir_item(trans, root, in create_subvol()
592 btrfs_abort_transaction(trans, root, ret); in create_subvol()
597 ret = btrfs_update_inode(trans, root, dir); in create_subvol()
599 btrfs_abort_transaction(trans, root, ret); in create_subvol()
603 ret = btrfs_add_root_ref(trans, root->fs_info->tree_root, in create_subvol()
604 objectid, root->root_key.objectid, in create_subvol()
607 btrfs_abort_transaction(trans, root, ret); in create_subvol()
611 ret = btrfs_uuid_tree_add(trans, root->fs_info->uuid_root, in create_subvol()
615 btrfs_abort_transaction(trans, root, ret); in create_subvol()
620 btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved); in create_subvol()
624 err = btrfs_commit_transaction_async(trans, root, 1); in create_subvol()
626 err = btrfs_commit_transaction(trans, root); in create_subvol()
628 err = btrfs_commit_transaction(trans, root); in create_subvol()
642 static void btrfs_wait_for_no_snapshoting_writes(struct btrfs_root *root) in btrfs_wait_for_no_snapshoting_writes() argument
648 prepare_to_wait(&root->subv_writers->wait, &wait, in btrfs_wait_for_no_snapshoting_writes()
651 writers = percpu_counter_sum(&root->subv_writers->counter); in btrfs_wait_for_no_snapshoting_writes()
655 finish_wait(&root->subv_writers->wait, &wait); in btrfs_wait_for_no_snapshoting_writes()
659 static int create_snapshot(struct btrfs_root *root, struct inode *dir, in create_snapshot() argument
669 if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state)) in create_snapshot()
672 atomic_inc(&root->will_be_snapshoted); in create_snapshot()
674 btrfs_wait_for_no_snapshoting_writes(root); in create_snapshot()
676 ret = btrfs_start_delalloc_inodes(root, 0); in create_snapshot()
680 btrfs_wait_ordered_extents(root, -1); in create_snapshot()
698 ret = btrfs_subvolume_reserve_metadata(BTRFS_I(dir)->root, in create_snapshot()
706 pending_snapshot->root = root; in create_snapshot()
711 trans = btrfs_start_transaction(root, 0); in create_snapshot()
717 spin_lock(&root->fs_info->trans_lock); in create_snapshot()
720 spin_unlock(&root->fs_info->trans_lock); in create_snapshot()
724 root->fs_info->extent_root, 1); in create_snapshot()
726 ret = btrfs_commit_transaction(trans, root); in create_snapshot()
729 root->fs_info->extent_root); in create_snapshot()
751 btrfs_subvolume_release_metadata(BTRFS_I(dir)->root, in create_snapshot()
757 if (atomic_dec_and_test(&root->will_be_snapshoted)) in create_snapshot()
758 wake_up_atomic_t(&root->will_be_snapshoted); in create_snapshot()
860 error = btrfs_check_dir_item_collision(BTRFS_I(dir)->root, in btrfs_mksubvol()
866 down_read(&BTRFS_I(dir)->root->fs_info->subvol_sem); in btrfs_mksubvol()
868 if (btrfs_root_refs(&BTRFS_I(dir)->root->root_item) == 0) in btrfs_mksubvol()
881 up_read(&BTRFS_I(dir)->root->fs_info->subvol_sem); in btrfs_mksubvol()
929 static int find_new_extents(struct btrfs_root *root, in find_new_extents() argument
950 ret = btrfs_search_forward(root, &min_key, path, newer_than); in find_new_extents()
1265 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_defrag_file() local
1329 ret = find_new_extents(root, inode, newer_than, in btrfs_defrag_file()
1362 if (btrfs_defrag_cancelled(root->fs_info)) { in btrfs_defrag_file()
1363 btrfs_debug(root->fs_info, "defrag_file cancelled"); in btrfs_defrag_file()
1420 ret = find_new_extents(root, inode, in btrfs_defrag_file()
1452 atomic_inc(&root->fs_info->async_submit_draining); in btrfs_defrag_file()
1453 while (atomic_read(&root->fs_info->nr_async_submits) || in btrfs_defrag_file()
1454 atomic_read(&root->fs_info->async_delalloc_pages)) { in btrfs_defrag_file()
1455 wait_event(root->fs_info->async_submit_wait, in btrfs_defrag_file()
1456 (atomic_read(&root->fs_info->nr_async_submits) == 0 && in btrfs_defrag_file()
1457 atomic_read(&root->fs_info->async_delalloc_pages) == 0)); in btrfs_defrag_file()
1459 atomic_dec(&root->fs_info->async_submit_draining); in btrfs_defrag_file()
1463 btrfs_set_fs_incompat(root->fs_info, COMPRESS_LZO); in btrfs_defrag_file()
1486 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_resize() local
1503 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, in btrfs_ioctl_resize()
1509 mutex_lock(&root->fs_info->volume_mutex); in btrfs_ioctl_resize()
1531 btrfs_info(root->fs_info, "resizing devid %llu", devid); in btrfs_ioctl_resize()
1534 device = btrfs_find_device(root->fs_info, devid, NULL, NULL); in btrfs_ioctl_resize()
1536 btrfs_info(root->fs_info, "resizer unable to find device %llu", in btrfs_ioctl_resize()
1543 btrfs_info(root->fs_info, in btrfs_ioctl_resize()
1597 new_size = div_u64(new_size, root->sectorsize); in btrfs_ioctl_resize()
1598 new_size *= root->sectorsize; in btrfs_ioctl_resize()
1600 btrfs_info_in_rcu(root->fs_info, "new size for %s is %llu", in btrfs_ioctl_resize()
1604 trans = btrfs_start_transaction(root, 0); in btrfs_ioctl_resize()
1610 btrfs_commit_transaction(trans, root); in btrfs_ioctl_resize()
1618 mutex_unlock(&root->fs_info->volume_mutex); in btrfs_ioctl_resize()
1619 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); in btrfs_ioctl_resize()
1664 btrfs_info(BTRFS_I(file_inode(file))->root->fs_info, in btrfs_ioctl_snap_create_transid()
1675 BTRFS_I(src_inode)->root, in btrfs_ioctl_snap_create_transid()
1772 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_ioctl_subvol_getflags() local
1779 down_read(&root->fs_info->subvol_sem); in btrfs_ioctl_subvol_getflags()
1780 if (btrfs_root_readonly(root)) in btrfs_ioctl_subvol_getflags()
1782 up_read(&root->fs_info->subvol_sem); in btrfs_ioctl_subvol_getflags()
1794 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_ioctl_subvol_setflags() local
1827 down_write(&root->fs_info->subvol_sem); in btrfs_ioctl_subvol_setflags()
1830 if (!!(flags & BTRFS_SUBVOL_RDONLY) == btrfs_root_readonly(root)) in btrfs_ioctl_subvol_setflags()
1833 root_flags = btrfs_root_flags(&root->root_item); in btrfs_ioctl_subvol_setflags()
1835 btrfs_set_root_flags(&root->root_item, in btrfs_ioctl_subvol_setflags()
1842 spin_lock(&root->root_item_lock); in btrfs_ioctl_subvol_setflags()
1843 if (root->send_in_progress == 0) { in btrfs_ioctl_subvol_setflags()
1844 btrfs_set_root_flags(&root->root_item, in btrfs_ioctl_subvol_setflags()
1846 spin_unlock(&root->root_item_lock); in btrfs_ioctl_subvol_setflags()
1848 spin_unlock(&root->root_item_lock); in btrfs_ioctl_subvol_setflags()
1849 btrfs_warn(root->fs_info, in btrfs_ioctl_subvol_setflags()
1851 root->root_key.objectid); in btrfs_ioctl_subvol_setflags()
1857 trans = btrfs_start_transaction(root, 1); in btrfs_ioctl_subvol_setflags()
1863 ret = btrfs_update_root(trans, root->fs_info->tree_root, in btrfs_ioctl_subvol_setflags()
1864 &root->root_key, &root->root_item); in btrfs_ioctl_subvol_setflags()
1866 btrfs_commit_transaction(trans, root); in btrfs_ioctl_subvol_setflags()
1869 btrfs_set_root_flags(&root->root_item, root_flags); in btrfs_ioctl_subvol_setflags()
1871 up_write(&root->fs_info->subvol_sem); in btrfs_ioctl_subvol_setflags()
1881 static noinline int may_destroy_subvol(struct btrfs_root *root) in may_destroy_subvol() argument
1894 dir_id = btrfs_super_root_dir(root->fs_info->super_copy); in may_destroy_subvol()
1895 di = btrfs_lookup_dir_item(NULL, root->fs_info->tree_root, path, in may_destroy_subvol()
1899 if (key.objectid == root->root_key.objectid) { in may_destroy_subvol()
1901 btrfs_err(root->fs_info, "deleting default subvolume " in may_destroy_subvol()
1908 key.objectid = root->root_key.objectid; in may_destroy_subvol()
1912 ret = btrfs_search_slot(NULL, root->fs_info->tree_root, in may_destroy_subvol()
1922 if (key.objectid == root->root_key.objectid && in may_destroy_subvol()
1955 static noinline int copy_to_sk(struct btrfs_root *root, in copy_to_sk() argument
2094 struct btrfs_root *root; in search_ioctl() local
2097 struct btrfs_fs_info *info = BTRFS_I(inode)->root->fs_info; in search_ioctl()
2113 root = BTRFS_I(inode)->root; in search_ioctl()
2118 root = btrfs_read_fs_root_no_name(info, &key); in search_ioctl()
2119 if (IS_ERR(root)) { in search_ioctl()
2137 ret = btrfs_search_forward(root, &key, path, sk->min_transid); in search_ioctl()
2143 ret = copy_to_sk(root, path, &key, sk, buf_size, ubuf, in search_ioctl()
2238 struct btrfs_root *root; in btrfs_search_path_in_tree() local
2263 root = btrfs_read_fs_root_no_name(info, &key); in btrfs_search_path_in_tree()
2264 if (IS_ERR(root)) { in btrfs_search_path_in_tree()
2275 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_search_path_in_tree()
2279 ret = btrfs_previous_item(root, path, dirid, in btrfs_search_path_in_tree()
2339 args->treeid = BTRFS_I(inode)->root->root_key.objectid; in btrfs_ioctl_ino_lookup()
2351 ret = btrfs_search_path_in_tree(BTRFS_I(inode)->root->fs_info, in btrfs_ioctl_ino_lookup()
2370 struct btrfs_root *root = BTRFS_I(dir)->root; in btrfs_ioctl_snap_destroy() local
2416 dest = BTRFS_I(inode)->root; in btrfs_ioctl_snap_destroy()
2432 if (!btrfs_test_opt(root, USER_SUBVOL_RM_ALLOWED)) in btrfs_ioctl_snap_destroy()
2443 if (root == dest) in btrfs_ioctl_snap_destroy()
2476 btrfs_warn(root->fs_info, in btrfs_ioctl_snap_destroy()
2483 down_write(&root->fs_info->subvol_sem); in btrfs_ioctl_snap_destroy()
2494 err = btrfs_subvolume_reserve_metadata(root, &block_rsv, in btrfs_ioctl_snap_destroy()
2499 trans = btrfs_start_transaction(root, 0); in btrfs_ioctl_snap_destroy()
2507 ret = btrfs_unlink_subvol(trans, root, dir, in btrfs_ioctl_snap_destroy()
2513 btrfs_abort_transaction(trans, root, ret); in btrfs_ioctl_snap_destroy()
2526 root->fs_info->tree_root, in btrfs_ioctl_snap_destroy()
2529 btrfs_abort_transaction(trans, root, ret); in btrfs_ioctl_snap_destroy()
2535 ret = btrfs_uuid_tree_rem(trans, root->fs_info->uuid_root, in btrfs_ioctl_snap_destroy()
2539 btrfs_abort_transaction(trans, root, ret); in btrfs_ioctl_snap_destroy()
2544 ret = btrfs_uuid_tree_rem(trans, root->fs_info->uuid_root, in btrfs_ioctl_snap_destroy()
2549 btrfs_abort_transaction(trans, root, ret); in btrfs_ioctl_snap_destroy()
2560 ret = btrfs_end_transaction(trans, root); in btrfs_ioctl_snap_destroy()
2565 btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved); in btrfs_ioctl_snap_destroy()
2567 up_write(&root->fs_info->subvol_sem); in btrfs_ioctl_snap_destroy()
2603 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_ioctl_defrag() local
2611 if (btrfs_root_readonly(root)) { in btrfs_ioctl_defrag()
2622 ret = btrfs_defrag_root(root); in btrfs_ioctl_defrag()
2625 ret = btrfs_defrag_root(root->fs_info->extent_root); in btrfs_ioctl_defrag()
2669 static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg) in btrfs_ioctl_add_dev() argument
2677 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, in btrfs_ioctl_add_dev()
2682 mutex_lock(&root->fs_info->volume_mutex); in btrfs_ioctl_add_dev()
2690 ret = btrfs_init_new_device(root, vol_args->name); in btrfs_ioctl_add_dev()
2693 btrfs_info(root->fs_info, "disk added %s",vol_args->name); in btrfs_ioctl_add_dev()
2697 mutex_unlock(&root->fs_info->volume_mutex); in btrfs_ioctl_add_dev()
2698 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); in btrfs_ioctl_add_dev()
2704 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_rm_dev() local
2723 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, in btrfs_ioctl_rm_dev()
2729 mutex_lock(&root->fs_info->volume_mutex); in btrfs_ioctl_rm_dev()
2730 ret = btrfs_rm_device(root, vol_args->name); in btrfs_ioctl_rm_dev()
2731 mutex_unlock(&root->fs_info->volume_mutex); in btrfs_ioctl_rm_dev()
2732 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); in btrfs_ioctl_rm_dev()
2735 btrfs_info(root->fs_info, "disk deleted %s",vol_args->name); in btrfs_ioctl_rm_dev()
2744 static long btrfs_ioctl_fs_info(struct btrfs_root *root, void __user *arg) in btrfs_ioctl_fs_info() argument
2748 struct btrfs_fs_devices *fs_devices = root->fs_info->fs_devices; in btrfs_ioctl_fs_info()
2757 memcpy(&fi_args->fsid, root->fs_info->fsid, sizeof(fi_args->fsid)); in btrfs_ioctl_fs_info()
2765 fi_args->nodesize = root->fs_info->super_copy->nodesize; in btrfs_ioctl_fs_info()
2766 fi_args->sectorsize = root->fs_info->super_copy->sectorsize; in btrfs_ioctl_fs_info()
2767 fi_args->clone_alignment = root->fs_info->super_copy->sectorsize; in btrfs_ioctl_fs_info()
2776 static long btrfs_ioctl_dev_info(struct btrfs_root *root, void __user *arg) in btrfs_ioctl_dev_info() argument
2780 struct btrfs_fs_devices *fs_devices = root->fs_info->fs_devices; in btrfs_ioctl_dev_info()
2792 dev = btrfs_find_device(root->fs_info, di_args->devid, s_uuid, NULL); in btrfs_ioctl_dev_info()
3063 u64 bs = BTRFS_I(inode)->root->fs_info->sb->s_blocksize; in extent_same_check_offsets()
3223 u64 bs = BTRFS_I(src)->root->fs_info->sb->s_blocksize; in btrfs_ioctl_file_extent_same()
3327 struct btrfs_root *root = BTRFS_I(inode)->root; in clone_finish_inode_update() local
3342 ret = btrfs_update_inode(trans, root, inode); in clone_finish_inode_update()
3344 btrfs_abort_transaction(trans, root, ret); in clone_finish_inode_update()
3345 btrfs_end_transaction(trans, root); in clone_finish_inode_update()
3348 ret = btrfs_end_transaction(trans, root); in clone_finish_inode_update()
3446 struct btrfs_root *root = BTRFS_I(dst)->root; in clone_copy_inline_extent() local
3448 root->sectorsize); in clone_copy_inline_extent()
3458 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in clone_copy_inline_extent()
3463 ret = btrfs_next_leaf(root, path); in clone_copy_inline_extent()
3498 ret = btrfs_next_item(root, path); in clone_copy_inline_extent()
3532 ret = btrfs_drop_extents(trans, root, dst, drop_start, aligned_end, 1); in clone_copy_inline_extent()
3535 ret = btrfs_insert_empty_item(trans, root, path, new_key, size); in clone_copy_inline_extent()
3569 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_clone() local
3582 buf = vmalloc(root->nodesize); in btrfs_clone()
3606 ret = btrfs_search_slot(NULL, BTRFS_I(src)->root, &key, path, in btrfs_clone()
3625 ret = btrfs_next_leaf(BTRFS_I(src)->root, path); in btrfs_clone()
3713 trans = btrfs_start_transaction(root, 3); in btrfs_clone()
3736 ret = btrfs_drop_extents(trans, root, inode, in btrfs_clone()
3743 root, ret); in btrfs_clone()
3744 btrfs_end_transaction(trans, root); in btrfs_clone()
3748 ret = btrfs_insert_empty_item(trans, root, path, in btrfs_clone()
3751 btrfs_abort_transaction(trans, root, in btrfs_clone()
3753 btrfs_end_transaction(trans, root); in btrfs_clone()
3777 ret = btrfs_inc_extent_ref(trans, root, in btrfs_clone()
3779 root->root_key.objectid, in btrfs_clone()
3784 root, in btrfs_clone()
3787 root); in btrfs_clone()
3806 btrfs_end_transaction(trans, root); in btrfs_clone()
3821 root, in btrfs_clone()
3823 btrfs_end_transaction(trans, root); in btrfs_clone()
3842 root->sectorsize); in btrfs_clone()
3875 trans = btrfs_start_transaction(root, 2); in btrfs_clone()
3880 ret = btrfs_drop_extents(trans, root, inode, in btrfs_clone()
3884 btrfs_abort_transaction(trans, root, ret); in btrfs_clone()
3885 btrfs_end_transaction(trans, root); in btrfs_clone()
3904 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_ioctl_clone() local
3909 u64 bs = root->fs_info->sb->s_blocksize; in btrfs_ioctl_clone()
3927 if (btrfs_root_readonly(root)) in btrfs_ioctl_clone()
4084 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_ioctl_trans_start() local
4097 if (btrfs_root_readonly(root)) in btrfs_ioctl_trans_start()
4104 atomic_inc(&root->fs_info->open_ioctl_trans); in btrfs_ioctl_trans_start()
4107 trans = btrfs_start_ioctl_transaction(root); in btrfs_ioctl_trans_start()
4115 atomic_dec(&root->fs_info->open_ioctl_trans); in btrfs_ioctl_trans_start()
4124 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_ioctl_default_subvol() local
4154 new_root = btrfs_read_fs_root_no_name(root->fs_info, &location); in btrfs_ioctl_default_subvol()
4171 trans = btrfs_start_transaction(root, 1); in btrfs_ioctl_default_subvol()
4178 dir_id = btrfs_super_root_dir(root->fs_info->super_copy); in btrfs_ioctl_default_subvol()
4179 di = btrfs_lookup_dir_item(trans, root->fs_info->tree_root, path, in btrfs_ioctl_default_subvol()
4183 btrfs_end_transaction(trans, root); in btrfs_ioctl_default_subvol()
4195 btrfs_set_fs_incompat(root->fs_info, DEFAULT_SUBVOL); in btrfs_ioctl_default_subvol()
4196 btrfs_end_transaction(trans, root); in btrfs_ioctl_default_subvol()
4218 static long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg) in btrfs_ioctl_space_info() argument
4246 list_for_each_entry_rcu(tmp, &root->fs_info->space_info, in btrfs_ioctl_space_info()
4302 list_for_each_entry_rcu(tmp, &root->fs_info->space_info, in btrfs_ioctl_space_info()
4333 struct btrfs_block_rsv *block_rsv = &root->fs_info->global_block_rsv; in btrfs_ioctl_space_info()
4367 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_ioctl_trans_end() local
4375 btrfs_end_transaction(trans, root); in btrfs_ioctl_trans_end()
4377 atomic_dec(&root->fs_info->open_ioctl_trans); in btrfs_ioctl_trans_end()
4383 static noinline long btrfs_ioctl_start_sync(struct btrfs_root *root, in btrfs_ioctl_start_sync() argument
4390 trans = btrfs_attach_transaction_barrier(root); in btrfs_ioctl_start_sync()
4396 transid = root->fs_info->last_trans_committed; in btrfs_ioctl_start_sync()
4400 ret = btrfs_commit_transaction_async(trans, root, 0); in btrfs_ioctl_start_sync()
4402 btrfs_end_transaction(trans, root); in btrfs_ioctl_start_sync()
4412 static noinline long btrfs_ioctl_wait_sync(struct btrfs_root *root, in btrfs_ioctl_wait_sync() argument
4423 return btrfs_wait_for_commit(root, transid); in btrfs_ioctl_wait_sync()
4428 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_scrub() local
4445 ret = btrfs_scrub_dev(root->fs_info, sa->devid, sa->start, sa->end, in btrfs_ioctl_scrub()
4459 static long btrfs_ioctl_scrub_cancel(struct btrfs_root *root, void __user *arg) in btrfs_ioctl_scrub_cancel() argument
4464 return btrfs_scrub_cancel(root->fs_info); in btrfs_ioctl_scrub_cancel()
4467 static long btrfs_ioctl_scrub_progress(struct btrfs_root *root, in btrfs_ioctl_scrub_progress() argument
4480 ret = btrfs_scrub_progress(root, sa->devid, &sa->progress); in btrfs_ioctl_scrub_progress()
4489 static long btrfs_ioctl_get_dev_stats(struct btrfs_root *root, in btrfs_ioctl_get_dev_stats() argument
4504 ret = btrfs_get_dev_stats(root, sa); in btrfs_ioctl_get_dev_stats()
4513 static long btrfs_ioctl_dev_replace(struct btrfs_root *root, void __user *arg) in btrfs_ioctl_dev_replace() argument
4527 if (root->fs_info->sb->s_flags & MS_RDONLY) { in btrfs_ioctl_dev_replace()
4532 &root->fs_info->mutually_exclusive_operation_running, in btrfs_ioctl_dev_replace()
4536 ret = btrfs_dev_replace_start(root, p); in btrfs_ioctl_dev_replace()
4538 &root->fs_info->mutually_exclusive_operation_running, in btrfs_ioctl_dev_replace()
4543 btrfs_dev_replace_status(root->fs_info, p); in btrfs_ioctl_dev_replace()
4547 ret = btrfs_dev_replace_cancel(root->fs_info, p); in btrfs_ioctl_dev_replace()
4561 static long btrfs_ioctl_ino_to_path(struct btrfs_root *root, void __user *arg) in btrfs_ioctl_ino_to_path() argument
4588 ipath = init_ipath(size, root, path); in btrfs_ioctl_ino_to_path()
4620 static int build_ino_list(u64 inum, u64 offset, u64 root, void *ctx) in build_ino_list() argument
4629 inodes->val[inodes->elem_cnt + 2] = root; in build_ino_list()
4640 static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root, in btrfs_ioctl_logical_to_ino() argument
4673 ret = iterate_inodes_from_logical(loi->logical, root->fs_info, path, in btrfs_ioctl_logical_to_ino()
4722 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_balance() local
4723 struct btrfs_fs_info *fs_info = root->fs_info; in btrfs_ioctl_balance()
4869 static long btrfs_ioctl_balance_ctl(struct btrfs_root *root, int cmd) in btrfs_ioctl_balance_ctl() argument
4876 return btrfs_pause_balance(root->fs_info); in btrfs_ioctl_balance_ctl()
4878 return btrfs_cancel_balance(root->fs_info); in btrfs_ioctl_balance_ctl()
4884 static long btrfs_ioctl_balance_progress(struct btrfs_root *root, in btrfs_ioctl_balance_progress() argument
4887 struct btrfs_fs_info *fs_info = root->fs_info; in btrfs_ioctl_balance_progress()
4919 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_quota_ctl() local
4938 down_write(&root->fs_info->subvol_sem); in btrfs_ioctl_quota_ctl()
4939 trans = btrfs_start_transaction(root->fs_info->tree_root, 2); in btrfs_ioctl_quota_ctl()
4947 ret = btrfs_quota_enable(trans, root->fs_info); in btrfs_ioctl_quota_ctl()
4950 ret = btrfs_quota_disable(trans, root->fs_info); in btrfs_ioctl_quota_ctl()
4957 err = btrfs_commit_transaction(trans, root->fs_info->tree_root); in btrfs_ioctl_quota_ctl()
4962 up_write(&root->fs_info->subvol_sem); in btrfs_ioctl_quota_ctl()
4970 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_qgroup_assign() local
4989 trans = btrfs_join_transaction(root); in btrfs_ioctl_qgroup_assign()
4997 ret = btrfs_add_qgroup_relation(trans, root->fs_info, in btrfs_ioctl_qgroup_assign()
5000 ret = btrfs_del_qgroup_relation(trans, root->fs_info, in btrfs_ioctl_qgroup_assign()
5005 err = btrfs_run_qgroups(trans, root->fs_info); in btrfs_ioctl_qgroup_assign()
5007 btrfs_std_error(root->fs_info, ret, in btrfs_ioctl_qgroup_assign()
5009 err = btrfs_end_transaction(trans, root); in btrfs_ioctl_qgroup_assign()
5022 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_qgroup_create() local
5046 trans = btrfs_join_transaction(root); in btrfs_ioctl_qgroup_create()
5054 ret = btrfs_create_qgroup(trans, root->fs_info, sa->qgroupid); in btrfs_ioctl_qgroup_create()
5056 ret = btrfs_remove_qgroup(trans, root->fs_info, sa->qgroupid); in btrfs_ioctl_qgroup_create()
5059 err = btrfs_end_transaction(trans, root); in btrfs_ioctl_qgroup_create()
5072 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_qgroup_limit() local
5092 trans = btrfs_join_transaction(root); in btrfs_ioctl_qgroup_limit()
5101 qgroupid = root->root_key.objectid; in btrfs_ioctl_qgroup_limit()
5105 ret = btrfs_limit_qgroup(trans, root->fs_info, qgroupid, &sa->lim); in btrfs_ioctl_qgroup_limit()
5107 err = btrfs_end_transaction(trans, root); in btrfs_ioctl_qgroup_limit()
5120 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_quota_rescan() local
5142 ret = btrfs_qgroup_rescan(root->fs_info); in btrfs_ioctl_quota_rescan()
5153 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_quota_rescan_status() local
5164 if (root->fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN) { in btrfs_ioctl_quota_rescan_status()
5166 qsa->progress = root->fs_info->qgroup_rescan_progress.objectid; in btrfs_ioctl_quota_rescan_status()
5178 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_quota_rescan_wait() local
5183 return btrfs_qgroup_wait_for_completion(root->fs_info, true); in btrfs_ioctl_quota_rescan_wait()
5190 struct btrfs_root *root = BTRFS_I(inode)->root; in _btrfs_ioctl_set_received_subvol() local
5191 struct btrfs_root_item *root_item = &root->root_item; in _btrfs_ioctl_set_received_subvol()
5204 down_write(&root->fs_info->subvol_sem); in _btrfs_ioctl_set_received_subvol()
5211 if (btrfs_root_readonly(root)) { in _btrfs_ioctl_set_received_subvol()
5220 trans = btrfs_start_transaction(root, 3); in _btrfs_ioctl_set_received_subvol()
5235 btrfs_uuid_tree_rem(trans, root->fs_info->uuid_root, in _btrfs_ioctl_set_received_subvol()
5238 root->root_key.objectid); in _btrfs_ioctl_set_received_subvol()
5247 ret = btrfs_update_root(trans, root->fs_info->tree_root, in _btrfs_ioctl_set_received_subvol()
5248 &root->root_key, &root->root_item); in _btrfs_ioctl_set_received_subvol()
5250 btrfs_end_transaction(trans, root); in _btrfs_ioctl_set_received_subvol()
5254 ret = btrfs_uuid_tree_add(trans, root->fs_info->uuid_root, in _btrfs_ioctl_set_received_subvol()
5257 root->root_key.objectid); in _btrfs_ioctl_set_received_subvol()
5259 btrfs_abort_transaction(trans, root, ret); in _btrfs_ioctl_set_received_subvol()
5263 ret = btrfs_commit_transaction(trans, root); in _btrfs_ioctl_set_received_subvol()
5265 btrfs_abort_transaction(trans, root, ret); in _btrfs_ioctl_set_received_subvol()
5270 up_write(&root->fs_info->subvol_sem); in _btrfs_ioctl_set_received_subvol()
5358 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_get_fslabel() local
5363 spin_lock(&root->fs_info->super_lock); in btrfs_ioctl_get_fslabel()
5364 memcpy(label, root->fs_info->super_copy->label, BTRFS_LABEL_SIZE); in btrfs_ioctl_get_fslabel()
5365 spin_unlock(&root->fs_info->super_lock); in btrfs_ioctl_get_fslabel()
5370 btrfs_warn(root->fs_info, in btrfs_ioctl_get_fslabel()
5381 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_set_fslabel() local
5382 struct btrfs_super_block *super_block = root->fs_info->super_copy; in btrfs_ioctl_set_fslabel()
5394 btrfs_err(root->fs_info, "unable to set label with more than %d bytes", in btrfs_ioctl_set_fslabel()
5403 trans = btrfs_start_transaction(root, 0); in btrfs_ioctl_set_fslabel()
5409 spin_lock(&root->fs_info->super_lock); in btrfs_ioctl_set_fslabel()
5411 spin_unlock(&root->fs_info->super_lock); in btrfs_ioctl_set_fslabel()
5412 ret = btrfs_commit_transaction(trans, root); in btrfs_ioctl_set_fslabel()
5441 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_get_features() local
5442 struct btrfs_super_block *super_block = root->fs_info->super_copy; in btrfs_ioctl_get_features()
5455 static int check_feature_bits(struct btrfs_root *root, in check_feature_bits() argument
5470 btrfs_warn(root->fs_info, in check_feature_bits()
5475 btrfs_warn(root->fs_info, in check_feature_bits()
5485 btrfs_warn(root->fs_info, in check_feature_bits()
5490 btrfs_warn(root->fs_info, in check_feature_bits()
5500 btrfs_warn(root->fs_info, in check_feature_bits()
5505 btrfs_warn(root->fs_info, in check_feature_bits()
5514 #define check_feature(root, change_mask, flags, mask_base) \ argument
5515 check_feature_bits(root, FEAT_##mask_base, change_mask, flags, \
5522 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl_set_features() local
5523 struct btrfs_super_block *super_block = root->fs_info->super_copy; in btrfs_ioctl_set_features()
5540 ret = check_feature(root, flags[0].compat_flags, in btrfs_ioctl_set_features()
5545 ret = check_feature(root, flags[0].compat_ro_flags, in btrfs_ioctl_set_features()
5550 ret = check_feature(root, flags[0].incompat_flags, in btrfs_ioctl_set_features()
5555 trans = btrfs_start_transaction(root, 0); in btrfs_ioctl_set_features()
5559 spin_lock(&root->fs_info->super_lock); in btrfs_ioctl_set_features()
5574 spin_unlock(&root->fs_info->super_lock); in btrfs_ioctl_set_features()
5576 return btrfs_commit_transaction(trans, root); in btrfs_ioctl_set_features()
5582 struct btrfs_root *root = BTRFS_I(file_inode(file))->root; in btrfs_ioctl() local
5617 return btrfs_ioctl_add_dev(root, argp); in btrfs_ioctl()
5621 return btrfs_ioctl_fs_info(root, argp); in btrfs_ioctl()
5623 return btrfs_ioctl_dev_info(root, argp); in btrfs_ioctl()
5641 return btrfs_ioctl_ino_to_path(root, argp); in btrfs_ioctl()
5643 return btrfs_ioctl_logical_to_ino(root, argp); in btrfs_ioctl()
5645 return btrfs_ioctl_space_info(root, argp); in btrfs_ioctl()
5649 ret = btrfs_start_delalloc_roots(root->fs_info, 0, -1); in btrfs_ioctl()
5658 wake_up_process(root->fs_info->transaction_kthread); in btrfs_ioctl()
5662 return btrfs_ioctl_start_sync(root, argp); in btrfs_ioctl()
5664 return btrfs_ioctl_wait_sync(root, argp); in btrfs_ioctl()
5668 return btrfs_ioctl_scrub_cancel(root, argp); in btrfs_ioctl()
5670 return btrfs_ioctl_scrub_progress(root, argp); in btrfs_ioctl()
5674 return btrfs_ioctl_balance_ctl(root, arg); in btrfs_ioctl()
5676 return btrfs_ioctl_balance_progress(root, argp); in btrfs_ioctl()
5686 return btrfs_ioctl_get_dev_stats(root, argp); in btrfs_ioctl()
5702 return btrfs_ioctl_dev_replace(root, argp); in btrfs_ioctl()