From: Michael Adam Date: Tue, 2 Jun 2015 20:17:03 +0000 (+0200) Subject: ctdb-recoverd/vacuum: move fetch loop back into fetch handler. X-Git-Tag: tevent-0.9.25~198 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=92d1486b87d6e06b957ff63f9033eb0d4fd5a164;p=thirdparty%2Fsamba.git 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 Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index e5a4a401e15..002191f6628 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -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);