@@ -42,7 +42,7 @@ typedef enum { DEFRAG_NOT_DONE = 0,
4242 * - DEFRAG_DONE if the stage is complete
4343 * - DEFRAG_NOT_DONE if there is more work to do
4444 */
45- typedef doneStatus (* defragStageFn )(monotime endtime , void * ctx );
45+ typedef doneStatus (* defragStageFn )(void * ctx , monotime endtime );
4646
4747/* Function pointer type for freeing context in defragmentation stages. */
4848typedef void (* defragStageContextFreeFn )(void * ctx );
@@ -97,7 +97,7 @@ typedef struct {
9797 * - DEFRAG_DONE if the pre-continue work is complete
9898 * - DEFRAG_NOT_DONE if there is more work to do
9999 */
100- typedef doneStatus (* kvstoreHelperPreContinueFn )(monotime endtime , void * ctx );
100+ typedef doneStatus (* kvstoreHelperPreContinueFn )(void * ctx , monotime endtime );
101101
102102typedef struct {
103103 kvstoreIterState kvstate ;
@@ -1017,7 +1017,7 @@ static int defragIsRunning(void) {
10171017}
10181018
10191019/* A kvstoreHelperPreContinueFn */
1020- static doneStatus defragLaterStep (monotime endtime , void * ctx ) {
1020+ static doneStatus defragLaterStep (void * ctx , monotime endtime ) {
10211021 defragKeysCtx * defrag_keys_ctx = ctx ;
10221022
10231023 unsigned int iterations = 0 ;
@@ -1132,7 +1132,7 @@ static doneStatus defragStageKvstoreHelper(monotime endtime,
11321132 }
11331133
11341134 if (precontinue_fn ) {
1135- if (precontinue_fn (endtime , ctx ) == DEFRAG_NOT_DONE ) return DEFRAG_NOT_DONE ;
1135+ if (precontinue_fn (ctx , endtime ) == DEFRAG_NOT_DONE ) return DEFRAG_NOT_DONE ;
11361136 }
11371137
11381138 if (!state -> cursor ) {
@@ -1154,7 +1154,7 @@ static doneStatus defragStageKvstoreHelper(monotime endtime,
11541154 return DEFRAG_NOT_DONE ;
11551155}
11561156
1157- static doneStatus defragStageDbKeys (monotime endtime , void * ctx ) {
1157+ static doneStatus defragStageDbKeys (void * ctx , monotime endtime ) {
11581158 defragKeysCtx * defrag_keys_ctx = ctx ;
11591159 redisDb * db = & server .db [defrag_keys_ctx -> dbid ];
11601160 if (db -> keys != defrag_keys_ctx -> kvstate .kvs ) {
@@ -1174,7 +1174,7 @@ static doneStatus defragStageDbKeys(monotime endtime, void *ctx) {
11741174 dbKeysScanCallback , defragLaterStep , & defragfns );
11751175}
11761176
1177- static doneStatus defragStageExpiresKvstore (monotime endtime , void * ctx ) {
1177+ static doneStatus defragStageExpiresKvstore (void * ctx , monotime endtime ) {
11781178 defragKeysCtx * defrag_keys_ctx = ctx ;
11791179 redisDb * db = & server .db [defrag_keys_ctx -> dbid ];
11801180 if (db -> keys != defrag_keys_ctx -> kvstate .kvs ) {
@@ -1191,7 +1191,7 @@ static doneStatus defragStageExpiresKvstore(monotime endtime, void *ctx) {
11911191 scanCallbackCountScanned , NULL , & defragfns );
11921192}
11931193
1194- static doneStatus defragStagePubsubKvstore (monotime endtime , void * ctx ) {
1194+ static doneStatus defragStagePubsubKvstore (void * ctx , monotime endtime ) {
11951195 static dictDefragFunctions defragfns = {
11961196 .defragAlloc = activeDefragAlloc ,
11971197 .defragKey = NULL , /* Handled by defragPubsubScanCallback */
@@ -1202,14 +1202,14 @@ static doneStatus defragStagePubsubKvstore(monotime endtime, void *ctx) {
12021202 defragPubsubScanCallback , NULL , & defragfns );
12031203}
12041204
1205- static doneStatus defragLuaScripts (monotime endtime , void * ctx ) {
1205+ static doneStatus defragLuaScripts (void * ctx , monotime endtime ) {
12061206 UNUSED (endtime );
12071207 UNUSED (ctx );
12081208 activeDefragSdsDict (evalScriptsDict (), DEFRAG_SDS_DICT_VAL_LUA_SCRIPT );
12091209 return DEFRAG_DONE ;
12101210}
12111211
1212- static doneStatus defragModuleGlobals (monotime endtime , void * ctx ) {
1212+ static doneStatus defragModuleGlobals (void * ctx , monotime endtime ) {
12131213 UNUSED (endtime );
12141214 UNUSED (ctx );
12151215 moduleDefragGlobals ();
@@ -1418,7 +1418,7 @@ static int activeDefragTimeProc(struct aeEventLoop *eventLoop, long long id, voi
14181418 }
14191419
14201420 StageDescriptor * stage = listNodeValue (defrag .current_stage );
1421- doneStatus status = stage -> stage_fn (endtime , stage -> ctx );
1421+ doneStatus status = stage -> stage_fn (stage -> ctx , endtime );
14221422 if (status == DEFRAG_DONE ) {
14231423 listDelNode (defrag .remaining_stages , defrag .current_stage );
14241424 defrag .current_stage = NULL ;
0 commit comments