Lines Matching defs:path
568 struct ocfs2_path *path,
571 * Reset the actual path elements so that we can re-use the structure
572 * to build another path. Generally, this involves freeing the buffer
575 void ocfs2_reinit_path(struct ocfs2_path *path, int keep_root)
583 for(i = start; i < path_num_items(path); i++) {
584 node = &path->p_node[i];
593 * keeping the root extent list, then make sure that our path
597 depth = le16_to_cpu(path_root_el(path)->l_tree_depth);
599 path_root_access(path) = NULL;
601 path->p_tree_depth = depth;
604 void ocfs2_free_path(struct ocfs2_path *path)
606 if (path) {
607 ocfs2_reinit_path(path, 0);
608 kfree(path);
639 * Make the *dest path the same as src and re-initialize src path to
665 static inline void ocfs2_path_insert_eb(struct ocfs2_path *path, int index,
678 path->p_node[index].bh = eb_bh;
679 path->p_node[index].el = &eb->h_list;
686 struct ocfs2_path *path;
690 path = kzalloc(sizeof(*path), GFP_NOFS);
691 if (path) {
692 path->p_tree_depth = le16_to_cpu(root_el->l_tree_depth);
694 path_root_bh(path) = root_bh;
695 path_root_el(path) = root_el;
696 path_root_access(path) = access;
699 return path;
702 struct ocfs2_path *ocfs2_new_path_from_path(struct ocfs2_path *path)
704 return ocfs2_new_path(path_root_bh(path), path_root_el(path),
705 path_root_access(path));
723 struct ocfs2_path *path,
726 ocfs2_journal_access_func access = path_root_access(path);
734 return access(handle, ci, path->p_node[idx].bh,
739 * Convenience function to journal all components in a path.
743 struct ocfs2_path *path)
747 if (!path)
750 for(i = 0; i < path_num_items(path); i++) {
751 ret = ocfs2_path_bh_journal_access(handle, ci, path, i);
851 * we'll have to update the path to that leaf.
1090 * Change range of the branches in the right most path according to the leaf
1097 struct ocfs2_path *path = NULL;
1101 path = ocfs2_new_path_from_et(et);
1102 if (!path) {
1107 status = ocfs2_find_path(et->et_ci, path, UINT_MAX);
1113 status = ocfs2_extend_trans(handle, path_num_items(path));
1119 status = ocfs2_journal_access_path(et->et_ci, handle, path);
1125 el = path_leaf_el(path);
1128 ocfs2_adjust_rightmost_records(handle, et, path, rec);
1131 ocfs2_free_path(path);
1739 * the lowest level tree node which contains a path to both leafs. This
1743 * pair of adjacent leaves. It's task is to figure out which path
1782 * Traverse a btree path in search of cpos, starting at root_el.
1785 * case it will return the rightmost path.
1872 * Given an initialized path (that is, it has a valid root extent
1873 * list), this function will traverse the btree in search of the path
1876 * The path traveled is recorded in the path structure.
1884 struct ocfs2_path *path;
1891 ocfs2_path_insert_eb(fp->path, fp->index, bh);
1895 struct ocfs2_path *path, u32 cpos)
1900 data.path = path;
1901 return __ocfs2_find_path(ci, path_root_el(path), cpos,
1921 * Some paths want to call this instead of allocating a path structure
2015 * The path walking code should have never returned a root and
2029 * - When we've moved an extent record from the left path leaf to the right
2030 * path leaf to make room for an empty extent in the left path leaf.
2031 * - When our insert into the right path leaf is at the leftmost edge
2032 * and requires an update of the path immediately to it's left. This
2034 * - When we've adjusted the last extent record in the left path leaf and the
2035 * 1st extent record in the right path leaf during cross extent block merge.
2092 * begin our path to the leaves.
2205 * Given a full path, determine what cpos value would return us a path
2208 * Will return zero if the path passed in is already the leftmost path.
2211 struct ocfs2_path *path, u32 *cpos)
2217 BUG_ON(path->p_tree_depth == 0);
2221 blkno = path_leaf_bh(path)->b_blocknr;
2224 i = path->p_tree_depth - 1;
2226 el = path->p_node[i].el;
2230 * path.
2238 * path specified is already
2270 blkno = path->p_node[i].bh->b_blocknr;
2285 struct ocfs2_path *path)
2288 int credits = (path->p_tree_depth - subtree_depth) * 2 + 1 + op_credits;
2304 * theoretical ranges in the path components above the leaves are
2349 * The path to the rightmost leaf should be passed in.
2351 * The array is assumed to be large enough to hold an entire path (tree depth).
2355 * - The 'right_path' array will contain a path to the leaf block
2359 * *ret_left_path will contain a valid path which can be passed to
2396 * 1) Start with the rightmost path.
2398 * 2) Determine a path to the leaf block directly to the left
2402 * which contains a path to both leaves.
2406 * 5) Find the next subtree by considering the left path to be
2407 * the new right path.
2411 * value to get us the left path - insert_cpos might very well
2434 "(left path cpos %u) results in two identical "
2450 * situation by returning the left path.
2503 * There is no need to re-read the next right path
2505 * path. Optimize by copying values instead.
2525 struct ocfs2_path *path)
2533 ret = ocfs2_journal_access_path(et->et_ci, handle, path);
2540 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
2549 for (i = 0; i < path->p_tree_depth; i++) {
2550 el = path->p_node[i].el;
2557 ocfs2_journal_dirty(handle, path->p_node[i].bh);
2566 struct ocfs2_path *path, int unlink_start)
2573 for(i = unlink_start; i < path_num_items(path); i++) {
2574 bh = path->p_node[i].bh;
2713 * Getting here with an empty extent in the right path implies
2714 * that it's the rightmost path and will be deleted.
2745 * after removal of the right path in which case we
2779 * above so we could delete the right path
2797 * Given a full path, determine what cpos value would return us a path
2800 * Will return zero if the path passed in is already the rightmost path.
2806 struct ocfs2_path *path, u32 *cpos)
2814 if (path->p_tree_depth == 0)
2817 blkno = path_leaf_bh(path)->b_blocknr;
2820 i = path->p_tree_depth - 1;
2824 el = path->p_node[i].el;
2828 * path.
2837 * path specified is already
2866 blkno = path->p_node[i].bh->b_blocknr;
2876 struct ocfs2_path *path)
2879 struct buffer_head *bh = path_leaf_bh(path);
2880 struct ocfs2_extent_list *el = path_leaf_el(path);
2885 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, path,
2886 path_num_items(path) - 1);
2902 struct ocfs2_path *path,
2912 if (!ocfs2_is_empty_extent(&(path_leaf_el(path)->l_recs[0])))
2917 ret = ocfs2_find_cpos_for_right_leaf(sb, path, &right_cpos);
2923 left_path = ocfs2_new_path_from_path(path);
2930 ocfs2_cp_path(left_path, path);
2932 right_path = ocfs2_new_path_from_path(path);
3018 struct ocfs2_path *path,
3031 ret = ocfs2_journal_access_path(et->et_ci, handle, path);
3038 path, &cpos);
3046 * We have a path to the left of this one - it needs
3049 left_path = ocfs2_new_path_from_path(path);
3068 subtree_index = ocfs2_find_subtree_root(et, left_path, path);
3070 ocfs2_unlink_subtree(handle, et, left_path, path,
3082 * 'path' is also the leftmost path which
3088 ocfs2_unlink_path(handle, et, dealloc, path, 1);
3098 ocfs2_journal_dirty(handle, path_root_bh(path));
3107 struct ocfs2_path *path,
3112 int credits = path->p_tree_depth * 2 + 1;
3121 ret = ocfs2_remove_rightmost_path(handle, et, path, dealloc);
3133 * rotation. We start at some non-rightmost path containing an empty
3135 * path by rotating records to the left in every subtree.
3141 * This won't handle a length update of the rightmost path records if
3147 struct ocfs2_path *path,
3155 el = path_leaf_el(path);
3159 if (path->p_tree_depth == 0) {
3165 ret = ocfs2_rotate_rightmost_leaf_left(handle, et, path);
3184 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
3189 * rightmost path. Get the other cases out of the way
3204 * XXX: The caller can not trust "path" any more after
3212 ret = ocfs2_remove_rightmost_path(handle, et, path,
3220 * Now we can loop, remembering the path we get from -EAGAIN
3224 ret = __ocfs2_rotate_tree_left(handle, et, orig_credits, path,
3506 * the right path to indicate the new rightmost path.
3641 * So we use the new rightmost path.
3656 struct ocfs2_path *path,
3663 struct ocfs2_extent_list *el = path_leaf_el(path);
3672 path);
3684 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3713 ret = ocfs2_merge_rec_right(path, handle, et, split_rec,
3728 path);
3735 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3747 ret = ocfs2_merge_rec_left(path, handle, et, rec,
3758 path);
3764 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3781 ret = ocfs2_merge_rec_left(path, handle, et,
3789 ret = ocfs2_merge_rec_right(path, handle,
3802 path);
3813 ret = ocfs2_rotate_tree_left(handle, et, path,
3951 struct ocfs2_path *path,
3962 for (i = 0; i < path->p_tree_depth; i++) {
3963 bh = path->p_node[i].bh;
3964 el = path->p_node[i].el;
4007 * neighboring path.
4095 * started in the left path but moved to the
4100 * In this case, the left path should always
4109 * empty extent in the left path, we
4134 * Left path is easy - we can just allow the insert to
4153 * right_path is the path we want to do the actual insert
4271 * Determine the path to start with. Rotations need the
4272 * rightmost path, everything else can go directly to the
4292 * Both might pass back a path immediate to the left of the
4351 struct ocfs2_path *path,
4368 } else if (path->p_tree_depth > 0) {
4369 status = ocfs2_find_cpos_for_left_leaf(sb, path, &left_cpos);
4374 left_path = ocfs2_new_path_from_path(path);
4421 path->p_tree_depth > 0) {
4422 status = ocfs2_find_cpos_for_right_leaf(sb, path, &right_cpos);
4429 right_path = ocfs2_new_path_from_path(path);
4580 struct ocfs2_path *path = NULL;
4623 path = ocfs2_new_path_from_et(et);
4624 if (!path) {
4633 * us the rightmost tree path. This is accounted for below in
4636 ret = ocfs2_find_path(et->et_ci, path, le32_to_cpu(insert_rec->e_cpos));
4642 el = path_leaf_el(path);
4645 * Now that we have the path, there's two things we want to determine:
4658 * cluster count on the last record of the path directly to it's
4669 * whether the path doesn't exist. This will only happen in
4674 path_leaf_bh(path)->b_blocknr) {
4677 * tree path. This might be an appending insert. There are
4687 ocfs2_free_path(path);
4905 struct ocfs2_path *path,
4925 rec = path_leaf_el(path)->l_recs[split_index];
4989 ocfs2_reinit_path(path, 1);
4992 ret = ocfs2_find_path(et->et_ci, path, cpos);
4998 el = path_leaf_el(path);
5017 struct ocfs2_path *path,
5024 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, path,
5025 path_num_items(path) - 1);
5033 ocfs2_journal_dirty(handle, path_leaf_bh(path));
5040 * pointed to by path. Merge with the contiguous extent record if needed.
5059 struct ocfs2_path *path,
5066 struct ocfs2_extent_list *el = path_leaf_el(path);
5079 ret = ocfs2_figure_merge_contig_type(et, path, el,
5093 if (path->p_tree_depth) {
5117 ret = ocfs2_replace_extent_rec(handle, et, path, el,
5120 ret = ocfs2_split_and_insert(handle, et, path,
5126 ret = ocfs2_try_to_merge_extent(handle, et, path,
5274 struct ocfs2_path *path,
5289 el = path_leaf_el(path);
5294 depth = path->p_tree_depth;
5307 rightmost_el = path_leaf_el(path);
5309 credits = path->p_tree_depth +
5344 struct ocfs2_path *path, int index,
5353 struct ocfs2_extent_list *el = path_leaf_el(path);
5361 path);
5367 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
5377 path->p_tree_depth) {
5384 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
5390 if (index == 0 && path->p_tree_depth &&
5394 * record truncate) of an interior (or rightmost) path
5405 ret = ocfs2_find_cpos_for_left_leaf(sb, path, &left_cpos);
5412 left_path = ocfs2_new_path_from_path(path);
5430 path);
5436 ret = ocfs2_journal_access_path(et->et_ci, handle, path);
5460 * We skip the edge update if this path will
5464 ocfs2_adjust_rightmost_records(handle, et, path,
5476 ocfs2_adjust_rightmost_records(handle, et, path, rec);
5490 subtree_index = ocfs2_find_subtree_root(et, left_path, path);
5491 ocfs2_complete_edge_insert(handle, left_path, path,
5495 ocfs2_journal_dirty(handle, path_leaf_bh(path));
5497 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
5516 struct ocfs2_path *path = NULL;
5524 path = ocfs2_new_path_from_et(et);
5525 if (!path) {
5531 ret = ocfs2_find_path(et->et_ci, path, cpos);
5537 el = path_leaf_el(path);
5576 ret = ocfs2_truncate_rec(handle, et, path, index, dealloc,
5583 ret = ocfs2_split_tree(handle, et, path, index,
5594 ocfs2_reinit_path(path, 1);
5596 ret = ocfs2_find_path(et->et_ci, path, cpos);
5602 el = path_leaf_el(path);
5630 ret = ocfs2_truncate_rec(handle, et, path, index, dealloc,
5637 ocfs2_free_path(path);
7208 struct ocfs2_path *path = NULL;
7222 path = ocfs2_new_path(di_bh, &di->id2.i_list,
7224 if (!path) {
7244 status = ocfs2_find_path(INODE_CACHE(inode), path, UINT_MAX);
7254 path->p_tree_depth);
7267 el = path_leaf_el(path);
7272 (unsigned long long)path_leaf_bh(path)->b_blocknr);
7292 &et, path, &dealloc);
7298 ocfs2_reinit_path(path, 1);
7349 ocfs2_reinit_path(path, 1);
7365 ocfs2_free_path(path);