[LTP] [PATCH v3 1/1] aio-stress.c: Remove useless iteration variable

Richard Palethorpe rpalethorpe@suse.de
Mon Jan 16 11:53:07 CET 2023


Hello,

I have merged this and my/Petr's aiocp patches.

Petr I'm not sure what motivated some of these changes? Although clearly
the code was incorrect, I don't see the test failures in OpenQA?

Petr Vorel <pvorel@suse.cz> writes:

> local iteration variable in worker() was probably left over from
> previous version before rewrite because clang correctly reported also on
> this old version:
>
>     aio-stress.c:1049:6: warning: variable 'iteration' set but not used [-Wunused-but-set-variable]
>     int iteration = 0;
>
> NOTE: restart label was considered to be removed, but in the end kept.
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Changes v2->v3:
> * Keep restart label (remove only the variable)
>
>  testcases/kernel/io/ltp-aiodio/aio-stress.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/testcases/kernel/io/ltp-aiodio/aio-stress.c b/testcases/kernel/io/ltp-aiodio/aio-stress.c
> index d84d5a0741..5c3a0a3a49 100644
> --- a/testcases/kernel/io/ltp-aiodio/aio-stress.c
> +++ b/testcases/kernel/io/ltp-aiodio/aio-stress.c
> @@ -1039,7 +1039,6 @@ static int *worker(struct thread_info *t)
>  	char *this_stage = NULL;
>  	struct timeval stage_time;
>  	int status = 0;
> -	int iteration = 0;
>  	int cnt;
>  
>  	aio_setup(&t->io_ctx, 512);
> @@ -1116,10 +1115,8 @@ restart:
>  	}
>  
>  	/* someone got restarted, go back to the beginning */
> -	if (t->active_opers && cnt < iterations) {
> -		iteration++;
> +	if (t->active_opers && cnt < iterations)
>  		goto restart;
> -	}
>  
>  	/* finally, free all the ram */
>  	while (t->finished_opers) {


-- 
Thank you,
Richard.


More information about the ltp mailing list