Lines Matching refs:root

25 #include "root-tree.h"
137 * The root we are currently replaying to. This is NULL for the replay
140 struct btrfs_root *root;
195 "subvolume (root %llu) leaf currently being processed:",
196 btrfs_root_id(wc->root));
202 "log tree (for root %llu) leaf currently being processed (slot %d key " BTRFS_KEY_FMT "):",
203 btrfs_root_id(wc->root), wc->log_slot,
213 "log replay failed in %s:%u for root %llu, stage %d, with error %d: %pV",
214 function, line, btrfs_root_id(wc->root), wc->stage, error, &vaf);
235 static void wait_log_commit(struct btrfs_root *root, int transid);
248 * a special tree (one per subvolume root), that tree is written to disk
260 static struct btrfs_inode *btrfs_iget_logging(u64 objectid, struct btrfs_root *root)
266 ASSERT(btrfs_is_fstree(btrfs_root_id(root)), "root_id=%llu", btrfs_root_id(root));
276 inode = btrfs_iget(objectid, root);
288 struct btrfs_root *root,
291 struct btrfs_fs_info *fs_info = root->fs_info;
298 * First check if the log root tree was already created. If not, create
299 * it before locking the root's log_mutex, just to keep lockdep happy.
315 mutex_lock(&root->log_mutex);
318 if (root->log_root) {
319 int index = (root->log_transid + 1) % 2;
326 if (zoned && atomic_read(&root->log_commit[index])) {
327 wait_log_commit(root, root->log_transid - 1);
331 if (!root->log_start_pid) {
332 clear_bit(BTRFS_ROOT_MULTI_LOG_TASKS, &root->state);
333 root->log_start_pid = current->pid;
334 } else if (root->log_start_pid != current->pid) {
335 set_bit(BTRFS_ROOT_MULTI_LOG_TASKS, &root->state);
349 ret = btrfs_add_log_tree(trans, root);
353 set_bit(BTRFS_ROOT_HAS_LOG_TREE, &root->state);
354 clear_bit(BTRFS_ROOT_MULTI_LOG_TASKS, &root->state);
355 root->log_start_pid = current->pid;
358 atomic_inc(&root->log_writers);
360 int index = root->log_transid % 2;
361 list_add_tail(&ctx->list, &root->log_ctxs[index]);
362 ctx->log_transid = root->log_transid;
366 mutex_unlock(&root->log_mutex);
375 static int join_running_log_trans(struct btrfs_root *root)
377 const bool zoned = btrfs_is_zoned(root->fs_info);
380 if (!test_bit(BTRFS_ROOT_HAS_LOG_TREE, &root->state))
383 mutex_lock(&root->log_mutex);
385 if (root->log_root) {
386 int index = (root->log_transid + 1) % 2;
389 if (zoned && atomic_read(&root->log_commit[index])) {
390 wait_log_commit(root, root->log_transid - 1);
393 atomic_inc(&root->log_writers);
395 mutex_unlock(&root->log_mutex);
404 void btrfs_pin_log_trans(struct btrfs_root *root)
406 atomic_inc(&root->log_writers);
413 void btrfs_end_log_trans(struct btrfs_root *root)
415 if (atomic_dec_and_test(&root->log_writers)) {
417 cond_wake_up_nomb(&root->log_writer_wait);
474 * The given root is for the tree we are copying into, and path is a scratch
487 struct btrfs_root *root = wc->root;
499 * This is only used during log replay, so the root is always from a
500 * fs/subvolume tree. In case we ever need to support a log root, then
505 ASSERT(btrfs_root_id(root) != BTRFS_TREE_LOG_OBJECTID, "root_id=%llu", btrfs_root_id(root));
511 ret = btrfs_search_slot(NULL, root, &wc->log_key, wc->subvol_path, 0, 0);
514 "failed to search subvolume tree for key " BTRFS_KEY_FMT " root %llu",
516 btrfs_root_id(root));
606 ret = btrfs_insert_empty_item(trans, root, wc->subvol_path, &wc->log_key, item_size);
706 * subvolume 'root'. path is released on entry and should be released
720 struct btrfs_root *root = wc->root;
722 struct btrfs_fs_info *fs_info = root->fs_info;
751 "unexpected extent type=%d root=%llu inode=%llu offset=%llu",
752 found_type, btrfs_root_id(root),
757 inode = btrfs_iget_logging(wc->log_key.objectid, root);
761 "failed to get inode %llu for root %llu",
762 wc->log_key.objectid, btrfs_root_id(root));
771 ret = btrfs_lookup_file_extent(trans, root, wc->subvol_path,
801 ret = btrfs_drop_extents(trans, root, inode, &drop_args);
804 "failed to drop extents for inode %llu range [%llu, %llu) root %llu",
806 btrfs_root_id(root));
828 ret = btrfs_insert_empty_item(trans, root, wc->subvol_path,
832 "failed to insert item with key " BTRFS_KEY_FMT " root %llu",
834 btrfs_root_id(root));
868 "failed to trace extent for bytenr %llu disk_num_bytes %llu inode %llu root %llu",
870 wc->log_key.objectid, btrfs_root_id(root));
881 "failed to lookup data extent for bytenr %llu disk_num_bytes %llu inode %llu root %llu",
883 wc->log_key.objectid, btrfs_root_id(root));
890 .owning_root = btrfs_root_id(root),
891 .ref_root = btrfs_root_id(root),
898 "failed to increment data extent for bytenr %llu disk_num_bytes %llu inode %llu root %llu",
901 btrfs_root_id(root));
906 ret = btrfs_alloc_logged_file_extent(trans, btrfs_root_id(root),
910 "failed to allocate logged data extent for bytenr %llu disk_num_bytes %llu offset %llu inode %llu root %llu",
912 wc->log_key.objectid, btrfs_root_id(root));
927 ret = btrfs_lookup_csums_list(root->log_root, csum_start, csum_end - 1,
931 "failed to lookups csums for range [%llu, %llu) inode %llu root %llu",
933 btrfs_root_id(root));
938 * Now delete all existing cums in the csum root that cover our range.
989 "missing csum root for extent at bytenr %llu",
999 "failed to delete csums for range [%llu, %llu) inode %llu root %llu",
1003 btrfs_root_id(root));
1009 "failed to add csums for range [%llu, %llu) inode %llu root %llu",
1013 btrfs_root_id(root));
1025 "failed to set file extent range [%llu, %llu) inode %llu root %llu",
1027 btrfs_root_id(root));
1035 "failed to update inode %llu root %llu",
1036 wc->log_key.objectid, btrfs_root_id(root));
1053 "failed to unlink inode %llu parent dir %llu name %.*s root %llu",
1055 name->name, btrfs_root_id(inode->root));
1067 "failed to run delayed items current inode %llu parent dir %llu name %.*s root %llu",
1069 name->name, btrfs_root_id(inode->root));
1086 struct btrfs_root *root = dir->root;
1097 "failed to allocate name for dir %llu root %llu",
1098 btrfs_ino(dir), btrfs_root_id(root));
1104 inode = btrfs_iget_logging(location.objectid, root);
1108 "failed to open inode %llu parent dir %llu name %.*s root %llu",
1110 name.len, name.name, btrfs_root_id(root));
1134 static noinline int inode_in_dir(struct btrfs_root *root,
1143 di = btrfs_lookup_dir_index_item(NULL, root, path, dirid,
1157 di = btrfs_lookup_dir_item(NULL, root, path, dirid, name, 0);
1236 "failed to allocate name for inode %llu parent dir %llu root %llu",
1238 btrfs_root_id(inode->root));
1246 "failed to check if backref is in log tree for inode %llu parent dir %llu name %.*s root %llu",
1249 btrfs_root_id(inode->root));
1297 "failed to allocate name for inode %llu parent dir %llu root %llu",
1299 btrfs_root_id(inode->root));
1312 "failed to check if backref is in log tree for inode %llu parent dir %llu name %.*s root %llu",
1315 btrfs_root_id(inode->root));
1345 struct btrfs_root *root = wc->root;
1355 ret = btrfs_search_slot(NULL, root, &search_key, wc->subvol_path, 0, 0);
1358 "failed to search subvolume tree for key " BTRFS_KEY_FMT " root %llu",
1360 btrfs_root_id(root));
1364 * Are we trying to overwrite a back ref for the root directory?
1379 extref = btrfs_lookup_inode_extref(root, wc->subvol_path, name,
1393 di = btrfs_lookup_dir_index_item(trans, root, wc->subvol_path, btrfs_ino(dir),
1398 "failed to lookup dir index item for dir %llu ref_index %llu name %.*s root %llu",
1400 name->name, btrfs_root_id(root));
1410 di = btrfs_lookup_dir_item(trans, root, wc->subvol_path, btrfs_ino(dir), name, 0);
1414 "failed to lookup dir item for dir %llu name %.*s root %llu",
1416 btrfs_root_id(root));
1478 struct btrfs_root *root = wc->root;
1486 ret = btrfs_search_slot(NULL, root, &wc->log_key, wc->subvol_path, 0, 0);
1493 "failed to search subvolume tree for key " BTRFS_KEY_FMT " root %llu",
1495 btrfs_root_id(root));
1511 "failed to get extref details for inode %llu root %llu",
1513 btrfs_root_id(root));
1521 "failed to get ref details for inode %llu parent_id %llu root %llu",
1523 btrfs_root_id(root));
1539 dir = btrfs_iget_logging(parent_id, root);
1544 "failed to lookup dir inode %llu root %llu",
1545 parent_id, btrfs_root_id(root));
1576 struct btrfs_root *root = wc->root;
1610 dir = btrfs_iget_logging(parent_objectid, root);
1617 "failed to lookup dir inode %llu root %llu",
1618 parent_objectid, btrfs_root_id(root));
1623 inode = btrfs_iget_logging(inode_objectid, root);
1627 "failed to lookup inode %llu root %llu",
1628 inode_objectid, btrfs_root_id(root));
1639 "failed to get extref details for inode %llu root %llu",
1641 btrfs_root_id(root));
1649 dir = btrfs_iget_logging(parent_objectid, root);
1670 "failed to lookup dir inode %llu root %llu",
1672 btrfs_root_id(root));
1681 "failed to get ref details for inode %llu parent_objectid %llu root %llu",
1684 btrfs_root_id(root));
1689 ret = inode_in_dir(root, wc->subvol_path, btrfs_ino(dir),
1693 "failed to check if inode %llu is in dir %llu ref_index %llu name %.*s root %llu",
1696 btrfs_root_id(root));
1717 "failed to add link for inode %llu in dir %llu ref_index %llu name %.*s root %llu",
1721 btrfs_root_id(root));
1728 "failed to update inode %llu root %llu",
1730 btrfs_root_id(root));
1784 ret = btrfs_find_one_extref(inode->root, inode_objectid, offset,
1828 ret = btrfs_search_slot(NULL, inode->root, &key, path, 0, 0);
1883 struct btrfs_root *root = inode->root;
1917 ret = btrfs_insert_orphan_item(trans, root, ino);
1937 struct btrfs_root *root = wc->root;
1940 ret = btrfs_search_slot(trans, root, &key, wc->subvol_path, -1, 1);
1956 ret = btrfs_del_item(trans, root, wc->subvol_path);
1961 inode = btrfs_iget_logging(key.offset, root);
1992 struct btrfs_root *root = wc->root;
1998 inode = btrfs_iget_logging(objectid, root);
2002 "failed to lookup inode %llu root %llu",
2003 objectid, btrfs_root_id(root));
2012 ret = btrfs_insert_empty_item(trans, root, wc->subvol_path, &key, 0);
2023 "failed to update inode %llu root %llu",
2024 objectid, btrfs_root_id(root));
2029 "failed to insert fixup item for inode %llu root %llu",
2030 objectid, btrfs_root_id(root));
2043 struct btrfs_root *root,
2052 inode = btrfs_iget_logging(location->objectid, root);
2056 dir = btrfs_iget_logging(dirid, root);
2117 struct btrfs_root *root = wc->root;
2132 dir = btrfs_iget_logging(wc->log_key.objectid, root);
2136 "failed to lookup dir inode %llu root %llu",
2137 wc->log_key.objectid, btrfs_root_id(root));
2145 "failed to allocate name for dir %llu root %llu",
2146 btrfs_ino(dir), btrfs_root_id(root));
2152 ret = btrfs_lookup_inode(trans, root, wc->subvol_path, &log_key, 0);
2156 "failed to lookup inode %llu root %llu",
2157 log_key.objectid, btrfs_root_id(root));
2163 dir_dst_di = btrfs_lookup_dir_item(trans, root, wc->subvol_path,
2168 "failed to lookup dir item for dir %llu name %.*s root %llu",
2170 btrfs_root_id(root));
2177 "failed to delete conflicting entry for dir %llu name %.*s root %llu",
2179 btrfs_root_id(root));
2187 index_dst_di = btrfs_lookup_dir_index_item(trans, root, wc->subvol_path,
2193 "failed to lookup dir index item for dir %llu name %.*s root %llu",
2195 btrfs_root_id(root));
2202 "failed to delete conflicting entry for dir %llu name %.*s root %llu",
2204 btrfs_root_id(root));
2225 ret = backref_in_log(root->log_root, &search_key, 0, &name);
2228 "failed to check if ref item is logged for inode %llu dir %llu name %.*s root %llu",
2230 name.len, name.name, btrfs_root_id(root));
2242 ret = backref_in_log(root->log_root, &search_key, wc->log_key.objectid, &name);
2245 "failed to check if extref item is logged for inode %llu dir %llu name %.*s root %llu",
2247 name.len, name.name, btrfs_root_id(root));
2255 ret = insert_one_name(trans, root, wc->log_key.objectid, wc->log_key.offset,
2259 "failed to insert name %.*s for inode %llu dir %llu root %llu",
2261 btrfs_ino(dir), btrfs_root_id(root));
2275 "failed to update dir inode %llu root %llu",
2276 btrfs_ino(dir), btrfs_root_id(root));
2347 static noinline int find_dir_range(struct btrfs_root *root,
2365 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
2396 ret = btrfs_next_leaf(root, path);
2430 struct btrfs_root *root = dir->root;
2453 "failed to allocate name for dir %llu index %llu root %llu",
2455 btrfs_root_id(root));
2468 "failed to lookup dir index item for dir %llu index %llu name %.*s root %llu",
2471 btrfs_root_id(root));
2483 inode = btrfs_iget_logging(location.objectid, root);
2488 "failed to lookup inode %llu root %llu",
2489 location.objectid, btrfs_root_id(root));
2516 struct btrfs_root *root = wc->root;
2534 ret = btrfs_search_slot(NULL, root, &search_key, wc->subvol_path, 0, 0);
2537 "failed to search xattrs for inode %llu root %llu",
2538 ino, btrfs_root_id(root));
2582 di = btrfs_lookup_xattr(trans, root, wc->subvol_path, ino,
2587 "failed to lookup xattr with name %.*s for inode %llu root %llu",
2589 btrfs_root_id(root));
2594 ret = btrfs_delete_one_dir_name(trans, root,
2598 "failed to delete xattr with name %.*s for inode %llu root %llu",
2600 btrfs_root_id(root));
2612 "failed to lookup xattr in log tree with name %.*s for inode %llu root %llu",
2614 btrfs_root_id(root));
2623 ret = btrfs_next_leaf(root, wc->subvol_path);
2630 "failed to get next leaf in subvolume root %llu",
2631 btrfs_root_id(root));
2651 struct btrfs_root *root = wc->root;
2669 dir = btrfs_iget_logging(dirid, root);
2680 "failed to lookup dir inode %llu root %llu",
2681 dirid, btrfs_root_id(root));
2695 "failed to find range for dir %llu in log tree root %llu",
2696 dirid, btrfs_root_id(root));
2706 ret = btrfs_search_slot(NULL, root, &dir_key,
2710 "failed to search root %llu for key " BTRFS_KEY_FMT,
2711 btrfs_root_id(root),
2718 ret = btrfs_next_leaf(root, wc->subvol_path);
2723 "failed to get next leaf in subvolume root %llu",
2724 btrfs_root_id(root));
2777 struct btrfs_root *root = wc->root;
2792 "failed to read log tree leaf %llu for root %llu",
2793 eb->start, btrfs_root_id(root));
2873 inode = btrfs_iget_logging(wc->log_key.objectid, root);
2877 "failed to lookup inode %llu root %llu",
2879 btrfs_root_id(root));
2883 root->fs_info->sectorsize);
2888 ret = btrfs_drop_extents(trans, root, inode, &drop_args);
2891 "failed to drop extents for inode %llu root %llu offset %llu",
2893 btrfs_root_id(root),
2902 "failed to update inode %llu root %llu",
2904 btrfs_root_id(root));
3159 /* was the root node processed? if not, catch it here */
3174 * helper function to update the item for a given subvolumes log root
3185 /* insert root item on the first sync */
3195 static void wait_log_commit(struct btrfs_root *root, int transid)
3206 prepare_to_wait(&root->log_commit_wait[index],
3209 if (!(root->log_transid_committed < transid &&
3210 atomic_read(&root->log_commit[index])))
3213 mutex_unlock(&root->log_mutex);
3215 mutex_lock(&root->log_mutex);
3217 finish_wait(&root->log_commit_wait[index], &wait);
3220 static void wait_for_writer(struct btrfs_root *root)
3225 prepare_to_wait(&root->log_writer_wait, &wait,
3227 if (!atomic_read(&root->log_writers))
3230 mutex_unlock(&root->log_mutex);
3232 mutex_lock(&root->log_mutex);
3234 finish_wait(&root->log_writer_wait, &wait);
3266 ctx->scratch_eb = alloc_dummy_extent_buffer(inode->root->fs_info, 0);
3283 static inline void btrfs_remove_log_ctx(struct btrfs_root *root,
3286 mutex_lock(&root->log_mutex);
3288 mutex_unlock(&root->log_mutex);
3295 static inline void btrfs_remove_all_log_ctxs(struct btrfs_root *root,
3301 list_for_each_entry_safe(ctx, safe, &root->log_ctxs[index], list) {
3319 struct btrfs_root *root, struct btrfs_log_ctx *ctx)
3325 struct btrfs_fs_info *fs_info = root->fs_info;
3326 struct btrfs_root *log = root->log_root;
3335 mutex_lock(&root->log_mutex);
3337 if (root->log_transid_committed >= log_transid) {
3338 mutex_unlock(&root->log_mutex);
3343 if (atomic_read(&root->log_commit[index1])) {
3344 wait_log_commit(root, log_transid);
3345 mutex_unlock(&root->log_mutex);
3348 ASSERT(log_transid == root->log_transid,
3349 "log_transid=%d root->log_transid=%d", log_transid, root->log_transid);
3350 atomic_set(&root->log_commit[index1], 1);
3353 if (atomic_read(&root->log_commit[(index1 + 1) % 2]))
3354 wait_log_commit(root, log_transid - 1);
3357 int batch = atomic_read(&root->log_batch);
3360 test_bit(BTRFS_ROOT_MULTI_LOG_TASKS, &root->state)) {
3361 mutex_unlock(&root->log_mutex);
3363 mutex_lock(&root->log_mutex);
3365 wait_for_writer(root);
3366 if (batch == atomic_read(&root->log_batch))
3373 mutex_unlock(&root->log_mutex);
3401 mutex_unlock(&root->log_mutex);
3406 * We _must_ update under the root->log_mutex in order to make sure we
3407 * have a consistent view of the log root we are trying to commit at
3421 btrfs_set_root_log_transid(root, root->log_transid + 1);
3422 log->log_transid = root->log_transid;
3423 root->log_start_pid = 0;
3429 mutex_unlock(&root->log_mutex);
3464 "failed to update log for root %llu ret %d",
3465 btrfs_root_id(root), ret);
3589 * root->log_commit[index1] to 0 and any task attempting to sync the
3595 ASSERT(btrfs_get_root_last_log_commit(root) <= log_transid,
3596 "last_log_commit(root)=%d log_transid=%d",
3597 btrfs_get_root_last_log_commit(root), log_transid);
3598 btrfs_set_root_last_log_commit(root, log_transid);
3615 mutex_lock(&root->log_mutex);
3616 btrfs_remove_all_log_ctxs(root, index1, ret);
3617 root->log_transid_committed++;
3618 atomic_set(&root->log_commit[index1], 0);
3619 mutex_unlock(&root->log_mutex);
3626 cond_wake_up(&root->log_commit_wait[index1]);
3684 int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root)
3686 if (root->log_root) {
3687 free_log_tree(trans, root->log_root);
3688 root->log_root = NULL;
3689 clear_bit(BTRFS_ROOT_HAS_LOG_TREE, &root->state);
3775 * If no log tree was created for this root in this transaction, then
3781 if (!test_bit(BTRFS_ROOT_HAS_LOG_TREE, &inode->root->state))
3805 * case 3) and return true. So we do a search in the log root for the inode
3818 ret = btrfs_search_slot(NULL, inode->root->log_root, &key, path, 0, 0);
3911 struct btrfs_root *root = dir->root;
3929 ret = join_running_log_trans(root);
3936 ret = del_logged_dentry(trans, root->log_root, path, btrfs_ino(dir),
3941 btrfs_end_log_trans(root);
3950 struct btrfs_root *root = dir->root;
3961 ret = join_running_log_trans(root);
3967 ret = btrfs_del_inode_ref(trans, root->log_root, name, btrfs_ino(inode),
3972 btrfs_end_log_trans(root);
4029 struct btrfs_root *log = inode->root->log_root;
4144 struct btrfs_root *log = inode->root->log_root;
4258 struct btrfs_root *root = inode->root;
4259 struct btrfs_root *log = root->log_root;
4269 ret = btrfs_search_forward(root, &min_key, path, trans->transid);
4281 ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0);
4286 ret = btrfs_previous_item(root, path, ino, BTRFS_DIR_INDEX_KEY);
4308 ret = btrfs_previous_item(root, path, ino, BTRFS_DIR_INDEX_KEY);
4335 * key might be deleted from the inode's root, and therefore we may not
4344 ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0);
4346 ret = btrfs_next_item(root, path);
4348 /* There are no more keys in the inode's root. */
4374 ret = btrfs_next_leaf(root, path);
4462 ret = btrfs_search_slot(NULL, inode->root->log_root, &key, path, 0, 0);
4781 struct btrfs_root *log = inode->root->log_root;
4913 "missing csum root for extent at bytenr %llu",
5116 "missing csum root for extent at bytenr %llu",
5148 struct btrfs_root *log = inode->root->log_root;
5189 * are small, with a root at level 2 or 3 at most, due to their short
5226 * subvolume's root instead of iterating the inode's extent map tree because
5236 struct btrfs_root *root = inode->root;
5255 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
5267 ret = btrfs_previous_item(root, path, ino, BTRFS_EXTENT_DATA_KEY);
5305 ret = btrfs_next_leaf(root, path);
5333 ret = truncate_inode_items(trans, root->log_root, inode,
5480 ret = btrfs_search_slot(NULL, inode->root->log_root, &key, path, 0, 0);
5484 ret = btrfs_search_slot(NULL, inode->root, &key, path, 0, 0);
5495 * its inode item must exist in the log root or in the commit root.
5538 struct btrfs_root *root = inode->root;
5553 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
5570 ret = btrfs_next_leaf(root, path);
5615 struct btrfs_root *root = inode->root;
5616 struct btrfs_fs_info *fs_info = root->fs_info;
5630 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
5638 ret = btrfs_next_leaf(root, path);
5658 * paths that search the root while holding locks on
5659 * leafs from the log root.
5662 ret = btrfs_insert_hole_extent(trans, root->log_root,
5669 * Search for the same key again in the root. Since it's
5675 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
5693 ret = btrfs_insert_hole_extent(trans, root->log_root, ino,
5804 di = btrfs_lookup_dir_item(NULL, inode->root, search_path,
5913 struct btrfs_root *root = start_inode->root;
5940 btrfs_for_each_slot(root->log_root, &key, &found_key, path, iter_ret) {
5965 di_inode = btrfs_iget_logging(di_key.objectid, root);
6023 curr_inode = btrfs_iget_logging(ino, root);
6062 static int conflicting_inode_is_dir(struct btrfs_root *root, u64 ino,
6075 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
6078 * We have previously found the inode through the commit root
6127 struct btrfs_root *root,
6145 inode = btrfs_iget_logging(ino, root);
6172 ret = conflicting_inode_is_dir(root, ino, path);
6193 * From the commit root (previous transaction) we have the following
6248 struct btrfs_root *root,
6282 inode = btrfs_iget_logging(ino, root);
6293 inode = btrfs_iget_logging(parent, root);
6372 struct btrfs_root *root = inode->root;
6378 ret = btrfs_search_forward(root, min_key, path, trans->transid);
6429 ret = add_conflicting_inode(trans, root, path,
6554 struct btrfs_root *log = inode->root->log_root;
6674 ret = insert_dir_log_key(trans, inode->root->log_root, path,
6714 return btrfs_del_items(trans, inode->root->log_root, path,
6724 struct btrfs_root *log = inode->root->log_root;
6851 di_inode = btrfs_iget_logging(key.objectid, inode->root);
6906 struct btrfs_root *log = inode->root->log_root;
7230 ret = log_conflicting_inodes(trans, inode->root, ctx);
7251 struct btrfs_root *root = inode->root;
7263 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
7275 ret = btrfs_next_leaf(root, path);
7308 dir_inode = btrfs_iget_logging(dir_id, root);
7354 struct btrfs_root *root,
7377 inode = btrfs_iget_logging(ino, root);
7392 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0);
7399 ret = btrfs_next_leaf(root, path);
7421 struct btrfs_root *root = inode->root;
7432 if (root != inode->root)
7459 struct btrfs_root *root = inode->root;
7480 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0);
7492 ret = btrfs_next_leaf(root, path);
7523 ret = log_new_ancestors(trans, root, path, ctx);
7544 struct btrfs_root *root = inode->root;
7545 struct btrfs_fs_info *fs_info = root->fs_info;
7552 if (btrfs_root_refs(&root->root_item) == 0)
7557 * transaction we must force a commit since the root is not persisted.
7559 if (btrfs_root_generation(&root->root_item) == trans->transid)
7567 ret = start_log_trans(trans, root, ctx);
7654 btrfs_remove_log_ctx(root, ctx);
7655 btrfs_end_log_trans(root);
7661 * it is not safe to log dentry if the chunk root has added new
7752 wc.root = btrfs_get_fs_root(fs_info, found_key.offset, true);
7753 if (IS_ERR(wc.root)) {
7754 ret = PTR_ERR(wc.root);
7755 wc.root = NULL;
7766 * We need to exclude the root because we can't have
7780 wc.root->log_root = wc.log;
7781 ret = btrfs_record_root_in_trans(trans, wc.root);
7794 struct btrfs_root *root = wc.root;
7808 * root->objectid_mutex is not acquired as log replay
7811 ret = btrfs_init_root_free_objectid(root);
7818 if (wc.root) {
7819 wc.root->log_root = NULL;
7820 btrfs_put_root(wc.root);
7930 * that after replaying the log tree of the parent directory's root we will not
7932 * corresponding to the deleted snapshot's root, which could lead to replaying
7937 * parent root and tree of tree roots trees, etc) are done.
7951 * points to an unpersisted root if we are still in the transaction used to
7989 struct btrfs_root *root = inode->root;
8045 struct btrfs_root *log = old_dir->root->log_root;
8070 ret = join_running_log_trans(root);
8134 btrfs_end_log_trans(root);