From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] Refactoring aio-stress.c using LTP API
Date: Mon, 3 Jan 2022 13:00:43 +0100 [thread overview]
Message-ID: <YdLla2Noq5SZzW/L@pevik> (raw)
In-Reply-To: <20211221150918.3987-1-andrea.cervesato@suse.com>
Hi Andrea,
quite big changeset, but it probably could not be separated into more commits as
runtest file changes are related to LTP API change.
Good work, LGTM.
This is worth to be fixed:
> + ret = pthread_join(t[i].tid, &retval);
> + if (ret)
> + tst_brk(TBROK, "pthread_join: %s", tst_strerrno(ret));
> +
> + ret = ((int *) retval);
ret = *((int *) retval);
Both compiler and make check warns about it:
aio-stress.c:1252:21: warning: assignment to ‘int’ from ‘int *’ makes integer from pointer without a cast [-Wint-conversion]
make check-aio-stress
CHECK testcases/kernel/io/ltp-aiodio/aio-stress.c
aio-stress.c:1252:21: warning: incorrect type in assignment (different base types)
aio-stress.c:1252:21: expected int [assigned] ret
aio-stress.c:1252:21: got int *
It'd be great if you could fix at least some of other compiler warnings:
aio-stress.c: In function ‘check_finished_io’:
aio-stress.c:338:13: warning: unused variable ‘length’ [-Wunused-variable]
338 | int length;
| ^~~~~~
aio-stress.c: In function ‘create_oper’:
aio-stress.c:690:63: warning: unused parameter ‘iter’ [-Wunused-parameter]
690 | int reclen, int depth, int iter,
| ~~~~^~~~
aio-stress.c: In function ‘oper_runnable’:
aio-stress.c:848:13: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
848 | int ret;
| ^~~
aio-stress.c: In function ‘setup_shared_mem’:
aio-stress.c:1013:38: warning: unused parameter ‘max_io_submit’ [-Wunused-parameter]
1013 | int reclen, int max_io_submit)
| ~~~~^~~~~~~~~~~~~
aio-stress.c: In function ‘run_workers’:
aio-stress.c:1242:55: warning: cast between incompatible function types from ‘int (*)(struct thread_info *)’ to ‘void * (*)(void *)’ [-Wcast-function-type]
1242 | ret = pthread_create(&t[i].tid, NULL, (start_routine) worker, t + i);
| ^
aio-stress.c:1252:21: warning: assignment to ‘int’ from ‘int *’ makes integer from pointer without a cast [-Wint-conversion]
1252 | ret = ((int *) retval);
| ^
aio-stress.c: In function ‘setup’:
aio-stress.c:1269:42: warning: integer overflow in expression of type ‘int’ results in ‘-2147483648’ [-Woverflow]
1269 | context_offset = 2 * 1024 * 1024 * 1024;
| ^
aio-stress.c: In function ‘check_finished_io’:
aio-stress.c:372:41: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
372 | asprintf(&msg, "%d:%c:%c ", i, io->buf[i], verify_buf[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aio-stress.c: In function ‘print_lat’:
aio-stress.c:441:17: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
441 | asprintf(&msg, " %.0f < %d", lat->deviations[i], deviations[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aio-stress.c:447:17: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
447 | asprintf(&msg, " < %.0f", lat->total_io - total_counted);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aio-stress.c: In function ‘restart_oper’:
aio-stress.c:817:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
817 | if (stages & (1 << READ))
| ^
aio-stress.c:819:9: note: here
819 | case READ:
| ^~~~
aio-stress.c:820:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
820 | if (!new_rw && stages & (1 << RWRITE))
| ^
aio-stress.c:822:9: note: here
822 | case RWRITE:
| ^~~~
I'd also sort alphabetically getopts and help, but that's just me looking into
unimportant details.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2022-01-03 12:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-21 15:09 [LTP] [PATCH v1] Refactoring aio-stress.c using LTP API Andrea Cervesato via ltp
2022-01-03 12:00 ` Petr Vorel [this message]
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=YdLla2Noq5SZzW/L@pevik \
--to=pvorel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.