* [PATCH] blk-iolatency: fix max_depth comparisons
@ 2018-07-11 13:30 Josef Bacik
2018-07-11 14:22 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Josef Bacik @ 2018-07-11 13:30 UTC (permalink / raw)
To: axboe, linux-block, kernel-team
max_depth used to be a u64, but I changed it to a unsigned int but
didn't convert my comparisons over everywhere. Fix by comparing to
INT_MAX instead of (u64)-1.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
block/blk-iolatency.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index a35a1f580337..5aabcb746f01 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -434,7 +434,7 @@ static void iolatency_record_time(struct iolatency_grp *iolat,
* We don't want to count issue_as_root bio's in the cgroups latency
* statistics as it could skew the numbers downwards.
*/
- if (unlikely(issue_as_root && iolat->rq_depth.max_depth != (u64)-1)) {
+ if (unlikely(issue_as_root && iolat->rq_depth.max_depth != INT_MAX)) {
u64 sub = iolat->min_lat_nsec;
if (req_time < sub)
blkcg_add_delay(lat_to_blkg(iolat), now, sub - req_time);
@@ -817,7 +817,7 @@ static size_t iolatency_pd_stat(struct blkg_policy_data *pd, char *buf,
struct iolatency_grp *iolat = pd_to_lat(pd);
unsigned long long avg_lat = div64_u64(iolat->total_lat_avg, NSEC_PER_USEC);
- if (iolat->rq_depth.max_depth == (u64)-1)
+ if (iolat->rq_depth.max_depth == INT_MAX)
return scnprintf(buf, size, " depth=max avg_lat=%llu",
avg_lat);
--
2.14.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] blk-iolatency: fix max_depth comparisons
2018-07-11 13:30 [PATCH] blk-iolatency: fix max_depth comparisons Josef Bacik
@ 2018-07-11 14:22 ` Jens Axboe
2018-07-11 14:28 ` Josef Bacik
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2018-07-11 14:22 UTC (permalink / raw)
To: Josef Bacik, linux-block, kernel-team
On 7/11/18 7:30 AM, Josef Bacik wrote:
> max_depth used to be a u64, but I changed it to a unsigned int but
> didn't convert my comparisons over everywhere. Fix by comparing to
> INT_MAX instead of (u64)-1.
Should that be UINT_MAX?
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] blk-iolatency: fix max_depth comparisons
2018-07-11 14:22 ` Jens Axboe
@ 2018-07-11 14:28 ` Josef Bacik
2018-07-11 14:30 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Josef Bacik @ 2018-07-11 14:28 UTC (permalink / raw)
To: Jens Axboe; +Cc: Josef Bacik, linux-block, kernel-team
On Wed, Jul 11, 2018 at 08:22:28AM -0600, Jens Axboe wrote:
> On 7/11/18 7:30 AM, Josef Bacik wrote:
> > max_depth used to be a u64, but I changed it to a unsigned int but
> > didn't convert my comparisons over everywhere. Fix by comparing to
> > INT_MAX instead of (u64)-1.
>
> Should that be UINT_MAX?
>
Hmm I suppose it should, though I'm really just using it to indicate that we're
unthrottled so it doesn't matter a whole lot. Would you prefer I just switch it
all over to UINT_MAX? Thanks,
Josef
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] blk-iolatency: fix max_depth comparisons
2018-07-11 14:28 ` Josef Bacik
@ 2018-07-11 14:30 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2018-07-11 14:30 UTC (permalink / raw)
To: Josef Bacik; +Cc: linux-block, kernel-team
On 7/11/18 8:28 AM, Josef Bacik wrote:
> On Wed, Jul 11, 2018 at 08:22:28AM -0600, Jens Axboe wrote:
>> On 7/11/18 7:30 AM, Josef Bacik wrote:
>>> max_depth used to be a u64, but I changed it to a unsigned int but
>>> didn't convert my comparisons over everywhere. Fix by comparing to
>>> INT_MAX instead of (u64)-1.
>>
>> Should that be UINT_MAX?
>>
>
> Hmm I suppose it should, though I'm really just using it to indicate that we're
> unthrottled so it doesn't matter a whole lot. Would you prefer I just switch it
> all over to UINT_MAX? Thanks,
Just seems cleaner, since it's the max of the type. Looks like you'd need
to change two spots that already set it to INT_MAX too.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-11 14:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-11 13:30 [PATCH] blk-iolatency: fix max_depth comparisons Josef Bacik
2018-07-11 14:22 ` Jens Axboe
2018-07-11 14:28 ` Josef Bacik
2018-07-11 14:30 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox