public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 1/1] aio-stress.c: Remove useless iteration variable
Date: Mon, 09 Jan 2023 14:11:01 +0000	[thread overview]
Message-ID: <87tu0zixhk.fsf@suse.de> (raw)
In-Reply-To: <20221223183325.10814-1-pvorel@suse.cz>

Hello,

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;
>
> Whole restart label was not used.
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Changes v1->v2:
> * remove whole restart label.
>
>  testcases/kernel/io/ltp-aiodio/aio-stress.c | 8 --------
>  1 file changed, 8 deletions(-)
>
> diff --git a/testcases/kernel/io/ltp-aiodio/aio-stress.c b/testcases/kernel/io/ltp-aiodio/aio-stress.c
> index 2fdbb84e87..2946ac1f47 100644
> --- a/testcases/kernel/io/ltp-aiodio/aio-stress.c
> +++ b/testcases/kernel/io/ltp-aiodio/aio-stress.c
> @@ -1039,12 +1039,10 @@ 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);
>  
> -restart:
>  	if (num_threads > 1) {
>  		if (pthread_barrier_wait(&worker_barrier))
>  			gettimeofday(&global_stage_start_time, NULL);
> @@ -1115,12 +1113,6 @@ restart:
>  			global_thread_throughput(t, this_stage);
>  	}
>  
> -	/* someone got restarted, go back to the beginning */
> -	if (t->active_opers && cnt < iterations) {

In this case, shouldn't we remove all the restart code? It seems
active_opers can be added to and cnt could be less than iterations. So
the label could be used.

I think you are safe to remove only the iteration variable.

Personally I would not touch this code except to fix a major issue or
rewrite it altogether.

> -		iteration++;
> -		goto restart;
> -	}
> -
>  	/* finally, free all the ram */
>  	while (t->finished_opers) {
>  		oper = t->finished_opers;
> -- 
> 2.39.0


-- 
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2023-01-09 14:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-23 18:33 [LTP] [PATCH v2 1/1] aio-stress.c: Remove useless iteration variable Petr Vorel
2023-01-09 14:11 ` Richard Palethorpe [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=87tu0zixhk.fsf@suse.de \
    --to=rpalethorpe@suse.de \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /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