From 074c80b705faa21f1347383ec6310ea17a00ffc2 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 14 Dec 2022 14:05:11 -0500 Subject: [PATCH] lib, tests, zebra: Remove unused workqueue error function The wq->spec.errorfunc is never used in the code. It's been in the code base since 2005 and I also do not remember ever seeing it being called. No workqueue process function ever returns error. Since it's not used let's just remove it from the code base. Signed-off-by: Donald Sharp --- lib/workqueue.c | 7 ------- lib/workqueue.h | 5 ----- tests/lib/test_heavy_wq.c | 6 ------ zebra/zebra_mpls.c | 1 - zebra/zebra_rib.c | 1 - 5 files changed, 20 deletions(-) diff --git a/lib/workqueue.c b/lib/workqueue.c index c703de90b3..a5338ba78b 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -272,9 +272,6 @@ void work_queue_run(struct thread *thread) /* dont run items which are past their allowed retries */ if (item->ran > wq->spec.max_retries) { - /* run error handler, if any */ - if (wq->spec.errorfunc) - wq->spec.errorfunc(wq, item); work_queue_item_remove(wq, item); continue; } @@ -317,10 +314,6 @@ void work_queue_run(struct thread *thread) case WQ_RETRY_NOW: /* a RETRY_NOW that gets here has exceeded max_tries, same as * ERROR */ - case WQ_ERROR: { - if (wq->spec.errorfunc) - wq->spec.errorfunc(wq, item); - } /* fallthru */ case WQ_SUCCESS: default: { diff --git a/lib/workqueue.h b/lib/workqueue.h index 27fb1383eb..7866032fc0 100644 --- a/lib/workqueue.h +++ b/lib/workqueue.h @@ -41,7 +41,6 @@ DECLARE_MTYPE(WORK_QUEUE); /* action value, for use by item processor and item error handlers */ typedef enum { WQ_SUCCESS = 0, - WQ_ERROR, /* Error, run error handler if provided */ WQ_RETRY_NOW, /* retry immediately */ WQ_RETRY_LATER, /* retry later, cease processing work queue */ WQ_REQUEUE, /* requeue item, continue processing work queue */ @@ -80,10 +79,6 @@ struct work_queue { */ wq_item_status (*workfunc)(struct work_queue *, void *); - /* error handling function, optional */ - void (*errorfunc)(struct work_queue *, - struct work_queue_item *); - /* callback to delete user specific item data */ void (*del_item_data)(struct work_queue *, void *); diff --git a/tests/lib/test_heavy_wq.c b/tests/lib/test_heavy_wq.c index 00aa7b80dd..be47ef4bbc 100644 --- a/tests/lib/test_heavy_wq.c +++ b/tests/lib/test_heavy_wq.c @@ -70,11 +70,6 @@ static void heavy_wq_add(struct vty *vty, const char *str, int i) return; } -static void slow_func_err(struct work_queue *wq, struct work_queue_item *item) -{ - printf("%s: running error function\n", __func__); -} - static void slow_func_del(struct work_queue *wq, void *data) { struct heavy_wq_node *hn = data; @@ -143,7 +138,6 @@ static int heavy_wq_init(void) heavy_wq = work_queue_new(master, "heavy_work_queue"); heavy_wq->spec.workfunc = &slow_func; - heavy_wq->spec.errorfunc = &slow_func_err; heavy_wq->spec.del_item_data = &slow_func_del; heavy_wq->spec.max_retries = 3; heavy_wq->spec.hold = 1000; diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 9756d9ba08..fe3f77f3c7 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -1754,7 +1754,6 @@ static void mpls_processq_init(void) zrouter.lsp_process_q->spec.workfunc = &lsp_process; zrouter.lsp_process_q->spec.del_item_data = &lsp_processq_del; - zrouter.lsp_process_q->spec.errorfunc = NULL; zrouter.lsp_process_q->spec.completion_func = &lsp_processq_complete; zrouter.lsp_process_q->spec.max_retries = 0; zrouter.lsp_process_q->spec.hold = 10; diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index b86780276b..fda21b2016 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -3743,7 +3743,6 @@ static void rib_queue_init(void) /* fill in the work queue spec */ zrouter.ribq->spec.workfunc = &meta_queue_process; - zrouter.ribq->spec.errorfunc = NULL; zrouter.ribq->spec.completion_func = NULL; /* XXX: TODO: These should be runtime configurable via vty */ zrouter.ribq->spec.max_retries = 3; -- 2.39.5