[LTP] [PATCH v2] read_all: retry to queue work for any worker

Li Wang liwang@redhat.com
Sat Oct 12 09:28:02 CEST 2019


On Sat, Oct 12, 2019 at 2:49 PM Jan Stancek <jstancek@redhat.com> wrote:

> ...
> > > > Base on your patch, I'm thinking to achieve a new macro
> TST_INFILOOP_FUNC
> > > > which can repeat the @FUNC infinitely. Do you feel it satisfies your
> > > > requirements to some degree or meaningful to LTP?
> > >
> > > I'm OK with concept. I'd like more some variation of *RETRY* for name.
> > > Comments below.
> > >
> >
> > Thanks, what about naming: TST_INFI_RETRY_FUNC?
>
> Or just keep TST_RETRY_FUNC and add parameter to it?
>

Sounds better, we could add parameter @INFI to control the retry as a knob.

/* @INFI - 1: retry infinitely, 0: retry in limit times */

#define TST_RETRY_FUNC(FUNC, ERET, INFI) \
        TST_RETRY_FN_EXP_BACKOFF(FUNC, ERET, 1, INFI)


> >
> > And do you mind use it to replace your function work_push_retry()? I know
> > it may be not smarter than work_push_retry() but it looks tiny for code.
>
> It may need some wrapper, because work_push_retry() may be passing
> different
> argument to function on each retry, which was one of reasons for the patch.
>

I was not meaning to hack the work_push_retry() function, I mean to change
your patch as below after we improve the TST_RETRY_FUNC.

# git diff .
diff --git a/testcases/kernel/fs/read_all/read_all.c
b/testcases/kernel/fs/read_all/read_all.c
index 3dac20e..ccbc5eb 100644
--- a/testcases/kernel/fs/read_all/read_all.c
+++ b/testcases/kernel/fs/read_all/read_all.c
@@ -292,7 +292,7 @@ static void stop_workers(void)

        for (i = 0; i < worker_count; i++) {
                if (workers[i].q)
-                       TST_RETRY_FUNC(queue_push(workers[i].q, stop_code),
1);
+                       TST_RETRY_FUNC(queue_push(workers[i].q, stop_code),
1, 1);
        }

        for (i = 0; i < worker_count; i++) {
@@ -310,7 +310,7 @@ static void rep_sched_work(const char *path, int rep)
        for (i = j = 0; i < rep; i++, j++) {
                if (j >= worker_count)
                        j = 0;
-               TST_RETRY_FUNC(queue_push(workers[j].q, path), 1);
+               TST_RETRY_FUNC(queue_push(workers[j].q, path), 1, 1);
        }
 }


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20191012/10131c99/attachment-0001.htm>


More information about the ltp mailing list