All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fio: simplify parse_is_percent()
@ 2021-02-14 19:14 Alexey Dobriyan
  2021-02-15  3:40 ` Dmitry Fomichev
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2021-02-14 19:14 UTC (permalink / raw)
  To: axboe; +Cc: fio

Check like this

	unsigned long long val <= -1ULL

is tautologically true because of how type conversions work.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 parse.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/parse.h
+++ b/parse.h
@@ -131,7 +131,7 @@ static inline void *td_var(void *to, const struct fio_option *o,
 
 static inline int parse_is_percent(unsigned long long val)
 {
-	return val <= -1ULL && val >= (-1ULL - 100ULL);
+	return val >= -101;
 }
 
 #define ZONE_BASE_VAL ((-1ULL >> 1) + 1)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] fio: simplify parse_is_percent()
  2021-02-14 19:14 [PATCH] fio: simplify parse_is_percent() Alexey Dobriyan
@ 2021-02-15  3:40 ` Dmitry Fomichev
  2021-02-19 16:42   ` Alexey Dobriyan
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Fomichev @ 2021-02-15  3:40 UTC (permalink / raw)
  To: Alexey Dobriyan, axboe; +Cc: fio

> -----Original Message-----
> From: Alexey Dobriyan <adobriyan@gmail.com>
> Sent: Sunday, February 14, 2021 2:15 PM
> To: axboe@kernel.dk
> Cc: fio@vger.kernel.org
> Subject: [PATCH] fio: simplify parse_is_percent()

fio: -> parse:?

> 
> Check like this
> 
> 	unsigned long long val <= -1ULL
> 
> is tautologically true because of how type conversions work.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 
>  parse.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/parse.h
> +++ b/parse.h
> @@ -131,7 +131,7 @@ static inline void *td_var(void *to, const struct
> fio_option *o,
> 
>  static inline int parse_is_percent(unsigned long long val)
>  {
> -	return val <= -1ULL && val >= (-1ULL - 100ULL);
> +	return val >= -101;

Nice cleanup, but wouldn't that be better to keep the ULL suffix
for the sake of clarity?

>  }
> 
>  #define ZONE_BASE_VAL ((-1ULL >> 1) + 1)

This patch is based on your earlier patch
"zbd: support 'z' suffix for zone granularity" that is still in review,
why not to combine these two in a series?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fio: simplify parse_is_percent()
  2021-02-15  3:40 ` Dmitry Fomichev
@ 2021-02-19 16:42   ` Alexey Dobriyan
  0 siblings, 0 replies; 3+ messages in thread
From: Alexey Dobriyan @ 2021-02-19 16:42 UTC (permalink / raw)
  To: Dmitry Fomichev; +Cc: axboe, fio

On Mon, Feb 15, 2021 at 03:40:59AM +0000, Dmitry Fomichev wrote:
> > -----Original Message-----
> > From: Alexey Dobriyan <adobriyan@gmail.com>
> > Sent: Sunday, February 14, 2021 2:15 PM
> > To: axboe@kernel.dk
> > Cc: fio@vger.kernel.org
> > Subject: [PATCH] fio: simplify parse_is_percent()
> 
> fio: -> parse:?
> 
> > 
> > Check like this
> > 
> > 	unsigned long long val <= -1ULL
> > 
> > is tautologically true because of how type conversions work.
> > 
> > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> > ---
> > 
> >  parse.h |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > --- a/parse.h
> > +++ b/parse.h
> > @@ -131,7 +131,7 @@ static inline void *td_var(void *to, const struct
> > fio_option *o,
> > 
> >  static inline int parse_is_percent(unsigned long long val)
> >  {
> > -	return val <= -1ULL && val >= (-1ULL - 100ULL);
> > +	return val >= -101;
> 
> Nice cleanup, but wouldn't that be better to keep the ULL suffix
> for the sake of clarity?

ULL is unnecessary here. fio has lots of unnecessary ULLs :-\

> >  }
> > 
> >  #define ZONE_BASE_VAL ((-1ULL >> 1) + 1)
> 
> This patch is based on your earlier patch
> "zbd: support 'z' suffix for zone granularity" that is still in review,
> why not to combine these two in a series?

Yes, this one should go first.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-19 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14 19:14 [PATCH] fio: simplify parse_is_percent() Alexey Dobriyan
2021-02-15  3:40 ` Dmitry Fomichev
2021-02-19 16:42   ` Alexey Dobriyan

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.