Exemplo n.º 1
0
static int it_test_find(struct interval_node *root)
{
        int idx;
        struct interval_node_extent *ext;

        dprintf("\ninterval_find testing start ..\n");
        for (idx = 0; idx < it_count; idx++) {
                if (it_array[idx].valid == 0)
                        continue;

                ext = &it_array[idx].node.in_extent;
                dprintf("Try to find "__S"\n", __F(ext));
                if (!interval_find(root, ext))
                        error("interval_find, try to find "__S"\n", __F(ext));
        }
        return 0;
}
Exemplo n.º 2
0
/*
 * find the exact range
 *
 * \param	start_nid		starting nid
 * \param	end_nid			ending nid
 * \retval	matching range or NULL
 */
struct lu_nid_range *range_find(lnet_nid_t start_nid, lnet_nid_t end_nid)
{
	struct lu_nid_range		*range = NULL;
	struct interval_node		*interval = NULL;
	struct interval_node_extent	ext = {
		.start	= start_nid,
		.end	= end_nid
	};

	interval = interval_find(range_interval_root, &ext);

	if (interval != NULL)
		range = container_of(interval, struct lu_nid_range,
				     rn_node);

	return range;
}
Exemplo n.º 3
0
/**
 * Locate some free space in a buffer.
 *
 * buffer: Buffer to search.
 * size: Size of free space to find.
 *
 * Returns: Offset to space or -1 if not enough space found.
 **/
ssize_t
ebuf_locate_free_space(ebuf_t *buffer, size_t size)
{
	return interval_find(&buffer->free, size);
}