From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v8 1/2] Rewrite aio-stress test using LTP API
Date: Mon, 24 Oct 2022 16:42:22 +0200 [thread overview]
Message-ID: <Y1akTna0bMncF3td@yuki> (raw)
In-Reply-To: <20221013082146.14581-3-andrea.cervesato@suse.com>
Hi!
> event_io = t->free_ious;
> t->free_ious = t->free_ious->next;
> if (grab_iou(event_io, oper)) {
> - fprintf(stderr, "io unit on free list but not free\n");
> + tst_res(TINFO, "io unit on free list but not free");
> abort();
tst_brk(TBROK, ...) ?
> }
> return event_io;
> @@ -533,7 +523,8 @@ retry:
> if (nr > 0)
> goto retry;
> else
> - fprintf(stderr, "no free ious after read_some_events\n");
> + tst_res(TINFO, "no free ious after read_some_events");
> +
> return NULL;
> }
...
> /* starts some io for a given file, returns zero if all went well */
> -int run_built(struct thread_info *t, int num_ios, struct iocb **my_iocbs)
> +static int run_built(struct thread_info *t, int num_ios, struct iocb **my_iocbs)
> {
> int ret;
> struct timeval start_time;
> @@ -778,17 +757,17 @@ resubmit:
> */
> if (ret > 0 || ret == -EAGAIN) {
> int old_ret = ret;
> - if ((ret = read_some_events(t) > 0)) {
> +
> + ret = read_some_events(t);
> + if (ret > 0) {
> goto resubmit;
> } else {
> - fprintf(stderr, "ret was %d and now is %d\n",
> - ret, old_ret);
> + tst_res(TINFO, "ret was %d and now is %d", ret, old_ret);
> abort();
> }
> }
>
> - fprintf(stderr, "ret %d (%s) on io_submit\n", ret,
> - strerror(-ret));
> + tst_res(TINFO, "ret %d (%s) on io_submit", ret, tst_strerrno(-ret));
> return -1;
> }
> update_iou_counters(my_iocbs, ret, &stop_time);
> @@ -803,21 +782,18 @@ resubmit:
> static int restart_oper(struct io_oper *oper)
> {
> int new_rw = 0;
> +
> if (oper->last_err)
> return 0;
>
> - /* this switch falls through */
> - switch (oper->rw) {
> - case WRITE:
> - if (stages & (1 << READ))
> - new_rw = READ;
> - case READ:
> - if (!new_rw && stages & (1 << RWRITE))
> - new_rw = RWRITE;
> - case RWRITE:
> - if (!new_rw && stages & (1 << RREAD))
> - new_rw = RREAD;
> - }
> + if (oper->rw == WRITE && (stages & (1 << READ)))
> + new_rw = READ;
> +
> + if (oper->rw == READ && (!new_rw && stages & (1 << RWRITE)))
> + new_rw = RWRITE;
> +
> + if (oper->rw == RWRITE && (!new_rw && stages & (1 << RREAD)))
> + new_rw = RREAD;
Maybe this part would be a bit better with goto as:
if (oper->rv == WRITE && (staves & (1 << READ))) {
new_rw = READ;
goto restart;
}
if (oper->rv == READ && (stages & (1 << RWRITE))) {
new_rw = RWRITE;
goto restart;
}
...
restart:
> if (new_rw) {
> oper->started_ios = 0;
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-10-24 14:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 8:21 [LTP] [PATCH v8 0/2] Rewrite aio-stress test Andrea Cervesato via ltp
2022-10-13 8:21 ` [LTP] [PATCH v8] Refactor aiocp using new LTP API Andrea Cervesato via ltp
2022-10-24 7:27 ` Richard Palethorpe
2022-10-13 8:21 ` [LTP] [PATCH v8 1/2] Rewrite aio-stress test using " Andrea Cervesato via ltp
2022-10-13 22:56 ` Petr Vorel
2022-10-24 14:42 ` Cyril Hrubis [this message]
2022-10-13 8:21 ` [LTP] [PATCH v8 2/2] Merge ltp-aio-stress part2 with part1 Andrea Cervesato via ltp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y1akTna0bMncF3td@yuki \
--to=chrubis@suse.cz \
--cc=andrea.cervesato@suse.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox