Skip to contentSkip to conversation

parse: simplify parse_is_percent()

PATCH In review Alexey Dobriyan 2 participants 4 messages Feb 22, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 parse: simplify parse_is_percent()

Check "unsigned long long val <= -1ULL" is tautologically true because of how value conversions work.

---

 parse.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parse.h +1 -1
@@ -130,7 +130,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;
 }
 
 static inline int parse_is_percent_uncapped(unsigned long long val)
#1 lore raw
Quoted 2 lines · Alexey Dobriyan

Check "unsigned long long val <= -1ULL" is tautologically true because of how value conversions work.

Thanks, applied this and the other 3 patches. Note for future patch series you should use git send-email and provide a small cover letter for the series. Also avoids typos like 2/5 for patch 2, and it gives the reviewer a sense of the whole series.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 8 lines · Jens Axboe
Quoted 2 lines · Alexey Dobriyan

Check "unsigned long long val <= -1ULL" is tautologically true because of how value conversions work.

Thanks, applied this and the other 3 patches. Note for future patch series you should use git send-email and provide a small cover letter for the series. Also avoids typos like 2/5 for patch 2, and it gives the reviewer a sense of the whole series.

Oh well, still can't get used to bulk emailing.

These patches are independent in fact.
There is textual dependency between parse_is_percent() and main 'z' suffix patch.

And the rest was found while reading code for 'z' suffix.

#3 lore raw
Quoted 10 lines · Alexey Dobriyan
Quoted 8 lines · Jens Axboe
Quoted 2 lines · Alexey Dobriyan

Check "unsigned long long val <= -1ULL" is tautologically true because of how value conversions work.

Thanks, applied this and the other 3 patches. Note for future patch series you should use git send-email and provide a small cover letter for the series. Also avoids typos like 2/5 for patch 2, and it gives the reviewer a sense of the whole series.

Quoted 7 lines

Oh well, still can't get used to bulk emailing.

These patches are independent in fact.
There is textual dependency between parse_is_percent() and main 'z' suffix patch.

And the rest was found while reading code for 'z' suffix.

Even if they are independent, it's easier to organize if you send it out as a series :-)

Signature · 1 line
Jens Axboe