Lines Matching refs:root
62 u64 root; member
74 if (defrag1->root > defrag2->root) in __compare_inode_defrag()
76 else if (defrag1->root < defrag2->root) in __compare_inode_defrag()
98 struct btrfs_root *root = BTRFS_I(inode)->root; in __btrfs_add_inode_defrag() local
104 p = &root->fs_info->defrag_inodes.rb_node; in __btrfs_add_inode_defrag()
128 rb_insert_color(&defrag->rb_node, &root->fs_info->defrag_inodes); in __btrfs_add_inode_defrag()
132 static inline int __need_auto_defrag(struct btrfs_root *root) in __need_auto_defrag() argument
134 if (!btrfs_test_opt(root, AUTO_DEFRAG)) in __need_auto_defrag()
137 if (btrfs_fs_closing(root->fs_info)) in __need_auto_defrag()
150 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_add_inode_defrag() local
155 if (!__need_auto_defrag(root)) in btrfs_add_inode_defrag()
164 transid = BTRFS_I(inode)->root->last_trans; in btrfs_add_inode_defrag()
172 defrag->root = root->root_key.objectid; in btrfs_add_inode_defrag()
174 spin_lock(&root->fs_info->defrag_inodes_lock); in btrfs_add_inode_defrag()
187 spin_unlock(&root->fs_info->defrag_inodes_lock); in btrfs_add_inode_defrag()
199 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_requeue_inode_defrag() local
202 if (!__need_auto_defrag(root)) in btrfs_requeue_inode_defrag()
209 spin_lock(&root->fs_info->defrag_inodes_lock); in btrfs_requeue_inode_defrag()
211 spin_unlock(&root->fs_info->defrag_inodes_lock); in btrfs_requeue_inode_defrag()
224 btrfs_pick_defrag_inode(struct btrfs_fs_info *fs_info, u64 root, u64 ino) in btrfs_pick_defrag_inode() argument
233 tmp.root = root; in btrfs_pick_defrag_inode()
297 key.objectid = defrag->root; in __btrfs_run_defrag_inode()
392 root_objectid = defrag->root; in btrfs_run_defrag_inodes()
488 int btrfs_dirty_pages(struct btrfs_root *root, struct inode *inode, in btrfs_dirty_pages() argument
501 start_pos = pos & ~((u64)root->sectorsize - 1); in btrfs_dirty_pages()
502 num_bytes = ALIGN(write_bytes + pos - start_pos, root->sectorsize); in btrfs_dirty_pages()
692 struct btrfs_root *root, struct inode *inode, in __btrfs_drop_extents() argument
725 update_refs = (test_bit(BTRFS_ROOT_REF_COWS, &root->state) || in __btrfs_drop_extents()
726 root == root->fs_info->tree_root); in __btrfs_drop_extents()
729 ret = btrfs_lookup_file_extent(trans, root, path, ino, in __btrfs_drop_extents()
746 ret = btrfs_next_leaf(root, path); in __btrfs_drop_extents()
829 ret = btrfs_duplicate_item(trans, root, path, in __btrfs_drop_extents()
854 ret = btrfs_inc_extent_ref(trans, root, in __btrfs_drop_extents()
856 root->root_key.objectid, in __btrfs_drop_extents()
875 btrfs_set_item_key_safe(root->fs_info, path, &new_key); in __btrfs_drop_extents()
930 root->sectorsize); in __btrfs_drop_extents()
932 ret = btrfs_free_extent(trans, root, in __btrfs_drop_extents()
934 root->root_key.objectid, in __btrfs_drop_extents()
950 ret = btrfs_del_items(trans, root, path, del_slot, in __btrfs_drop_extents()
953 btrfs_abort_transaction(trans, root, ret); in __btrfs_drop_extents()
975 ret = btrfs_del_items(trans, root, path, del_slot, del_nr); in __btrfs_drop_extents()
977 btrfs_abort_transaction(trans, root, ret); in __btrfs_drop_extents()
989 btrfs_leaf_free_space(root, leaf) >= in __btrfs_drop_extents()
1002 setup_items_for_insert(root, path, &key, in __btrfs_drop_extents()
1018 struct btrfs_root *root, struct inode *inode, u64 start, in btrfs_drop_extents() argument
1027 ret = __btrfs_drop_extents(trans, root, inode, path, start, end, NULL, in btrfs_drop_extents()
1076 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_mark_extent_written() local
1105 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_mark_extent_written()
1133 btrfs_set_item_key_safe(root->fs_info, path, &new_key); in btrfs_mark_extent_written()
1167 btrfs_set_item_key_safe(root->fs_info, path, &new_key); in btrfs_mark_extent_written()
1187 ret = btrfs_duplicate_item(trans, root, path, &new_key); in btrfs_mark_extent_written()
1193 btrfs_abort_transaction(trans, root, ret); in btrfs_mark_extent_written()
1213 ret = btrfs_inc_extent_ref(trans, root, bytenr, num_bytes, 0, in btrfs_mark_extent_written()
1214 root->root_key.objectid, in btrfs_mark_extent_written()
1240 ret = btrfs_free_extent(trans, root, bytenr, num_bytes, in btrfs_mark_extent_written()
1241 0, root->root_key.objectid, in btrfs_mark_extent_written()
1257 ret = btrfs_free_extent(trans, root, bytenr, num_bytes, in btrfs_mark_extent_written()
1258 0, root->root_key.objectid, in btrfs_mark_extent_written()
1279 ret = btrfs_del_items(trans, root, path, del_slot, del_nr); in btrfs_mark_extent_written()
1281 btrfs_abort_transaction(trans, root, ret); in btrfs_mark_extent_written()
1439 struct btrfs_root *root = BTRFS_I(inode)->root; in check_can_nocow() local
1445 ret = btrfs_start_write_no_snapshoting(root); in check_can_nocow()
1449 lockstart = round_down(pos, root->sectorsize); in check_can_nocow()
1450 lockend = round_up(pos + *write_bytes, root->sectorsize) - 1; in check_can_nocow()
1468 btrfs_end_write_no_snapshoting(root); in check_can_nocow()
1484 struct btrfs_root *root = BTRFS_I(inode)->root; in __btrfs_buffered_write() local
1559 btrfs_end_write_no_snapshoting(root); in __btrfs_buffered_write()
1629 __pos = round_down(pos, root->sectorsize) + in __btrfs_buffered_write()
1639 ret = btrfs_dirty_pages(root, inode, pages, in __btrfs_buffered_write()
1653 btrfs_end_write_no_snapshoting(root); in __btrfs_buffered_write()
1656 lockstart = round_down(pos, root->sectorsize); in __btrfs_buffered_write()
1670 if (dirty_pages < (root->nodesize >> PAGE_CACHE_SHIFT) + 1) in __btrfs_buffered_write()
1671 btrfs_btree_balance_dirty(root); in __btrfs_buffered_write()
1681 btrfs_end_write_no_snapshoting(root); in __btrfs_buffered_write()
1755 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_file_write_iter() local
1784 if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) { in btrfs_file_write_iter()
1800 start_pos = round_down(pos, root->sectorsize); in btrfs_file_write_iter()
1803 end_pos = round_up(pos + count, root->sectorsize); in btrfs_file_write_iter()
1830 BTRFS_I(inode)->last_sub_trans = root->log_transid; in btrfs_file_write_iter()
1896 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_sync_file() local
1933 atomic_inc(&root->log_batch); in btrfs_sync_file()
1987 atomic_inc(&root->log_batch); in btrfs_sync_file()
2018 if (btrfs_inode_in_log(inode, root->fs_info->generation) || in btrfs_sync_file()
2020 root->fs_info->last_trans_committed && in btrfs_sync_file()
2051 trans = btrfs_start_transaction(root, 0); in btrfs_sync_file()
2061 ret = btrfs_log_dentry_safe(trans, root, dentry, start, end, &ctx); in btrfs_sync_file()
2093 btrfs_end_transaction(trans, root); in btrfs_sync_file()
2100 ret = btrfs_sync_log(trans, root, &ctx); in btrfs_sync_file()
2102 ret = btrfs_end_transaction(trans, root); in btrfs_sync_file()
2109 btrfs_end_transaction(trans, root); in btrfs_sync_file()
2113 ret = btrfs_commit_transaction(trans, root); in btrfs_sync_file()
2115 ret = btrfs_end_transaction(trans, root); in btrfs_sync_file()
2172 struct btrfs_root *root = BTRFS_I(inode)->root; in fill_holes() local
2180 if (btrfs_fs_incompat(root->fs_info, NO_HOLES)) in fill_holes()
2187 ret = btrfs_search_slot(trans, root, &key, path, 0, 1); in fill_holes()
2212 btrfs_set_item_key_safe(root->fs_info, path, &key); in fill_holes()
2225 ret = btrfs_insert_file_extent(trans, root, btrfs_ino(inode), offset, in fill_holes()
2248 hole_em->bdev = root->fs_info->fs_devices->latest_bdev; in fill_holes()
2300 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_punch_hole() local
2311 u64 min_size = btrfs_calc_trunc_metadata_size(root, 1); in btrfs_punch_hole()
2317 bool no_holes = btrfs_fs_incompat(root->fs_info, NO_HOLES); in btrfs_punch_hole()
2337 lockstart = round_up(offset, BTRFS_I(inode)->root->sectorsize); in btrfs_punch_hole()
2339 BTRFS_I(inode)->root->sectorsize) - 1; in btrfs_punch_hole()
2453 rsv = btrfs_alloc_block_rsv(root, BTRFS_BLOCK_RSV_TEMP); in btrfs_punch_hole()
2458 rsv->size = btrfs_calc_trunc_metadata_size(root, 1); in btrfs_punch_hole()
2467 trans = btrfs_start_transaction(root, rsv_count); in btrfs_punch_hole()
2473 ret = btrfs_block_rsv_migrate(&root->fs_info->trans_block_rsv, rsv, in btrfs_punch_hole()
2481 ret = __btrfs_drop_extents(trans, root, inode, path, in btrfs_punch_hole()
2487 trans->block_rsv = &root->fs_info->trans_block_rsv; in btrfs_punch_hole()
2500 ret = btrfs_update_inode(trans, root, inode); in btrfs_punch_hole()
2506 btrfs_end_transaction(trans, root); in btrfs_punch_hole()
2507 btrfs_btree_balance_dirty(root); in btrfs_punch_hole()
2509 trans = btrfs_start_transaction(root, rsv_count); in btrfs_punch_hole()
2516 ret = btrfs_block_rsv_migrate(&root->fs_info->trans_block_rsv, in btrfs_punch_hole()
2535 trans->block_rsv = &root->fs_info->trans_block_rsv; in btrfs_punch_hole()
2569 trans->block_rsv = &root->fs_info->trans_block_rsv; in btrfs_punch_hole()
2570 ret = btrfs_update_inode(trans, root, inode); in btrfs_punch_hole()
2572 btrfs_end_transaction(trans, root); in btrfs_punch_hole()
2573 btrfs_btree_balance_dirty(root); in btrfs_punch_hole()
2576 btrfs_free_block_rsv(root, rsv); in btrfs_punch_hole()
2589 trans = btrfs_start_transaction(root, 1); in btrfs_punch_hole()
2593 err = btrfs_update_inode(trans, root, inode); in btrfs_punch_hole()
2594 ret = btrfs_end_transaction(trans, root); in btrfs_punch_hole()
2659 int blocksize = BTRFS_I(inode)->root->sectorsize; in btrfs_fallocate()
2806 struct btrfs_root *root = BTRFS_I(inode)->root; in btrfs_fallocate() local
2813 trans = btrfs_start_transaction(root, 1); in btrfs_fallocate()
2820 ret = btrfs_update_inode(trans, root, inode); in btrfs_fallocate()
2822 btrfs_end_transaction(trans, root); in btrfs_fallocate()
2824 ret = btrfs_end_transaction(trans, root); in btrfs_fallocate()
2848 struct btrfs_root *root = BTRFS_I(inode)->root; in find_desired_extent() local
2866 lockstart = round_down(start, root->sectorsize); in find_desired_extent()
2867 lockend = round_up(i_size_read(inode), root->sectorsize); in find_desired_extent()
2869 lockend = lockstart + root->sectorsize; in find_desired_extent()