Beispiel #1
0
/* Prepare the object list that belongs to this node */
static void prepare_object_list(struct work *work)
{
	struct recovery_work *rw = container_of(work, struct recovery_work,
						work);
	uint8_t *buf = NULL;
	size_t buf_size = SD_DATA_OBJ_SIZE; /* FIXME */
	struct sd_node *cur = rw->cur_vinfo->nodes;
	int cur_nr = rw->cur_vinfo->nr_nodes;
	int start = random() % cur_nr, i, end = cur_nr;

	dprintf("%u\n", rw->epoch);

	wait_get_vdis_done();

	buf = xmalloc(buf_size);
again:
	/* We need to start at random node for better load balance */
	for (i = start; i < end; i++) {
		int buf_nr;
		struct sd_node *node = cur + i;

		if (next_rw) {
			dprintf("go to the next recovery\n");
			goto out;
		}
		if (newly_joined(node, rw))
			/* new node doesn't have a list file */
			continue;

		buf_nr = fetch_object_list(node, rw->epoch, buf, buf_size);
		if (buf_nr < 0)
			continue;
		screen_object_list(rw, (uint64_t *)buf, buf_nr);
	}

	if (start != 0) {
		end = start;
		start = 0;
		goto again;
	}

	dprintf("%d\n", rw->count);
out:
	free(buf);
}
Beispiel #2
0
/* Prepare the object list that belongs to this node */
static void prepare_object_list(struct work *work)
{
	struct recovery_work *rw = container_of(work, struct recovery_work,
						work);
	struct sd_node *cur = rw->cur_vinfo->nodes;
	int cur_nr = rw->cur_vinfo->nr_nodes;
	int start = random() % cur_nr, i, end = cur_nr;
	uint64_t *oids;

	sd_dprintf("%u", rw->epoch);
	wait_get_vdis_done();
again:
	/* We need to start at random node for better load balance */
	for (i = start; i < end; i++) {
		size_t nr_oids;
		struct sd_node *node = cur + i;

		if (next_rw) {
			sd_dprintf("go to the next recovery");
			return;
		}
		if (newly_joined(node, rw))
			/* new node doesn't have a list file */
			continue;

		oids = fetch_object_list(node, rw->epoch, &nr_oids);
		if (!oids)
			continue;
		screen_object_list(rw, oids, nr_oids);
		free(oids);
	}

	if (start != 0) {
		end = start;
		start = 0;
		goto again;
	}

	sd_dprintf("%d", rw->count);
}