1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

ctdb-recoverd/vacuum: move fetch loop back into fetch handler.

With the processing of one element factored out,
it is more natural to have the actual loop inside the
handler function. This also makes the talloc/free
bracked around the loop more obvious.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Michael Adam 2015-06-02 22:17:03 +02:00
parent 4103463ad2
commit 92d1486b87

View File

@ -1070,29 +1070,6 @@ static bool vacuum_fetch_process_one(struct ctdb_db_context *ctdb_db,
return true;
}
/*
process the next element from the vacuum list
*/
static void vacuum_fetch_next(struct vacuum_info *v)
{
while (v->recs->count) {
struct ctdb_rec_data *r;
bool ok;
r = v->r;
ok = vacuum_fetch_process_one(v->ctdb_db, v->rec->ctdb->pnn, r);
if (!ok) {
break;
}
v->r = (struct ctdb_rec_data *)(r->length + (uint8_t *)r);
v->recs->count--;
}
talloc_free(v);
}
/*
destroy a vacuum info structure
@ -1190,7 +1167,21 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
talloc_set_destructor(v, vacuum_info_destructor);
vacuum_fetch_next(v);
while (v->recs->count) {
bool ok;
r = v->r;
ok = vacuum_fetch_process_one(v->ctdb_db, v->rec->ctdb->pnn, r);
if (!ok) {
break;
}
v->r = (struct ctdb_rec_data *)(r->length + (uint8_t *)r);
v->recs->count--;
}
talloc_free(v);
done:
talloc_free(tmp_ctx);