Lines Matching defs:path
566 struct ocfs2_path *path,
569 * Reset the actual path elements so that we can re-use 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.
1088 * Change range of the branches in the right most path according to the leaf
1095 struct ocfs2_path *path = NULL;
1099 path = ocfs2_new_path_from_et(et);
1100 if (!path) {
1105 status = ocfs2_find_path(et->et_ci, path, UINT_MAX);
1111 status = ocfs2_extend_trans(handle, path_num_items(path));
1117 status = ocfs2_journal_access_path(et->et_ci, handle, path);
1123 el = path_leaf_el(path);
1126 ocfs2_adjust_rightmost_records(handle, et, path, rec);
1129 ocfs2_free_path(path);
1737 * the lowest level tree node which contains a path to both leafs. This
1741 * pair of adjacent leaves. It's task is to figure out which path
1780 * Traverse a btree path in search of cpos, starting at root_el.
1783 * case it will return the rightmost path.
1870 * Given an initialized path (that is, it has a valid root extent
1871 * list), this function will traverse the btree in search of the path
1874 * The path traveled is recorded in the path structure.
1882 struct ocfs2_path *path;
1889 ocfs2_path_insert_eb(fp->path, fp->index, bh);
1893 struct ocfs2_path *path, u32 cpos)
1898 data.path = path;
1899 return __ocfs2_find_path(ci, path_root_el(path), cpos,
1919 * Some paths want to call this instead of allocating a path structure
2013 * The path walking code should have never returned a root and
2027 * - When we've moved an extent record from the left path leaf to the right
2028 * path leaf to make room for an empty extent in the left path leaf.
2029 * - When our insert into the right path leaf is at the leftmost edge
2030 * and requires an update of the path immediately to it's left. This
2032 * - When we've adjusted the last extent record in the left path leaf and the
2033 * 1st extent record in the right path leaf during cross extent block merge.
2090 * begin our path to the leaves.
2203 * Given a full path, determine what cpos value would return us a path
2206 * Will return zero if the path passed in is already the leftmost path.
2209 struct ocfs2_path *path, u32 *cpos)
2215 BUG_ON(path->p_tree_depth == 0);
2219 blkno = path_leaf_bh(path)->b_blocknr;
2222 i = path->p_tree_depth - 1;
2224 el = path->p_node[i].el;
2228 * path.
2236 * path specified is already
2268 blkno = path->p_node[i].bh->b_blocknr;
2283 struct ocfs2_path *path)
2286 int credits = (path->p_tree_depth - subtree_depth) * 2 + 1 + op_credits;
2302 * theoretical ranges in the path components above the leaves are
2347 * The path to the rightmost leaf should be passed in.
2349 * The array is assumed to be large enough to hold an entire path (tree depth).
2353 * - The 'right_path' array will contain a path to the leaf block
2357 * *ret_left_path will contain a valid path which can be passed to
2394 * 1) Start with the rightmost path.
2396 * 2) Determine a path to the leaf block directly to the left
2400 * which contains a path to both leaves.
2404 * 5) Find the next subtree by considering the left path to be
2405 * the new right path.
2409 * value to get us the left path - insert_cpos might very well
2432 "(left path cpos %u) results in two identical "
2448 * situation by returning the left path.
2501 * There is no need to re-read the next right path
2503 * path. Optimize by copying values instead.
2523 struct ocfs2_path *path)
2531 ret = ocfs2_journal_access_path(et->et_ci, handle, path);
2538 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
2547 for (i = 0; i < path->p_tree_depth; i++) {
2548 el = path->p_node[i].el;
2555 ocfs2_journal_dirty(handle, path->p_node[i].bh);
2564 struct ocfs2_path *path, int unlink_start)
2571 for(i = unlink_start; i < path_num_items(path); i++) {
2572 bh = path->p_node[i].bh;
2711 * Getting here with an empty extent in the right path implies
2712 * that it's the rightmost path and will be deleted.
2743 * after removal of the right path in which case we
2777 * above so we could delete the right path
2795 * Given a full path, determine what cpos value would return us a path
2798 * Will return zero if the path passed in is already the rightmost path.
2804 struct ocfs2_path *path, u32 *cpos)
2812 if (path->p_tree_depth == 0)
2815 blkno = path_leaf_bh(path)->b_blocknr;
2818 i = path->p_tree_depth - 1;
2822 el = path->p_node[i].el;
2826 * path.
2835 * path specified is already
2864 blkno = path->p_node[i].bh->b_blocknr;
2874 struct ocfs2_path *path)
2877 struct buffer_head *bh = path_leaf_bh(path);
2878 struct ocfs2_extent_list *el = path_leaf_el(path);
2883 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, path,
2884 path_num_items(path) - 1);
2900 struct ocfs2_path *path,
2910 if (!ocfs2_is_empty_extent(&(path_leaf_el(path)->l_recs[0])))
2915 ret = ocfs2_find_cpos_for_right_leaf(sb, path, &right_cpos);
2921 left_path = ocfs2_new_path_from_path(path);
2928 ocfs2_cp_path(left_path, path);
2930 right_path = ocfs2_new_path_from_path(path);
3016 struct ocfs2_path *path,
3029 ret = ocfs2_journal_access_path(et->et_ci, handle, path);
3036 path, &cpos);
3044 * We have a path to the left of this one - it needs
3047 left_path = ocfs2_new_path_from_path(path);
3066 subtree_index = ocfs2_find_subtree_root(et, left_path, path);
3068 ocfs2_unlink_subtree(handle, et, left_path, path,
3080 * 'path' is also the leftmost path which
3086 ocfs2_unlink_path(handle, et, dealloc, path, 1);
3096 ocfs2_journal_dirty(handle, path_root_bh(path));
3105 struct ocfs2_path *path,
3110 int credits = path->p_tree_depth * 2 + 1;
3119 ret = ocfs2_remove_rightmost_path(handle, et, path, dealloc);
3131 * rotation. We start at some non-rightmost path containing an empty
3133 * path by rotating records to the left in every subtree.
3139 * This won't handle a length update of the rightmost path records if
3145 struct ocfs2_path *path,
3153 el = path_leaf_el(path);
3157 if (path->p_tree_depth == 0) {
3163 ret = ocfs2_rotate_rightmost_leaf_left(handle, et, path);
3182 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
3187 * rightmost path. Get the other cases out of the way
3202 * XXX: The caller can not trust "path" any more after
3210 ret = ocfs2_remove_rightmost_path(handle, et, path,
3218 * Now we can loop, remembering the path we get from -EAGAIN
3222 ret = __ocfs2_rotate_tree_left(handle, et, orig_credits, path,
3504 * the right path to indicate the new rightmost path.
3639 * So we use the new rightmost path.
3654 struct ocfs2_path *path,
3661 struct ocfs2_extent_list *el = path_leaf_el(path);
3670 path);
3682 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3711 ret = ocfs2_merge_rec_right(path, handle, et, split_rec,
3726 path);
3733 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3745 ret = ocfs2_merge_rec_left(path, handle, et, rec,
3756 path);
3762 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3779 ret = ocfs2_merge_rec_left(path, handle, et,
3787 ret = ocfs2_merge_rec_right(path, handle,
3800 path);
3811 ret = ocfs2_rotate_tree_left(handle, et, path,
3949 struct ocfs2_path *path,
3960 for (i = 0; i < path->p_tree_depth; i++) {
3961 bh = path->p_node[i].bh;
3962 el = path->p_node[i].el;
4005 * neighboring path.
4093 * started in the left path but moved to the
4098 * In this case, the left path should always
4107 * empty extent in the left path, we
4132 * Left path is easy - we can just allow the insert to
4151 * right_path is the path we want to do the actual insert
4269 * Determine the path to start with. Rotations need the
4270 * rightmost path, everything else can go directly to the
4290 * Both might pass back a path immediate to the left of the
4349 struct ocfs2_path *path,
4366 } else if (path->p_tree_depth > 0) {
4367 status = ocfs2_find_cpos_for_left_leaf(sb, path, &left_cpos);
4372 left_path = ocfs2_new_path_from_path(path);
4419 path->p_tree_depth > 0) {
4420 status = ocfs2_find_cpos_for_right_leaf(sb, path, &right_cpos);
4427 right_path = ocfs2_new_path_from_path(path);
4578 struct ocfs2_path *path = NULL;
4621 path = ocfs2_new_path_from_et(et);
4622 if (!path) {
4631 * us the rightmost tree path. This is accounted for below in
4634 ret = ocfs2_find_path(et->et_ci, path, le32_to_cpu(insert_rec->e_cpos));
4640 el = path_leaf_el(path);
4643 * Now that we have the path, there's two things we want to determine:
4656 * cluster count on the last record of the path directly to it's
4667 * whether the path doesn't exist. This will only happen in
4672 path_leaf_bh(path)->b_blocknr) {
4675 * tree path. This might be an appending insert. There are
4685 ocfs2_free_path(path);
4903 struct ocfs2_path *path,
4923 rec = path_leaf_el(path)->l_recs[split_index];
4987 ocfs2_reinit_path(path, 1);
4990 ret = ocfs2_find_path(et->et_ci, path, cpos);
4996 el = path_leaf_el(path);
5015 struct ocfs2_path *path,
5022 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, path,
5023 path_num_items(path) - 1);
5031 ocfs2_journal_dirty(handle, path_leaf_bh(path));
5038 * pointed to by path. Merge with the contiguous extent record if needed.
5057 struct ocfs2_path *path,
5064 struct ocfs2_extent_list *el = path_leaf_el(path);
5077 ret = ocfs2_figure_merge_contig_type(et, path, el,
5091 if (path->p_tree_depth) {
5115 ret = ocfs2_replace_extent_rec(handle, et, path, el,
5118 ret = ocfs2_split_and_insert(handle, et, path,
5124 ret = ocfs2_try_to_merge_extent(handle, et, path,
5272 struct ocfs2_path *path,
5287 el = path_leaf_el(path);
5292 depth = path->p_tree_depth;
5305 rightmost_el = path_leaf_el(path);
5307 credits = path->p_tree_depth +
5342 struct ocfs2_path *path, int index,
5351 struct ocfs2_extent_list *el = path_leaf_el(path);
5359 path);
5365 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
5375 path->p_tree_depth) {
5382 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
5388 if (index == 0 && path->p_tree_depth &&
5392 * record truncate) of an interior (or rightmost) path
5403 ret = ocfs2_find_cpos_for_left_leaf(sb, path, &left_cpos);
5410 left_path = ocfs2_new_path_from_path(path);
5428 path);
5434 ret = ocfs2_journal_access_path(et->et_ci, handle, path);
5458 * We skip the edge update if this path will
5462 ocfs2_adjust_rightmost_records(handle, et, path,
5474 ocfs2_adjust_rightmost_records(handle, et, path, rec);
5488 subtree_index = ocfs2_find_subtree_root(et, left_path, path);
5489 ocfs2_complete_edge_insert(handle, left_path, path,
5493 ocfs2_journal_dirty(handle, path_leaf_bh(path));
5495 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
5514 struct ocfs2_path *path = NULL;
5522 path = ocfs2_new_path_from_et(et);
5523 if (!path) {
5529 ret = ocfs2_find_path(et->et_ci, path, cpos);
5535 el = path_leaf_el(path);
5574 ret = ocfs2_truncate_rec(handle, et, path, index, dealloc,
5581 ret = ocfs2_split_tree(handle, et, path, index,
5592 ocfs2_reinit_path(path, 1);
5594 ret = ocfs2_find_path(et->et_ci, path, cpos);
5600 el = path_leaf_el(path);
5628 ret = ocfs2_truncate_rec(handle, et, path, index, dealloc,
5635 ocfs2_free_path(path);
7213 struct ocfs2_path *path = NULL;
7227 path = ocfs2_new_path(di_bh, &di->id2.i_list,
7229 if (!path) {
7249 status = ocfs2_find_path(INODE_CACHE(inode), path, UINT_MAX);
7259 path->p_tree_depth);
7272 el = path_leaf_el(path);
7277 (unsigned long long)path_leaf_bh(path)->b_blocknr);
7297 &et, path, &dealloc);
7303 ocfs2_reinit_path(path, 1);
7354 ocfs2_reinit_path(path, 1);
7370 ocfs2_free_path(path);