ctree.c (809d6902b3b05fd6b4494ff1460c227b99fcb4c3) ctree.c (0ff40a910f5649dfacc4fb5daa7e73692196342d)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2007,2008 Oracle. All rights reserved.
4 */
5
6#include <linux/sched.h>
7#include <linux/slab.h>
8#include <linux/rbtree.h>

--- 2088 unchanged lines hidden (view full) ---

2097 } else {
2098 --p->slots[0];
2099 }
2100 }
2101 return 0;
2102}
2103
2104/*
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2007,2008 Oracle. All rights reserved.
4 */
5
6#include <linux/sched.h>
7#include <linux/slab.h>
8#include <linux/rbtree.h>

--- 2088 unchanged lines hidden (view full) ---

2097 } else {
2098 --p->slots[0];
2099 }
2100 }
2101 return 0;
2102}
2103
2104/*
2105 * Execute search and call btrfs_previous_item to traverse backwards if the item
2106 * was not found.
2107 *
2108 * Return 0 if found, 1 if not found and < 0 if error.
2109 */
2110int btrfs_search_backwards(struct btrfs_root *root, struct btrfs_key *key,
2111 struct btrfs_path *path)
2112{
2113 int ret;
2114
2115 ret = btrfs_search_slot(NULL, root, key, path, 0, 0);
2116 if (ret > 0)
2117 ret = btrfs_previous_item(root, path, key->objectid, key->type);
2118
2119 if (ret == 0)
2120 btrfs_item_key_to_cpu(path->nodes[0], key, path->slots[0]);
2121
2122 return ret;
2123}
2124
2125/*
2105 * adjust the pointers going up the tree, starting at level
2106 * making sure the right key of each node is points to 'key'.
2107 * This is used after shifting pointers to the left, so it stops
2108 * fixing up pointers when a given leaf/node is not in slot 0 of the
2109 * higher levels
2110 *
2111 */
2112static void fixup_low_keys(struct btrfs_path *path,

--- 2488 unchanged lines hidden ---
2126 * adjust the pointers going up the tree, starting at level
2127 * making sure the right key of each node is points to 'key'.
2128 * This is used after shifting pointers to the left, so it stops
2129 * fixing up pointers when a given leaf/node is not in slot 0 of the
2130 * higher levels
2131 *
2132 */
2133static void fixup_low_keys(struct btrfs_path *path,

--- 2488 unchanged lines hidden ---