Lines Matching defs:path
566 struct ocfs2_path *path,
569 * Reset the actual path elements so that we can reuse the structure
570 * to build another path. Generally, this involves freeing the buffer
573 void ocfs2_reinit_path(struct ocfs2_path *path, int keep_root)
581 for(i = start; i < path_num_items(path); i++) {
582 node = &path->p_node[i];
591 * keeping the root extent list, then make sure that our path
595 depth = le16_to_cpu(path_root_el(path)->l_tree_depth);
597 path_root_access(path) = NULL;
599 path->p_tree_depth = depth;
602 void ocfs2_free_path(struct ocfs2_path *path)
604 if (path) {
605 ocfs2_reinit_path(path, 0);
606 kfree(path);
637 * Make the *dest path the same as src and re-initialize src path to
663 static inline void ocfs2_path_insert_eb(struct ocfs2_path *path, int index,
676 path->p_node[index].bh = eb_bh;
677 path->p_node[index].el = &eb->h_list;
684 struct ocfs2_path *path;
688 path = kzalloc(sizeof(*path), GFP_NOFS);
689 if (path) {
690 path->p_tree_depth = le16_to_cpu(root_el->l_tree_depth);
692 path_root_bh(path) = root_bh;
693 path_root_el(path) = root_el;
694 path_root_access(path) = access;
697 return path;
700 struct ocfs2_path *ocfs2_new_path_from_path(struct ocfs2_path *path)
702 return ocfs2_new_path(path_root_bh(path), path_root_el(path),
703 path_root_access(path));
721 struct ocfs2_path *path,
724 ocfs2_journal_access_func access = path_root_access(path);
732 return access(handle, ci, path->p_node[idx].bh,
737 * Convenience function to journal all components in a path.
741 struct ocfs2_path *path)
745 if (!path)
748 for(i = 0; i < path_num_items(path); i++) {
749 ret = ocfs2_path_bh_journal_access(handle, ci, path, i);
849 * we'll have to update the path to that leaf.
1095 * Change range of the branches in the right most path according to the leaf
1102 struct ocfs2_path *path = NULL;
1106 path = ocfs2_new_path_from_et(et);
1107 if (!path) {
1112 status = ocfs2_find_path(et->et_ci, path, UINT_MAX);
1118 status = ocfs2_extend_trans(handle, path_num_items(path));
1124 status = ocfs2_journal_access_path(et->et_ci, handle, path);
1130 el = path_leaf_el(path);
1133 ocfs2_adjust_rightmost_records(handle, et, path, rec);
1136 ocfs2_free_path(path);
1744 * the lowest level tree node which contains a path to both leafs. This
1748 * pair of adjacent leaves. It's task is to figure out which path
1787 * Traverse a btree path in search of cpos, starting at root_el.
1790 * case it will return the rightmost path.
1885 * Given an initialized path (that is, it has a valid root extent
1886 * list), this function will traverse the btree in search of the path
1889 * The path traveled is recorded in the path structure.
1897 struct ocfs2_path *path;
1904 ocfs2_path_insert_eb(fp->path, fp->index, bh);
1908 struct ocfs2_path *path, u32 cpos)
1913 data.path = path;
1914 return __ocfs2_find_path(ci, path_root_el(path), cpos,
1934 * Some paths want to call this instead of allocating a path structure
2028 * The path walking code should have never returned a root and
2042 * - When we've moved an extent record from the left path leaf to the right
2043 * path leaf to make room for an empty extent in the left path leaf.
2044 * - When our insert into the right path leaf is at the leftmost edge
2045 * and requires an update of the path immediately to it's left. This
2047 * - When we've adjusted the last extent record in the left path leaf and the
2048 * 1st extent record in the right path leaf during cross extent block merge.
2105 * begin our path to the leaves.
2218 * Given a full path, determine what cpos value would return us a path
2221 * Will return zero if the path passed in is already the leftmost path.
2224 struct ocfs2_path *path, u32 *cpos)
2230 BUG_ON(path->p_tree_depth == 0);
2234 blkno = path_leaf_bh(path)->b_blocknr;
2237 i = path->p_tree_depth - 1;
2239 el = path->p_node[i].el;
2243 * path.
2251 * path specified is already
2283 blkno = path->p_node[i].bh->b_blocknr;
2298 struct ocfs2_path *path)
2301 int credits = (path->p_tree_depth - subtree_depth) * 2 + 1 + op_credits;
2317 * theoretical ranges in the path components above the leaves are
2362 * The path to the rightmost leaf should be passed in.
2364 * The array is assumed to be large enough to hold an entire path (tree depth).
2368 * - The 'right_path' array will contain a path to the leaf block
2372 * *ret_left_path will contain a valid path which can be passed to
2409 * 1) Start with the rightmost path.
2411 * 2) Determine a path to the leaf block directly to the left
2415 * which contains a path to both leaves.
2419 * 5) Find the next subtree by considering the left path to be
2420 * the new right path.
2424 * value to get us the left path - insert_cpos might very well
2447 "(left path cpos %u) results in two identical "
2463 * situation by returning the left path.
2516 * There is no need to re-read the next right path
2518 * path. Optimize by copying values instead.
2538 struct ocfs2_path *path)
2546 ret = ocfs2_journal_access_path(et->et_ci, handle, path);
2553 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
2562 for (i = 0; i < path->p_tree_depth; i++) {
2563 el = path->p_node[i].el;
2570 ocfs2_journal_dirty(handle, path->p_node[i].bh);
2579 struct ocfs2_path *path, int unlink_start)
2586 for(i = unlink_start; i < path_num_items(path); i++) {
2587 bh = path->p_node[i].bh;
2726 * Getting here with an empty extent in the right path implies
2727 * that it's the rightmost path and will be deleted.
2758 * after removal of the right path in which case we
2792 * above so we could delete the right path
2810 * Given a full path, determine what cpos value would return us a path
2813 * Will return zero if the path passed in is already the rightmost path.
2819 struct ocfs2_path *path, u32 *cpos)
2827 if (path->p_tree_depth == 0)
2830 blkno = path_leaf_bh(path)->b_blocknr;
2833 i = path->p_tree_depth - 1;
2837 el = path->p_node[i].el;
2841 * path.
2850 * path specified is already
2879 blkno = path->p_node[i].bh->b_blocknr;
2889 struct ocfs2_path *path)
2892 struct buffer_head *bh = path_leaf_bh(path);
2893 struct ocfs2_extent_list *el = path_leaf_el(path);
2898 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, path,
2899 path_num_items(path) - 1);
2915 struct ocfs2_path *path,
2925 if (!ocfs2_is_empty_extent(&(path_leaf_el(path)->l_recs[0])))
2930 ret = ocfs2_find_cpos_for_right_leaf(sb, path, &right_cpos);
2936 left_path = ocfs2_new_path_from_path(path);
2943 ocfs2_cp_path(left_path, path);
2945 right_path = ocfs2_new_path_from_path(path);
3031 struct ocfs2_path *path,
3044 ret = ocfs2_journal_access_path(et->et_ci, handle, path);
3051 path, &cpos);
3059 * We have a path to the left of this one - it needs
3062 left_path = ocfs2_new_path_from_path(path);
3081 subtree_index = ocfs2_find_subtree_root(et, left_path, path);
3083 ocfs2_unlink_subtree(handle, et, left_path, path,
3095 * 'path' is also the leftmost path which
3101 ocfs2_unlink_path(handle, et, dealloc, path, 1);
3111 ocfs2_journal_dirty(handle, path_root_bh(path));
3120 struct ocfs2_path *path,
3125 int credits = path->p_tree_depth * 2 + 1;
3134 ret = ocfs2_remove_rightmost_path(handle, et, path, dealloc);
3146 * rotation. We start at some non-rightmost path containing an empty
3148 * path by rotating records to the left in every subtree.
3154 * This won't handle a length update of the rightmost path records if
3160 struct ocfs2_path *path,
3168 el = path_leaf_el(path);
3172 if (path->p_tree_depth == 0) {
3178 ret = ocfs2_rotate_rightmost_leaf_left(handle, et, path);
3197 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
3202 * rightmost path. Get the other cases out of the way
3217 * XXX: The caller can not trust "path" any more after
3225 ret = ocfs2_remove_rightmost_path(handle, et, path,
3233 * Now we can loop, remembering the path we get from -EAGAIN
3237 ret = __ocfs2_rotate_tree_left(handle, et, orig_credits, path,
3519 * the right path to indicate the new rightmost path.
3654 * So we use the new rightmost path.
3669 struct ocfs2_path *path,
3676 struct ocfs2_extent_list *el = path_leaf_el(path);
3685 path);
3697 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3726 ret = ocfs2_merge_rec_right(path, handle, et, split_rec,
3741 path);
3748 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3760 ret = ocfs2_merge_rec_left(path, handle, et, rec,
3771 path);
3777 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3794 ret = ocfs2_merge_rec_left(path, handle, et,
3802 ret = ocfs2_merge_rec_right(path, handle,
3815 path);
3826 ret = ocfs2_rotate_tree_left(handle, et, path,
3964 struct ocfs2_path *path,
3975 for (i = 0; i < path->p_tree_depth; i++) {
3976 bh = path->p_node[i].bh;
3977 el = path->p_node[i].el;
4020 * neighboring path.
4108 * started in the left path but moved to the
4113 * In this case, the left path should always
4122 * empty extent in the left path, we
4147 * Left path is easy - we can just allow the insert to
4166 * right_path is the path we want to do the actual insert
4284 * Determine the path to start with. Rotations need the
4285 * rightmost path, everything else can go directly to the
4305 * Both might pass back a path immediate to the left of the
4364 struct ocfs2_path *path,
4381 } else if (path->p_tree_depth > 0) {
4382 status = ocfs2_find_cpos_for_left_leaf(sb, path, &left_cpos);
4387 left_path = ocfs2_new_path_from_path(path);
4434 path->p_tree_depth > 0) {
4435 status = ocfs2_find_cpos_for_right_leaf(sb, path, &right_cpos);
4442 right_path = ocfs2_new_path_from_path(path);
4593 struct ocfs2_path *path = NULL;
4636 path = ocfs2_new_path_from_et(et);
4637 if (!path) {
4646 * us the rightmost tree path. This is accounted for below in
4649 ret = ocfs2_find_path(et->et_ci, path, le32_to_cpu(insert_rec->e_cpos));
4655 el = path_leaf_el(path);
4658 * Now that we have the path, there's two things we want to determine:
4671 * cluster count on the last record of the path directly to it's
4682 * whether the path doesn't exist. This will only happen in
4687 path_leaf_bh(path)->b_blocknr) {
4690 * tree path. This might be an appending insert. There are
4700 ocfs2_free_path(path);
4918 struct ocfs2_path *path,
4938 rec = path_leaf_el(path)->l_recs[split_index];
5002 ocfs2_reinit_path(path, 1);
5005 ret = ocfs2_find_path(et->et_ci, path, cpos);
5011 el = path_leaf_el(path);
5030 struct ocfs2_path *path,
5037 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, path,
5038 path_num_items(path) - 1);
5046 ocfs2_journal_dirty(handle, path_leaf_bh(path));
5053 * pointed to by path. Merge with the contiguous extent record if needed.
5072 struct ocfs2_path *path,
5079 struct ocfs2_extent_list *el = path_leaf_el(path);
5092 ret = ocfs2_figure_merge_contig_type(et, path, el,
5106 if (path->p_tree_depth) {
5130 ret = ocfs2_replace_extent_rec(handle, et, path, el,
5133 ret = ocfs2_split_and_insert(handle, et, path,
5139 ret = ocfs2_try_to_merge_extent(handle, et, path,
5287 struct ocfs2_path *path,
5302 el = path_leaf_el(path);
5307 depth = path->p_tree_depth;
5320 rightmost_el = path_leaf_el(path);
5322 credits = path->p_tree_depth +
5357 struct ocfs2_path *path, int index,
5366 struct ocfs2_extent_list *el = path_leaf_el(path);
5374 path);
5380 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
5390 path->p_tree_depth) {
5397 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
5403 if (index == 0 && path->p_tree_depth &&
5407 * record truncate) of an interior (or rightmost) path
5418 ret = ocfs2_find_cpos_for_left_leaf(sb, path, &left_cpos);
5425 left_path = ocfs2_new_path_from_path(path);
5443 path);
5449 ret = ocfs2_journal_access_path(et->et_ci, handle, path);
5473 * We skip the edge update if this path will
5477 ocfs2_adjust_rightmost_records(handle, et, path,
5489 ocfs2_adjust_rightmost_records(handle, et, path, rec);
5503 subtree_index = ocfs2_find_subtree_root(et, left_path, path);
5504 ocfs2_complete_edge_insert(handle, left_path, path,
5508 ocfs2_journal_dirty(handle, path_leaf_bh(path));
5510 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
5529 struct ocfs2_path *path = NULL;
5537 path = ocfs2_new_path_from_et(et);
5538 if (!path) {
5544 ret = ocfs2_find_path(et->et_ci, path, cpos);
5550 el = path_leaf_el(path);
5589 ret = ocfs2_truncate_rec(handle, et, path, index, dealloc,
5596 ret = ocfs2_split_tree(handle, et, path, index,
5607 ocfs2_reinit_path(path, 1);
5609 ret = ocfs2_find_path(et->et_ci, path, cpos);
5615 el = path_leaf_el(path);
5643 ret = ocfs2_truncate_rec(handle, et, path, index, dealloc,
5650 ocfs2_free_path(path);
7240 struct ocfs2_path *path = NULL;
7254 path = ocfs2_new_path(di_bh, &di->id2.i_list,
7256 if (!path) {
7276 status = ocfs2_find_path(INODE_CACHE(inode), path, UINT_MAX);
7286 path->p_tree_depth);
7299 el = path_leaf_el(path);
7304 (unsigned long long)path_leaf_bh(path)->b_blocknr);
7324 &et, path, &dealloc);
7330 ocfs2_reinit_path(path, 1);
7381 ocfs2_reinit_path(path, 1);
7397 ocfs2_free_path(path);