mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 06:53:03 +00:00
2005-04-27 Paul Jakma <paul.jakma@sun.com>
* workqueue.h: (struct work_queue_item) change retry_count to ran, its a count of number item has been run. * workqueue.c: (show_work_queues) Fix formating of slightly bugfix: fix SIGFPE if wq->runs is 0. (work_queue_run) retry logic was slightly wrong. cycles.best is 0 initialy, granularity is 1, so update best if cycles >= granularity, not just >.
This commit is contained in:
parent
07334da01c
commit
843696841b
@ -1,3 +1,13 @@
|
|||||||
|
2005-04-27 Paul Jakma <paul.jakma@sun.com>
|
||||||
|
|
||||||
|
* workqueue.h: (struct work_queue_item) change retry_count to ran,
|
||||||
|
its a count of number item has been run.
|
||||||
|
* workqueue.c: (show_work_queues) Fix formating of slightly
|
||||||
|
bugfix: fix SIGFPE if wq->runs is 0.
|
||||||
|
(work_queue_run) retry logic was slightly wrong.
|
||||||
|
cycles.best is 0 initialy, granularity is 1, so update best
|
||||||
|
if cycles >= granularity, not just >.
|
||||||
|
|
||||||
2005-04-26 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
2005-04-26 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
* buffer.c (buffer_write): Comment out call to buffer_flush_available.
|
* buffer.c (buffer_write): Comment out call to buffer_flush_available.
|
||||||
|
@ -163,7 +163,7 @@ DEFUN(show_work_queues,
|
|||||||
|
|
||||||
vty_out (vty,
|
vty_out (vty,
|
||||||
"%8s %11s %8s %21s%s",
|
"%8s %11s %8s %21s%s",
|
||||||
"List","(ms) ","Q. Runs","Cycle Counts ",
|
"List","(ms) ","Q. Runs","Cycle Counts ",
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
vty_out (vty,
|
vty_out (vty,
|
||||||
"%8s %5s %5s %8s %7s %6s %6s %s%s",
|
"%8s %5s %5s %8s %7s %6s %6s %s%s",
|
||||||
@ -176,12 +176,13 @@ DEFUN(show_work_queues,
|
|||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO ((&work_queues), node, wq))
|
for (ALL_LIST_ELEMENTS_RO ((&work_queues), node, wq))
|
||||||
{
|
{
|
||||||
vty_out (vty,"%8d %5d %5d %8ld %7d %6d %6u %s%s",
|
vty_out (vty,"%8d %5d %5d %8ld %7d %6d %6u %s%s",
|
||||||
listcount (wq->items),
|
listcount (wq->items),
|
||||||
wq->spec.delay, wq->spec.hold,
|
wq->spec.delay, wq->spec.hold,
|
||||||
wq->runs,
|
wq->runs,
|
||||||
wq->cycles.best, wq->cycles.granularity,
|
wq->cycles.best, wq->cycles.granularity,
|
||||||
(unsigned int)(wq->cycles.total / wq->runs),
|
(wq->runs) ?
|
||||||
|
(unsigned int) (wq->cycles.total / wq->runs) : 0,
|
||||||
wq->name,
|
wq->name,
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
}
|
}
|
||||||
@ -232,7 +233,7 @@ work_queue_run (struct thread *thread)
|
|||||||
assert (item && item->data);
|
assert (item && item->data);
|
||||||
|
|
||||||
/* dont run items which are past their allowed retries */
|
/* dont run items which are past their allowed retries */
|
||||||
if (item->retry_count >= wq->spec.max_retries)
|
if (item->ran > wq->spec.max_retries)
|
||||||
{
|
{
|
||||||
/* run error handler, if any */
|
/* run error handler, if any */
|
||||||
if (wq->spec.errorfunc)
|
if (wq->spec.errorfunc)
|
||||||
@ -245,21 +246,19 @@ work_queue_run (struct thread *thread)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = wq->spec.workfunc (item->data);
|
ret = wq->spec.workfunc (item->data);
|
||||||
item->retry_count++;
|
item->ran++;
|
||||||
}
|
}
|
||||||
while ((ret == WQ_RETRY_NOW)
|
while ((ret == WQ_RETRY_NOW)
|
||||||
&& (item->retry_count < wq->spec.max_retries));
|
&& (item->ran < wq->spec.max_retries));
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case WQ_RETRY_LATER:
|
case WQ_RETRY_LATER:
|
||||||
{
|
{
|
||||||
item->retry_count++;
|
|
||||||
goto stats;
|
goto stats;
|
||||||
}
|
}
|
||||||
case WQ_REQUEUE:
|
case WQ_REQUEUE:
|
||||||
{
|
{
|
||||||
item->retry_count++;
|
|
||||||
work_queue_item_requeue (wq, node);
|
work_queue_item_requeue (wq, node);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -301,7 +300,7 @@ stats:
|
|||||||
: WORK_QUEUE_MIN_GRANULARITY);
|
: WORK_QUEUE_MIN_GRANULARITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cycles > (wq->cycles.granularity))
|
if (cycles >= (wq->cycles.granularity))
|
||||||
{
|
{
|
||||||
if (cycles > wq->cycles.best)
|
if (cycles > wq->cycles.best)
|
||||||
wq->cycles.best = cycles;
|
wq->cycles.best = cycles;
|
||||||
|
@ -42,7 +42,7 @@ typedef enum
|
|||||||
struct work_queue_item
|
struct work_queue_item
|
||||||
{
|
{
|
||||||
void *data; /* opaque data */
|
void *data; /* opaque data */
|
||||||
unsigned short retry_count; /* number of times retried */
|
unsigned short ran; /* # of times item has been run */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct work_queue
|
struct work_queue
|
||||||
@ -54,13 +54,13 @@ struct work_queue
|
|||||||
/* specification for this work queue */
|
/* specification for this work queue */
|
||||||
struct {
|
struct {
|
||||||
/* work function to process items with */
|
/* work function to process items with */
|
||||||
wq_item_status (*workfunc) (void *);
|
wq_item_status (*workfunc) ();
|
||||||
|
|
||||||
/* error handling function, optional */
|
/* error handling function, optional */
|
||||||
void (*errorfunc) (struct work_queue *, struct work_queue_item *);
|
void (*errorfunc) (struct work_queue *, struct work_queue_item *);
|
||||||
|
|
||||||
/* callback to delete user specific item data */
|
/* callback to delete user specific item data */
|
||||||
void (*del_item_data) (void *);
|
void (*del_item_data) ();
|
||||||
|
|
||||||
/* max number of retries to make for item that errors */
|
/* max number of retries to make for item that errors */
|
||||||
unsigned int max_retries;
|
unsigned int max_retries;
|
||||||
|
Loading…
Reference in New Issue
Block a user