public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Zorro Lang <zlang@redhat.com>
Cc: fstests <fstests@vger.kernel.org>, xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] misc: allow zero duration for fsstress and fsx
Date: Sat, 24 Jan 2026 08:55:11 -0800	[thread overview]
Message-ID: <20260124165511.GU5966@frogsfrogsfrogs> (raw)
In-Reply-To: <20260124054711.3psxdefyfx6z5ps5@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com>

On Sat, Jan 24, 2026 at 01:47:11PM +0800, Zorro Lang wrote:
> On Thu, Jan 22, 2026 at 08:13:51AM -0800, Darrick J. Wong wrote:
> > On Thu, Jan 22, 2026 at 03:21:00PM +0800, Zorro Lang wrote:
> > > On Wed, Jan 21, 2026 at 09:46:01AM -0800, Darrick J. Wong wrote:
> > > > On Wed, Jan 21, 2026 at 11:54:56PM +0800, Zorro Lang wrote:
> > > > > On Tue, Jan 20, 2026 at 05:26:21PM -0800, Darrick J. Wong wrote:
> > > > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > > > 
> > > > > > Occasionally the common/fuzzy fuzz test helpers manage to time
> > > > > > something just right such that fsx or fsstress get invoked with a zero
> > > > > > second duration.  It's harmless to exit immediately without doing
> > > > > > anything, so allow this corner case.
> > > > > 
> > > > > Sure, duration=0 is harmless, I'm good with this patch.
> > > > > 
> > > > > Reviewed-by: Zorro Lang <zlang@redhat.com>
> > > > > 
> > > > > Please excuse my nitpicking. I'm curious about the semantics of "--duration=0".
> > > > > Looking at the output of `fsstress -v --duration=0`, it doesn't actually
> > > > > 'do nothing.' Instead, it behaves similarly to duration=1, where fsstress
> > > > > attempts to execute operations before timing out and exiting :-D
> > > > 
> > > > Yeah, I suppose it's possible to do a very small amount of work.
> > > > 
> > > > Would you mind changing that last sentence to read "It's harmless to
> > > > exit almost immediately having done very little work, so allow this
> > > > corner case." prior to commit?
> > > 
> > > Sure Darick, I can make that change prior to commit :) But I was just
> > > curious to hear your thoughts on:
> > > 
> > >   if (duration == 0) {
> > >           /* No action is taken if duration is 0 */
> > >           exit(0);
> > >   } else if (duration < 0) {
> > >           fprintf(stderr, "%lld: invalid duration\n", duration);
> > > 	  exit(88);
> > >   }
> > > 
> > > do you feel that makes more sense semantically :)
> > 
> > That would also work. Would you rather have the exits-immediately
> > version?  
> 
> If both versions are good to you, I perfer the "exits-immediately" one, at least
> it fits the semantics of 0 better :)
> 
> To save your time I can make this change when I merge it if you agree with that
> too. Let me know if there's anything else you'd like to add.

Your way is fine with me.  I don't think I have anything to add, and if
I do I can always send a patch. :)

--D


> Thanks,
> Zorro
> 
> > 
> > --D
> > 
> > > Thanks,
> > > Zorro
> > > 
> > > > 
> > > > --D
> > > > 
> > > > > Thanks,
> > > > > Zorro
> > > > > 
> > > > > > 
> > > > > > Cc: <fstests@vger.kernel.org> # v2023.05.01
> > > > > > Fixes: 3e85dd4fe4236d ("misc: add duration for long soak tests")
> > > > > > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > > > > > ---
> > > > > >  ltp/fsstress.c |    2 +-
> > > > > >  ltp/fsx.c      |    2 +-
> > > > > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> > > > > > index c17ac440414325..b51bd8ada2a3be 100644
> > > > > > --- a/ltp/fsstress.c
> > > > > > +++ b/ltp/fsstress.c
> > > > > > @@ -645,7 +645,7 @@ int main(int argc, char **argv)
> > > > > >  				exit(87);
> > > > > >  			}
> > > > > >  			duration = strtoll(optarg, NULL, 0);
> > > > > > -			if (duration < 1) {
> > > > > > +			if (duration < 0) {
> > > > > >  				fprintf(stderr, "%lld: invalid duration\n", duration);
> > > > > >  				exit(88);
> > > > > >  			}
> > > > > > diff --git a/ltp/fsx.c b/ltp/fsx.c
> > > > > > index 626976dd4f9f27..4f8a2d5ab1fc08 100644
> > > > > > --- a/ltp/fsx.c
> > > > > > +++ b/ltp/fsx.c
> > > > > > @@ -3375,7 +3375,7 @@ main(int argc, char **argv)
> > > > > >  				exit(87);
> > > > > >  			}
> > > > > >  			duration = strtoll(optarg, NULL, 0);
> > > > > > -			if (duration < 1) {
> > > > > > +			if (duration < 0) {
> > > > > >  				fprintf(stderr, "%lld: invalid duration\n", duration);
> > > > > >  				exit(88);
> > > > > >  			}
> > > > > > 
> > > > > 
> > > > > 
> > > > 
> > > 
> > > 
> > 
> 

      reply	other threads:[~2026-01-24 16:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21  1:26 [PATCH] misc: allow zero duration for fsstress and fsx Darrick J. Wong
2026-01-21  6:45 ` Christoph Hellwig
2026-01-21 15:54 ` Zorro Lang
2026-01-21 17:46   ` Darrick J. Wong
2026-01-22  7:21     ` Zorro Lang
2026-01-22 16:13       ` Darrick J. Wong
2026-01-24  5:47         ` Zorro Lang
2026-01-24 16:55           ` Darrick J. Wong [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=20260124165511.GU5966@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@redhat.com \
    /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