/* simple bin_search frontend that does the right thing for leaves vs nodes  */
static int bin_search(struct extent_buffer *eb, struct btrfs_key *key, int level, int *slot)
/* simple bin_search frontend that does the right thing for leaves vs nodes  */
static int bin_search(struct extent_buffer *eb, struct btrfs_key *key, int level, int *slot)
{
	if (level == 0) {
		return generic_bin_search(eb,
					  offsetof(struct btrfs_leaf, items),
					  sizeof(struct btrfs_item),
					  key, btrfs_header_nritems(eb),
					  slot);
	} else {
		return generic_bin_search(eb,
					  offsetof(struct btrfs_node, ptrs),
					  sizeof(struct btrfs_key_ptr),
					  key, btrfs_header_nritems(eb),
					  slot);
	}
	return -1;
}