• Home
  • Raw
  • Download

Lines Matching refs:ret

222 	int ret;  in btrfs_ioctl_setflags()  local
236 ret = check_flags(flags); in btrfs_ioctl_setflags()
237 if (ret) in btrfs_ioctl_setflags()
238 return ret; in btrfs_ioctl_setflags()
240 ret = mnt_want_write_file(file); in btrfs_ioctl_setflags()
241 if (ret) in btrfs_ioctl_setflags()
242 return ret; in btrfs_ioctl_setflags()
254 ret = -EPERM; in btrfs_ioctl_setflags()
318 ret = btrfs_set_prop(inode, "btrfs.compression", NULL, 0, 0); in btrfs_ioctl_setflags()
319 if (ret && ret != -ENODATA) in btrfs_ioctl_setflags()
331 ret = btrfs_set_prop(inode, "btrfs.compression", in btrfs_ioctl_setflags()
333 if (ret) in btrfs_ioctl_setflags()
337 ret = btrfs_set_prop(inode, "btrfs.compression", NULL, 0, 0); in btrfs_ioctl_setflags()
338 if (ret && ret != -ENODATA) in btrfs_ioctl_setflags()
345 ret = PTR_ERR(trans); in btrfs_ioctl_setflags()
352 ret = btrfs_update_inode(trans, root, inode); in btrfs_ioctl_setflags()
356 if (ret) { in btrfs_ioctl_setflags()
364 return ret; in btrfs_ioctl_setflags()
382 int ret; in btrfs_ioctl_fitrim() local
415 ret = btrfs_trim_fs(fs_info->tree_root, &range); in btrfs_ioctl_fitrim()
416 if (ret < 0) in btrfs_ioctl_fitrim()
417 return ret; in btrfs_ioctl_fitrim()
452 int ret; in create_subvol() local
460 ret = btrfs_find_free_objectid(root->fs_info->tree_root, &objectid); in create_subvol()
461 if (ret) in create_subvol()
462 return ret; in create_subvol()
476 ret = btrfs_subvolume_reserve_metadata(root, &block_rsv, in create_subvol()
478 if (ret) in create_subvol()
479 return ret; in create_subvol()
483 ret = PTR_ERR(trans); in create_subvol()
486 return ret; in create_subvol()
491 ret = btrfs_qgroup_inherit(trans, root->fs_info, 0, objectid, inherit); in create_subvol()
492 if (ret) in create_subvol()
497 ret = PTR_ERR(leaf); in create_subvol()
553 ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key, in create_subvol()
555 if (ret) in create_subvol()
561 ret = PTR_ERR(new_root); 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()
569 if (ret) { in create_subvol()
571 btrfs_abort_transaction(trans, root, ret); in create_subvol()
582 ret = btrfs_set_inode_index(dir, &index); in create_subvol()
583 if (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()
591 if (ret) { in create_subvol()
592 btrfs_abort_transaction(trans, root, ret); in create_subvol()
597 ret = btrfs_update_inode(trans, root, dir); in create_subvol()
598 if (ret) { 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()
606 if (ret) { 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()
614 if (ret) in create_subvol()
615 btrfs_abort_transaction(trans, root, ret); in create_subvol()
630 if (err && !ret) in create_subvol()
631 ret = err; in create_subvol()
633 if (!ret) { in create_subvol()
639 return ret; in create_subvol()
667 int ret; in create_snapshot() local
676 ret = btrfs_start_delalloc_inodes(root, 0); in create_snapshot()
677 if (ret) in create_snapshot()
684 ret = -ENOMEM; in create_snapshot()
698 ret = btrfs_subvolume_reserve_metadata(BTRFS_I(dir)->root, in create_snapshot()
702 if (ret) in create_snapshot()
713 ret = PTR_ERR(trans); in create_snapshot()
723 ret = btrfs_commit_transaction_async(trans, in create_snapshot()
725 if (ret) in create_snapshot()
726 ret = btrfs_commit_transaction(trans, root); in create_snapshot()
728 ret = btrfs_commit_transaction(trans, in create_snapshot()
731 if (ret) in create_snapshot()
734 ret = pending_snapshot->error; in create_snapshot()
735 if (ret) in create_snapshot()
738 ret = btrfs_orphan_cleanup(pending_snapshot->snap); in create_snapshot()
739 if (ret) in create_snapshot()
744 ret = PTR_ERR(inode); in create_snapshot()
749 ret = 0; in create_snapshot()
759 return ret; in create_snapshot()
938 int ret; in find_new_extents() local
950 ret = btrfs_search_forward(root, &min_key, path, newer_than); in find_new_extents()
951 if (ret != 0) in find_new_extents()
1023 bool ret = true; in defrag_check_next_extent() local
1031 ret = false; in defrag_check_next_extent()
1034 ret = false; in defrag_check_next_extent()
1037 return ret; in defrag_check_next_extent()
1045 int ret = 1; in should_defrag_range() local
1064 ret = 0; in should_defrag_range()
1078 ret = 0; in should_defrag_range()
1088 if (ret) { in should_defrag_range()
1097 return ret; in should_defrag_range()
1122 int ret; in cluster_pages_for_defrag() local
1136 ret = btrfs_delalloc_reserve_space(inode, in cluster_pages_for_defrag()
1139 if (ret) in cluster_pages_for_defrag()
1140 return ret; in cluster_pages_for_defrag()
1186 ret = -EIO; in cluster_pages_for_defrag()
1200 if (!i_done || ret) in cluster_pages_for_defrag()
1257 return ret; in cluster_pages_for_defrag()
1275 int ret; in btrfs_defrag_file() local
1316 ret = -ENOMEM; in btrfs_defrag_file()
1329 ret = find_new_extents(root, inode, newer_than, in btrfs_defrag_file()
1331 if (!ret) { in btrfs_defrag_file()
1364 ret = -EAGAIN; in btrfs_defrag_file()
1400 ret = cluster_pages_for_defrag(inode, pages, i, cluster); in btrfs_defrag_file()
1401 if (ret < 0) { in btrfs_defrag_file()
1406 defrag_count += ret; in btrfs_defrag_file()
1414 if (ret > 0) in btrfs_defrag_file()
1415 i += ret; in btrfs_defrag_file()
1420 ret = find_new_extents(root, inode, in btrfs_defrag_file()
1423 if (!ret) { in btrfs_defrag_file()
1430 if (ret > 0) { in btrfs_defrag_file()
1431 i += ret; in btrfs_defrag_file()
1432 last_len += ret << PAGE_CACHE_SHIFT; in btrfs_defrag_file()
1466 ret = defrag_count; in btrfs_defrag_file()
1477 return ret; in btrfs_defrag_file()
1493 int ret = 0; in btrfs_ioctl_resize() local
1499 ret = mnt_want_write_file(file); in btrfs_ioctl_resize()
1500 if (ret) in btrfs_ioctl_resize()
1501 return ret; in btrfs_ioctl_resize()
1512 ret = PTR_ERR(vol_args); in btrfs_ioctl_resize()
1524 ret = kstrtoull(devstr, 10, &devid); in btrfs_ioctl_resize()
1525 if (ret) in btrfs_ioctl_resize()
1528 ret = -EINVAL; in btrfs_ioctl_resize()
1538 ret = -ENODEV; in btrfs_ioctl_resize()
1546 ret = -EPERM; in btrfs_ioctl_resize()
1562 ret = -EINVAL; in btrfs_ioctl_resize()
1568 ret = -EPERM; in btrfs_ioctl_resize()
1576 ret = -EINVAL; in btrfs_ioctl_resize()
1582 ret = -ERANGE; in btrfs_ioctl_resize()
1589 ret = -EINVAL; in btrfs_ioctl_resize()
1593 ret = -EFBIG; in btrfs_ioctl_resize()
1606 ret = PTR_ERR(trans); in btrfs_ioctl_resize()
1609 ret = btrfs_grow_device(trans, device, new_size); in btrfs_ioctl_resize()
1612 ret = btrfs_shrink_device(device, new_size); in btrfs_ioctl_resize()
1621 return ret; in btrfs_ioctl_resize()
1630 int ret = 0; in btrfs_ioctl_snap_create_transid() local
1635 ret = mnt_want_write_file(file); in btrfs_ioctl_snap_create_transid()
1636 if (ret) in btrfs_ioctl_snap_create_transid()
1641 ret = -EINVAL; in btrfs_ioctl_snap_create_transid()
1647 ret = -EEXIST; in btrfs_ioctl_snap_create_transid()
1652 ret = btrfs_mksubvol(&file->f_path, name, namelen, in btrfs_ioctl_snap_create_transid()
1658 ret = -EINVAL; in btrfs_ioctl_snap_create_transid()
1666 ret = -EXDEV; in btrfs_ioctl_snap_create_transid()
1672 ret = -EPERM; in btrfs_ioctl_snap_create_transid()
1674 ret = btrfs_mksubvol(&file->f_path, name, namelen, in btrfs_ioctl_snap_create_transid()
1683 return ret; in btrfs_ioctl_snap_create_transid()
1690 int ret; in btrfs_ioctl_snap_create() local
1700 ret = btrfs_ioctl_snap_create_transid(file, vol_args->name, in btrfs_ioctl_snap_create()
1705 return ret; in btrfs_ioctl_snap_create()
1712 int ret; in btrfs_ioctl_snap_create_v2() local
1729 ret = -EOPNOTSUPP; in btrfs_ioctl_snap_create_v2()
1739 ret = -EINVAL; in btrfs_ioctl_snap_create_v2()
1744 ret = PTR_ERR(inherit); in btrfs_ioctl_snap_create_v2()
1749 ret = btrfs_ioctl_snap_create_transid(file, vol_args->name, in btrfs_ioctl_snap_create_v2()
1752 if (ret) in btrfs_ioctl_snap_create_v2()
1759 ret = -EFAULT; in btrfs_ioctl_snap_create_v2()
1765 return ret; in btrfs_ioctl_snap_create_v2()
1773 int ret = 0; in btrfs_ioctl_subvol_getflags() local
1785 ret = -EFAULT; in btrfs_ioctl_subvol_getflags()
1787 return ret; in btrfs_ioctl_subvol_getflags()
1798 int ret = 0; in btrfs_ioctl_subvol_setflags() local
1803 ret = mnt_want_write_file(file); in btrfs_ioctl_subvol_setflags()
1804 if (ret) in btrfs_ioctl_subvol_setflags()
1808 ret = -EINVAL; in btrfs_ioctl_subvol_setflags()
1813 ret = -EFAULT; in btrfs_ioctl_subvol_setflags()
1818 ret = -EINVAL; in btrfs_ioctl_subvol_setflags()
1823 ret = -EOPNOTSUPP; in btrfs_ioctl_subvol_setflags()
1852 ret = -EPERM; in btrfs_ioctl_subvol_setflags()
1859 ret = PTR_ERR(trans); in btrfs_ioctl_subvol_setflags()
1863 ret = btrfs_update_root(trans, root->fs_info->tree_root, in btrfs_ioctl_subvol_setflags()
1868 if (ret) in btrfs_ioctl_subvol_setflags()
1875 return ret; in btrfs_ioctl_subvol_setflags()
1887 int ret; in may_destroy_subvol() local
1900 ret = -EPERM; in may_destroy_subvol()
1912 ret = btrfs_search_slot(NULL, root->fs_info->tree_root, in may_destroy_subvol()
1914 if (ret < 0) in may_destroy_subvol()
1916 BUG_ON(ret == 0); in may_destroy_subvol()
1918 ret = 0; in may_destroy_subvol()
1924 ret = -ENOTEMPTY; in may_destroy_subvol()
1928 return ret; in may_destroy_subvol()
1935 int ret; in key_in_sk() local
1941 ret = btrfs_comp_cpu_keys(key, &test); in key_in_sk()
1942 if (ret < 0) in key_in_sk()
1949 ret = btrfs_comp_cpu_keys(key, &test); in key_in_sk()
1950 if (ret > 0) in key_in_sk()
1973 int ret = 0; in copy_to_sk() local
1995 ret = 1; in copy_to_sk()
2006 ret = -EOVERFLOW; in copy_to_sk()
2010 ret = 1; in copy_to_sk()
2027 ret = 0; in copy_to_sk()
2041 ret = 0; in copy_to_sk()
2050 if (ret) /* -EOVERFLOW from above */ in copy_to_sk()
2054 ret = 1; in copy_to_sk()
2059 ret = 0; in copy_to_sk()
2064 ret = 1; in copy_to_sk()
2075 ret = 1; in copy_to_sk()
2086 return ret; in copy_to_sk()
2098 int ret; in search_ioctl() local
2132 ret = fault_in_pages_writeable(ubuf + sk_offset, in search_ioctl()
2134 if (ret) in search_ioctl()
2137 ret = btrfs_search_forward(root, &key, path, sk->min_transid); in search_ioctl()
2138 if (ret != 0) { in search_ioctl()
2139 if (ret > 0) in search_ioctl()
2140 ret = 0; in search_ioctl()
2143 ret = copy_to_sk(root, path, &key, sk, buf_size, ubuf, in search_ioctl()
2146 if (ret) in search_ioctl()
2150 if (ret > 0) in search_ioctl()
2151 ret = 0; in search_ioctl()
2155 return ret; in search_ioctl()
2164 int ret; in btrfs_ioctl_tree_search() local
2178 ret = search_ioctl(inode, &sk, &buf_size, uargs->buf); in btrfs_ioctl_tree_search()
2184 if (ret == -EOVERFLOW) in btrfs_ioctl_tree_search()
2185 ret = 0; in btrfs_ioctl_tree_search()
2187 if (ret == 0 && copy_to_user(&uargs->key, &sk, sizeof(sk))) in btrfs_ioctl_tree_search()
2188 ret = -EFAULT; in btrfs_ioctl_tree_search()
2189 return ret; in btrfs_ioctl_tree_search()
2198 int ret; in btrfs_ioctl_tree_search_v2() local
2220 ret = search_ioctl(inode, &args.key, &buf_size, in btrfs_ioctl_tree_search_v2()
2222 if (ret == 0 && copy_to_user(&uarg->key, &args.key, sizeof(args.key))) in btrfs_ioctl_tree_search_v2()
2223 ret = -EFAULT; in btrfs_ioctl_tree_search_v2()
2224 else if (ret == -EOVERFLOW && in btrfs_ioctl_tree_search_v2()
2226 ret = -EFAULT; in btrfs_ioctl_tree_search_v2()
2228 return ret; in btrfs_ioctl_tree_search_v2()
2241 int ret = -1; in btrfs_search_path_in_tree() local
2266 ret = -ENOENT; in btrfs_search_path_in_tree()
2275 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_search_path_in_tree()
2276 if (ret < 0) in btrfs_search_path_in_tree()
2278 else if (ret > 0) { in btrfs_search_path_in_tree()
2279 ret = btrfs_previous_item(root, path, dirid, in btrfs_search_path_in_tree()
2281 if (ret < 0) in btrfs_search_path_in_tree()
2283 else if (ret > 0) { in btrfs_search_path_in_tree()
2284 ret = -ENOENT; in btrfs_search_path_in_tree()
2298 ret = -ENAMETOOLONG; in btrfs_search_path_in_tree()
2315 ret = 0; in btrfs_search_path_in_tree()
2318 return ret; in btrfs_search_path_in_tree()
2326 int ret = 0; in btrfs_ioctl_ino_lookup() local
2347 ret = -EPERM; in btrfs_ioctl_ino_lookup()
2351 ret = btrfs_search_path_in_tree(BTRFS_I(inode)->root->fs_info, in btrfs_ioctl_ino_lookup()
2356 if (ret == 0 && copy_to_user(argp, args, sizeof(*args))) in btrfs_ioctl_ino_lookup()
2357 ret = -EFAULT; in btrfs_ioctl_ino_lookup()
2360 return ret; in btrfs_ioctl_ino_lookup()
2378 int ret; in btrfs_ioctl_snap_destroy() local
2507 ret = btrfs_unlink_subvol(trans, root, dir, in btrfs_ioctl_snap_destroy()
2511 if (ret) { in btrfs_ioctl_snap_destroy()
2512 err = ret; in btrfs_ioctl_snap_destroy()
2513 btrfs_abort_transaction(trans, root, ret); in btrfs_ioctl_snap_destroy()
2525 ret = btrfs_insert_orphan_item(trans, in btrfs_ioctl_snap_destroy()
2528 if (ret) { in btrfs_ioctl_snap_destroy()
2529 btrfs_abort_transaction(trans, root, ret); in btrfs_ioctl_snap_destroy()
2530 err = ret; in btrfs_ioctl_snap_destroy()
2535 ret = btrfs_uuid_tree_rem(trans, root->fs_info->uuid_root, in btrfs_ioctl_snap_destroy()
2538 if (ret && ret != -ENOENT) { in btrfs_ioctl_snap_destroy()
2539 btrfs_abort_transaction(trans, root, ret); in btrfs_ioctl_snap_destroy()
2540 err = ret; in btrfs_ioctl_snap_destroy()
2544 ret = btrfs_uuid_tree_rem(trans, root->fs_info->uuid_root, in btrfs_ioctl_snap_destroy()
2548 if (ret && ret != -ENOENT) { in btrfs_ioctl_snap_destroy()
2549 btrfs_abort_transaction(trans, root, ret); in btrfs_ioctl_snap_destroy()
2550 err = ret; in btrfs_ioctl_snap_destroy()
2560 ret = btrfs_end_transaction(trans, root); in btrfs_ioctl_snap_destroy()
2561 if (ret && !err) in btrfs_ioctl_snap_destroy()
2562 err = ret; in btrfs_ioctl_snap_destroy()
2605 int ret; in btrfs_ioctl_defrag() local
2607 ret = mnt_want_write_file(file); in btrfs_ioctl_defrag()
2608 if (ret) in btrfs_ioctl_defrag()
2609 return ret; in btrfs_ioctl_defrag()
2612 ret = -EROFS; in btrfs_ioctl_defrag()
2619 ret = -EPERM; in btrfs_ioctl_defrag()
2622 ret = btrfs_defrag_root(root); in btrfs_ioctl_defrag()
2623 if (ret) in btrfs_ioctl_defrag()
2625 ret = btrfs_defrag_root(root->fs_info->extent_root); in btrfs_ioctl_defrag()
2629 ret = -EINVAL; in btrfs_ioctl_defrag()
2635 ret = -ENOMEM; in btrfs_ioctl_defrag()
2642 ret = -EFAULT; in btrfs_ioctl_defrag()
2655 ret = btrfs_defrag_file(file_inode(file), file, in btrfs_ioctl_defrag()
2657 if (ret > 0) in btrfs_ioctl_defrag()
2658 ret = 0; in btrfs_ioctl_defrag()
2662 ret = -EINVAL; in btrfs_ioctl_defrag()
2666 return ret; in btrfs_ioctl_defrag()
2672 int ret; in btrfs_ioctl_add_dev() local
2685 ret = PTR_ERR(vol_args); in btrfs_ioctl_add_dev()
2690 ret = btrfs_init_new_device(root, vol_args->name); in btrfs_ioctl_add_dev()
2692 if (!ret) in btrfs_ioctl_add_dev()
2699 return ret; in btrfs_ioctl_add_dev()
2706 int ret; in btrfs_ioctl_rm_dev() local
2711 ret = mnt_want_write_file(file); in btrfs_ioctl_rm_dev()
2712 if (ret) in btrfs_ioctl_rm_dev()
2713 return ret; in btrfs_ioctl_rm_dev()
2717 ret = PTR_ERR(vol_args); in btrfs_ioctl_rm_dev()
2725 ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS; in btrfs_ioctl_rm_dev()
2730 ret = btrfs_rm_device(root, vol_args->name); in btrfs_ioctl_rm_dev()
2734 if (!ret) in btrfs_ioctl_rm_dev()
2741 return ret; in btrfs_ioctl_rm_dev()
2749 int ret = 0; in btrfs_ioctl_fs_info() local
2770 ret = -EFAULT; in btrfs_ioctl_fs_info()
2773 return ret; in btrfs_ioctl_fs_info()
2781 int ret = 0; in btrfs_ioctl_dev_info() local
2795 ret = -ENODEV; in btrfs_ioctl_dev_info()
2817 if (ret == 0 && copy_to_user(arg, di_args, sizeof(*di_args))) in btrfs_ioctl_dev_info()
2818 ret = -EFAULT; in btrfs_ioctl_dev_info()
2821 return ret; in btrfs_ioctl_dev_info()
2833 int ret; in extent_same_get_page() local
2835 ret = btrfs_readpage(NULL, page); in extent_same_get_page()
2836 if (ret) in extent_same_get_page()
2837 return ERR_PTR(ret); in extent_same_get_page()
2936 int ret; in btrfs_double_extent_lock() local
2942 ret = lock_extent_range(inode1, loff1, len, retry_range_locking); in btrfs_double_extent_lock()
2943 if (ret) in btrfs_double_extent_lock()
2944 return ret; in btrfs_double_extent_lock()
2945 ret = lock_extent_range(inode2, loff2, len, retry_range_locking); in btrfs_double_extent_lock()
2946 if (ret) in btrfs_double_extent_lock()
2949 return ret; in btrfs_double_extent_lock()
2983 int ret; in btrfs_cmp_data_prepare() local
3004 ret = gather_extent_pages(src, cmp->src_pages, cmp->num_pages, loff); in btrfs_cmp_data_prepare()
3005 if (ret) in btrfs_cmp_data_prepare()
3008 ret = gather_extent_pages(dst, cmp->dst_pages, cmp->num_pages, dst_loff); in btrfs_cmp_data_prepare()
3011 if (ret) in btrfs_cmp_data_prepare()
3013 return ret; in btrfs_cmp_data_prepare()
3019 int ret = 0; in btrfs_cmp_data() local
3044 ret = BTRFS_SAME_DATA_DIFFERS; in btrfs_cmp_data()
3049 if (ret) in btrfs_cmp_data()
3056 return ret; in btrfs_cmp_data()
3082 int ret; in btrfs_extent_same() local
3098 ret = extent_same_check_offsets(src, loff, &len, olen); in btrfs_extent_same()
3099 if (ret) in btrfs_extent_same()
3117 ret = -EINVAL; in btrfs_extent_same()
3123 ret = -EINVAL; in btrfs_extent_same()
3132 ret = extent_same_check_offsets(src, loff, &len, olen); in btrfs_extent_same()
3133 if (ret) in btrfs_extent_same()
3136 ret = extent_same_check_offsets(dst, dst_loff, &len, olen); in btrfs_extent_same()
3137 if (ret) in btrfs_extent_same()
3144 ret = -EINVAL; in btrfs_extent_same()
3149 ret = btrfs_cmp_data_prepare(src, loff, dst, dst_loff, olen, &cmp); in btrfs_extent_same()
3150 if (ret) in btrfs_extent_same()
3154 ret = lock_extent_range(src, same_lock_start, same_lock_len, in btrfs_extent_same()
3157 ret = btrfs_double_extent_lock(src, loff, dst, dst_loff, len, in btrfs_extent_same()
3167 if (ret == -EAGAIN) { in btrfs_extent_same()
3182 ASSERT(ret == 0); in btrfs_extent_same()
3183 if (WARN_ON(ret)) { in btrfs_extent_same()
3186 return ret; in btrfs_extent_same()
3190 ret = btrfs_cmp_data(src, loff, dst, dst_loff, olen, &cmp); in btrfs_extent_same()
3191 if (ret == 0) in btrfs_extent_same()
3192 ret = btrfs_clone(src, dst, loff, olen, len, dst_loff, 1); in btrfs_extent_same()
3207 return ret; in btrfs_extent_same()
3221 int ret; in btrfs_ioctl_file_extent_same() local
3230 ret = mnt_want_write_file(file); in btrfs_ioctl_file_extent_same()
3231 if (ret) in btrfs_ioctl_file_extent_same()
3232 return ret; in btrfs_ioctl_file_extent_same()
3235 ret = -EFAULT; in btrfs_ioctl_file_extent_same()
3244 ret = PTR_ERR(same); in btrfs_ioctl_file_extent_same()
3266 ret = -EINVAL; in btrfs_ioctl_file_extent_same()
3270 ret = -EISDIR; in btrfs_ioctl_file_extent_same()
3274 ret = -EACCES; in btrfs_ioctl_file_extent_same()
3310 ret = copy_to_user(argp, same, size); in btrfs_ioctl_file_extent_same()
3311 if (ret) in btrfs_ioctl_file_extent_same()
3312 ret = -EFAULT; in btrfs_ioctl_file_extent_same()
3317 return ret; in btrfs_ioctl_file_extent_same()
3328 int ret; in clone_finish_inode_update() local
3342 ret = btrfs_update_inode(trans, root, inode); in clone_finish_inode_update()
3343 if (ret) { in clone_finish_inode_update()
3344 btrfs_abort_transaction(trans, root, ret); in clone_finish_inode_update()
3348 ret = btrfs_end_transaction(trans, root); in clone_finish_inode_update()
3350 return ret; in clone_finish_inode_update()
3361 int ret; in clone_update_extent_map() local
3395 ret = add_extent_mapping(em_tree, em, 1); in clone_update_extent_map()
3397 if (ret != -EEXIST) { in clone_update_extent_map()
3405 if (ret) in clone_update_extent_map()
3449 int ret; in clone_copy_inline_extent() local
3458 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in clone_copy_inline_extent()
3459 if (ret < 0) { in clone_copy_inline_extent()
3460 return ret; in clone_copy_inline_extent()
3461 } else if (ret > 0) { in clone_copy_inline_extent()
3463 ret = btrfs_next_leaf(root, path); in clone_copy_inline_extent()
3464 if (ret < 0) in clone_copy_inline_extent()
3465 return ret; in clone_copy_inline_extent()
3466 else if (ret > 0) in clone_copy_inline_extent()
3498 ret = btrfs_next_item(root, path); in clone_copy_inline_extent()
3499 if (ret < 0) { in clone_copy_inline_extent()
3500 return ret; in clone_copy_inline_extent()
3501 } else if (ret == 0) { in clone_copy_inline_extent()
3532 ret = btrfs_drop_extents(trans, root, dst, drop_start, aligned_end, 1); in clone_copy_inline_extent()
3533 if (ret) in clone_copy_inline_extent()
3534 return ret; in clone_copy_inline_extent()
3535 ret = btrfs_insert_empty_item(trans, root, path, new_key, size); in clone_copy_inline_extent()
3536 if (ret) in clone_copy_inline_extent()
3537 return ret; in clone_copy_inline_extent()
3577 int ret; in btrfs_clone() local
3581 ret = -ENOMEM; in btrfs_clone()
3584 return ret; in btrfs_clone()
3589 return ret; in btrfs_clone()
3606 ret = btrfs_search_slot(NULL, BTRFS_I(src)->root, &key, path, in btrfs_clone()
3608 if (ret < 0) in btrfs_clone()
3615 if (key.offset == off && ret > 0 && path->slots[0] > 0) { in btrfs_clone()
3625 ret = btrfs_next_leaf(BTRFS_I(src)->root, path); in btrfs_clone()
3626 if (ret < 0) in btrfs_clone()
3628 if (ret > 0) in btrfs_clone()
3715 ret = PTR_ERR(trans); in btrfs_clone()
3736 ret = btrfs_drop_extents(trans, root, inode, in btrfs_clone()
3740 if (ret) { in btrfs_clone()
3741 if (ret != -EOPNOTSUPP) in btrfs_clone()
3743 root, ret); in btrfs_clone()
3748 ret = btrfs_insert_empty_item(trans, root, path, in btrfs_clone()
3750 if (ret) { in btrfs_clone()
3752 ret); in btrfs_clone()
3777 ret = btrfs_inc_extent_ref(trans, root, in btrfs_clone()
3782 if (ret) { in btrfs_clone()
3785 ret); in btrfs_clone()
3805 ret = -EINVAL; in btrfs_clone()
3812 ret = clone_copy_inline_extent(src, inode, in btrfs_clone()
3818 if (ret) { in btrfs_clone()
3819 if (ret != -EOPNOTSUPP) in btrfs_clone()
3822 ret); in btrfs_clone()
3843 ret = clone_finish_inode_update(trans, inode, in btrfs_clone()
3847 if (ret) in btrfs_clone()
3856 ret = -EINTR; in btrfs_clone()
3862 ret = 0; in btrfs_clone()
3877 ret = PTR_ERR(trans); in btrfs_clone()
3880 ret = btrfs_drop_extents(trans, root, inode, in btrfs_clone()
3882 if (ret) { in btrfs_clone()
3883 if (ret != -EOPNOTSUPP) in btrfs_clone()
3884 btrfs_abort_transaction(trans, root, ret); in btrfs_clone()
3890 ret = clone_finish_inode_update(trans, inode, destoff + len, in btrfs_clone()
3897 return ret; in btrfs_clone()
3907 int ret; in btrfs_ioctl_clone() local
3930 ret = mnt_want_write_file(file); in btrfs_ioctl_clone()
3931 if (ret) in btrfs_ioctl_clone()
3932 return ret; in btrfs_ioctl_clone()
3936 ret = -EBADF; in btrfs_ioctl_clone()
3940 ret = -EXDEV; in btrfs_ioctl_clone()
3946 ret = -EINVAL; in btrfs_ioctl_clone()
3954 ret = -EISDIR; in btrfs_ioctl_clone()
3958 ret = -EXDEV; in btrfs_ioctl_clone()
3971 ret = -EINVAL; in btrfs_ioctl_clone()
3976 ret = -EINVAL; in btrfs_ioctl_clone()
3994 ret = 0; in btrfs_ioctl_clone()
4010 ret = btrfs_cont_expand(inode, inode->i_size, destoff); in btrfs_ioctl_clone()
4011 if (ret) in btrfs_ioctl_clone()
4026 ret = lock_extent_range(src, lock_start, lock_len, true); in btrfs_ioctl_clone()
4028 ret = btrfs_double_extent_lock(src, off, inode, destoff, len, in btrfs_ioctl_clone()
4031 ASSERT(ret == 0); in btrfs_ioctl_clone()
4032 if (WARN_ON(ret)) { in btrfs_ioctl_clone()
4037 ret = btrfs_clone(src, inode, off, olen, len, destoff, 0); in btrfs_ioctl_clone()
4062 return ret; in btrfs_ioctl_clone()
4086 int ret; in btrfs_ioctl_trans_start() local
4088 ret = -EPERM; in btrfs_ioctl_trans_start()
4092 ret = -EINPROGRESS; in btrfs_ioctl_trans_start()
4096 ret = -EROFS; in btrfs_ioctl_trans_start()
4100 ret = mnt_want_write_file(file); in btrfs_ioctl_trans_start()
4101 if (ret) in btrfs_ioctl_trans_start()
4106 ret = -ENOMEM; in btrfs_ioctl_trans_start()
4118 return ret; in btrfs_ioctl_trans_start()
4133 int ret; in btrfs_ioctl_default_subvol() local
4138 ret = mnt_want_write_file(file); in btrfs_ioctl_default_subvol()
4139 if (ret) in btrfs_ioctl_default_subvol()
4140 return ret; in btrfs_ioctl_default_subvol()
4143 ret = -EFAULT; in btrfs_ioctl_default_subvol()
4156 ret = PTR_ERR(new_root); in btrfs_ioctl_default_subvol()
4160 ret = -ENOENT; in btrfs_ioctl_default_subvol()
4166 ret = -ENOMEM; in btrfs_ioctl_default_subvol()
4174 ret = PTR_ERR(trans); in btrfs_ioctl_default_subvol()
4186 ret = -ENOENT; in btrfs_ioctl_default_subvol()
4199 return ret; in btrfs_ioctl_default_subvol()
4232 int ret = 0; in btrfs_ioctl_space_info() local
4348 ret = -EFAULT; in btrfs_ioctl_space_info()
4352 if (ret == 0 && copy_to_user(arg, &space_args, sizeof(space_args))) in btrfs_ioctl_space_info()
4353 ret = -EFAULT; in btrfs_ioctl_space_info()
4355 return ret; in btrfs_ioctl_space_info()
4388 int ret; in btrfs_ioctl_start_sync() local
4400 ret = btrfs_commit_transaction_async(trans, root, 0); in btrfs_ioctl_start_sync()
4401 if (ret) { in btrfs_ioctl_start_sync()
4403 return ret; in btrfs_ioctl_start_sync()
4430 int ret; in btrfs_ioctl_scrub() local
4440 ret = mnt_want_write_file(file); in btrfs_ioctl_scrub()
4441 if (ret) in btrfs_ioctl_scrub()
4445 ret = btrfs_scrub_dev(root->fs_info, sa->devid, sa->start, sa->end, in btrfs_ioctl_scrub()
4450 ret = -EFAULT; in btrfs_ioctl_scrub()
4456 return ret; in btrfs_ioctl_scrub()
4471 int ret; in btrfs_ioctl_scrub_progress() local
4480 ret = btrfs_scrub_progress(root, sa->devid, &sa->progress); in btrfs_ioctl_scrub_progress()
4483 ret = -EFAULT; in btrfs_ioctl_scrub_progress()
4486 return ret; in btrfs_ioctl_scrub_progress()
4493 int ret; in btrfs_ioctl_get_dev_stats() local
4504 ret = btrfs_get_dev_stats(root, sa); in btrfs_ioctl_get_dev_stats()
4507 ret = -EFAULT; in btrfs_ioctl_get_dev_stats()
4510 return ret; in btrfs_ioctl_get_dev_stats()
4516 int ret; in btrfs_ioctl_dev_replace() local
4528 ret = -EROFS; in btrfs_ioctl_dev_replace()
4534 ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS; in btrfs_ioctl_dev_replace()
4536 ret = btrfs_dev_replace_start(root, p); in btrfs_ioctl_dev_replace()
4544 ret = 0; in btrfs_ioctl_dev_replace()
4547 ret = btrfs_dev_replace_cancel(root->fs_info, p); in btrfs_ioctl_dev_replace()
4550 ret = -EINVAL; in btrfs_ioctl_dev_replace()
4555 ret = -EFAULT; in btrfs_ioctl_dev_replace()
4558 return ret; in btrfs_ioctl_dev_replace()
4563 int ret = 0; in btrfs_ioctl_ino_to_path() local
4576 ret = -ENOMEM; in btrfs_ioctl_ino_to_path()
4582 ret = PTR_ERR(ipa); in btrfs_ioctl_ino_to_path()
4590 ret = PTR_ERR(ipath); in btrfs_ioctl_ino_to_path()
4595 ret = paths_from_inode(ipa->inum, ipath); in btrfs_ioctl_ino_to_path()
4596 if (ret < 0) in btrfs_ioctl_ino_to_path()
4605 ret = copy_to_user((void *)(unsigned long)ipa->fspath, in btrfs_ioctl_ino_to_path()
4607 if (ret) { in btrfs_ioctl_ino_to_path()
4608 ret = -EFAULT; in btrfs_ioctl_ino_to_path()
4617 return ret; in btrfs_ioctl_ino_to_path()
4643 int ret = 0; in btrfs_ioctl_logical_to_ino() local
4654 ret = PTR_ERR(loi); in btrfs_ioctl_logical_to_ino()
4661 ret = -ENOMEM; in btrfs_ioctl_logical_to_ino()
4668 ret = PTR_ERR(inodes); in btrfs_ioctl_logical_to_ino()
4673 ret = iterate_inodes_from_logical(loi->logical, root->fs_info, path, in btrfs_ioctl_logical_to_ino()
4675 if (ret == -EINVAL) in btrfs_ioctl_logical_to_ino()
4676 ret = -ENOENT; in btrfs_ioctl_logical_to_ino()
4677 if (ret < 0) in btrfs_ioctl_logical_to_ino()
4680 ret = copy_to_user((void *)(unsigned long)loi->inodes, in btrfs_ioctl_logical_to_ino()
4682 if (ret) in btrfs_ioctl_logical_to_ino()
4683 ret = -EFAULT; in btrfs_ioctl_logical_to_ino()
4690 return ret; in btrfs_ioctl_logical_to_ino()
4727 int ret; in btrfs_ioctl_balance() local
4732 ret = mnt_want_write_file(file); in btrfs_ioctl_balance()
4733 if (ret) in btrfs_ioctl_balance()
4734 return ret; in btrfs_ioctl_balance()
4772 ret = -EINPROGRESS; in btrfs_ioctl_balance()
4778 ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS; in btrfs_ioctl_balance()
4788 ret = PTR_ERR(bargs); in btrfs_ioctl_balance()
4794 ret = -ENOTCONN; in btrfs_ioctl_balance()
4810 ret = -EINPROGRESS; in btrfs_ioctl_balance()
4816 ret = -ENOMEM; in btrfs_ioctl_balance()
4833 ret = -EINVAL; in btrfs_ioctl_balance()
4847 ret = btrfs_balance(bctl, bargs); in btrfs_ioctl_balance()
4852 ret = -EFAULT; in btrfs_ioctl_balance()
4866 return ret; in btrfs_ioctl_balance()
4889 int ret = 0; in btrfs_ioctl_balance_progress() local
4896 ret = -ENOTCONN; in btrfs_ioctl_balance_progress()
4902 ret = -ENOMEM; in btrfs_ioctl_balance_progress()
4909 ret = -EFAULT; in btrfs_ioctl_balance_progress()
4914 return ret; in btrfs_ioctl_balance_progress()
4922 int ret; in btrfs_ioctl_quota_ctl() local
4928 ret = mnt_want_write_file(file); in btrfs_ioctl_quota_ctl()
4929 if (ret) in btrfs_ioctl_quota_ctl()
4930 return ret; in btrfs_ioctl_quota_ctl()
4934 ret = PTR_ERR(sa); in btrfs_ioctl_quota_ctl()
4941 ret = PTR_ERR(trans); 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()
4953 ret = -EINVAL; in btrfs_ioctl_quota_ctl()
4958 if (err && !ret) in btrfs_ioctl_quota_ctl()
4959 ret = err; in btrfs_ioctl_quota_ctl()
4965 return ret; in btrfs_ioctl_quota_ctl()
4973 int ret; in btrfs_ioctl_qgroup_assign() local
4979 ret = mnt_want_write_file(file); in btrfs_ioctl_qgroup_assign()
4980 if (ret) in btrfs_ioctl_qgroup_assign()
4981 return ret; in btrfs_ioctl_qgroup_assign()
4985 ret = PTR_ERR(sa); in btrfs_ioctl_qgroup_assign()
4991 ret = PTR_ERR(trans); 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()
5007 btrfs_std_error(root->fs_info, ret, in btrfs_ioctl_qgroup_assign()
5010 if (err && !ret) in btrfs_ioctl_qgroup_assign()
5011 ret = err; in btrfs_ioctl_qgroup_assign()
5017 return ret; in btrfs_ioctl_qgroup_assign()
5025 int ret; in btrfs_ioctl_qgroup_create() local
5031 ret = mnt_want_write_file(file); in btrfs_ioctl_qgroup_create()
5032 if (ret) in btrfs_ioctl_qgroup_create()
5033 return ret; in btrfs_ioctl_qgroup_create()
5037 ret = PTR_ERR(sa); in btrfs_ioctl_qgroup_create()
5042 ret = -EINVAL; in btrfs_ioctl_qgroup_create()
5048 ret = PTR_ERR(trans); 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()
5060 if (err && !ret) in btrfs_ioctl_qgroup_create()
5061 ret = err; in btrfs_ioctl_qgroup_create()
5067 return ret; in btrfs_ioctl_qgroup_create()
5075 int ret; in btrfs_ioctl_qgroup_limit() local
5082 ret = mnt_want_write_file(file); in btrfs_ioctl_qgroup_limit()
5083 if (ret) in btrfs_ioctl_qgroup_limit()
5084 return ret; in btrfs_ioctl_qgroup_limit()
5088 ret = PTR_ERR(sa); in btrfs_ioctl_qgroup_limit()
5094 ret = PTR_ERR(trans); in btrfs_ioctl_qgroup_limit()
5105 ret = btrfs_limit_qgroup(trans, root->fs_info, qgroupid, &sa->lim); in btrfs_ioctl_qgroup_limit()
5108 if (err && !ret) in btrfs_ioctl_qgroup_limit()
5109 ret = err; in btrfs_ioctl_qgroup_limit()
5115 return ret; in btrfs_ioctl_qgroup_limit()
5122 int ret; in btrfs_ioctl_quota_rescan() local
5127 ret = mnt_want_write_file(file); in btrfs_ioctl_quota_rescan()
5128 if (ret) in btrfs_ioctl_quota_rescan()
5129 return ret; in btrfs_ioctl_quota_rescan()
5133 ret = PTR_ERR(qsa); in btrfs_ioctl_quota_rescan()
5138 ret = -EINVAL; in btrfs_ioctl_quota_rescan()
5142 ret = btrfs_qgroup_rescan(root->fs_info); in btrfs_ioctl_quota_rescan()
5148 return ret; in btrfs_ioctl_quota_rescan()
5155 int ret = 0; in btrfs_ioctl_quota_rescan_status() local
5170 ret = -EFAULT; in btrfs_ioctl_quota_rescan_status()
5173 return ret; in btrfs_ioctl_quota_rescan_status()
5194 int ret = 0; in _btrfs_ioctl_set_received_subvol() local
5200 ret = mnt_want_write_file(file); in _btrfs_ioctl_set_received_subvol()
5201 if (ret < 0) in _btrfs_ioctl_set_received_subvol()
5202 return ret; in _btrfs_ioctl_set_received_subvol()
5207 ret = -EINVAL; in _btrfs_ioctl_set_received_subvol()
5212 ret = -EROFS; in _btrfs_ioctl_set_received_subvol()
5222 ret = PTR_ERR(trans); in _btrfs_ioctl_set_received_subvol()
5247 ret = btrfs_update_root(trans, root->fs_info->tree_root, in _btrfs_ioctl_set_received_subvol()
5249 if (ret < 0) { in _btrfs_ioctl_set_received_subvol()
5254 ret = btrfs_uuid_tree_add(trans, root->fs_info->uuid_root, in _btrfs_ioctl_set_received_subvol()
5258 if (ret < 0 && ret != -EEXIST) { 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()
5264 if (ret < 0) { in _btrfs_ioctl_set_received_subvol()
5265 btrfs_abort_transaction(trans, root, ret); in _btrfs_ioctl_set_received_subvol()
5272 return ret; in _btrfs_ioctl_set_received_subvol()
5281 int ret = 0; in btrfs_ioctl_set_received_subvol_32() local
5285 ret = PTR_ERR(args32); in btrfs_ioctl_set_received_subvol_32()
5292 ret = -ENOMEM; in btrfs_ioctl_set_received_subvol_32()
5305 ret = _btrfs_ioctl_set_received_subvol(file, args64); in btrfs_ioctl_set_received_subvol_32()
5306 if (ret) in btrfs_ioctl_set_received_subvol_32()
5318 ret = copy_to_user(arg, args32, sizeof(*args32)); in btrfs_ioctl_set_received_subvol_32()
5319 if (ret) in btrfs_ioctl_set_received_subvol_32()
5320 ret = -EFAULT; in btrfs_ioctl_set_received_subvol_32()
5325 return ret; in btrfs_ioctl_set_received_subvol_32()
5333 int ret = 0; in btrfs_ioctl_set_received_subvol() local
5337 ret = PTR_ERR(sa); in btrfs_ioctl_set_received_subvol()
5342 ret = _btrfs_ioctl_set_received_subvol(file, sa); in btrfs_ioctl_set_received_subvol()
5344 if (ret) in btrfs_ioctl_set_received_subvol()
5347 ret = copy_to_user(arg, sa, sizeof(*sa)); in btrfs_ioctl_set_received_subvol()
5348 if (ret) in btrfs_ioctl_set_received_subvol()
5349 ret = -EFAULT; in btrfs_ioctl_set_received_subvol()
5353 return ret; in btrfs_ioctl_set_received_subvol()
5360 int ret; in btrfs_ioctl_get_fslabel() local
5374 ret = copy_to_user(arg, label, len); in btrfs_ioctl_get_fslabel()
5376 return ret ? -EFAULT : 0; in btrfs_ioctl_get_fslabel()
5385 int ret; in btrfs_ioctl_set_fslabel() local
5399 ret = mnt_want_write_file(file); in btrfs_ioctl_set_fslabel()
5400 if (ret) in btrfs_ioctl_set_fslabel()
5401 return ret; in btrfs_ioctl_set_fslabel()
5405 ret = PTR_ERR(trans); in btrfs_ioctl_set_fslabel()
5412 ret = btrfs_commit_transaction(trans, root); in btrfs_ioctl_set_fslabel()
5416 return ret; in btrfs_ioctl_set_fslabel()
5527 int ret; in btrfs_ioctl_set_features() local
5540 ret = check_feature(root, flags[0].compat_flags, in btrfs_ioctl_set_features()
5542 if (ret) in btrfs_ioctl_set_features()
5543 return ret; in btrfs_ioctl_set_features()
5545 ret = check_feature(root, flags[0].compat_ro_flags, in btrfs_ioctl_set_features()
5547 if (ret) in btrfs_ioctl_set_features()
5548 return ret; in btrfs_ioctl_set_features()
5550 ret = check_feature(root, flags[0].incompat_flags, in btrfs_ioctl_set_features()
5552 if (ret) in btrfs_ioctl_set_features()
5553 return ret; in btrfs_ioctl_set_features()
5647 int ret; in btrfs_ioctl() local
5649 ret = btrfs_start_delalloc_roots(root->fs_info, 0, -1); in btrfs_ioctl()
5650 if (ret) in btrfs_ioctl()
5651 return ret; in btrfs_ioctl()
5652 ret = btrfs_sync_fs(file_inode(file)->i_sb, 1); in btrfs_ioctl()
5659 return ret; in btrfs_ioctl()