/* Reset the actual path elements so that we can re-use the structure to build another path. Generally, this involves freeing the buffer heads.  */
void ocfs2_reinit_path(struct ocfs2_path *path, int keep_root)
/* Reset the actual path elements so that we can re-use the structure to build another path. Generally, this involves freeing the buffer heads.  */
void ocfs2_reinit_path(struct ocfs2_path *path, int keep_root)
{
	int i, start = 0, depth = 0;
	struct ocfs2_path_item *node;
	if (keep_root)
		start = 1;
	for(i = start; i < path_num_items(path); i++) {
		node = &path->p_node[i];
		brelse(node->bh);
		node->bh = NULL;
		node->el = NULL;
	}
	if (keep_root)
		depth = le16_to_cpu(path_root_el(path)->l_tree_depth);
	else
		path_root_access(path) = NULL;
	path->p_tree_depth = depth;
}