From patchwork Wed Jul 11 13:30:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10519781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B0582603D7 for ; Wed, 11 Jul 2018 13:30:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8207290A1 for ; Wed, 11 Jul 2018 13:30:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A68C0290B4; Wed, 11 Jul 2018 13:30:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EFC4290A0 for ; Wed, 11 Jul 2018 13:30:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387823AbeGKNef (ORCPT ); Wed, 11 Jul 2018 09:34:35 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:43956 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732721AbeGKNef (ORCPT ); Wed, 11 Jul 2018 09:34:35 -0400 Received: by mail-qk0-f195.google.com with SMTP id z74-v6so13497456qkb.10 for ; Wed, 11 Jul 2018 06:30:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=nTJxz2qhweQ6e9CYeth8IVKPVXEpYklR+d63++BYOp4=; b=xJkNq3g6Lm1LVqVrkGPFAPMqT1voj7Kf99c6lDhFoS97EaR1fZ20+1Xg+NK2LubINm xIMSUaZ2rztrRcmczcPE+zI9/LojO+iepmkUwHOa8fHDxFB1FzAIKqIoIlJ/CMmJ2Ix2 TW7SgLVVSwrz5ypGwX8mIOkKkPrnmiE2zVh89uA14yCIBWRg2Oxj0jXOqxW2XxnzrnK5 MroDXDmfTolwq0y+dp+nkXjE/NuSPwQIxBz4J53qRaBZOZlHafrI+FUfglfqXiP1pojW XFuvGB6tTQl8ISOjJFgBIN2LvbUpWAhb9S/GeHTTQdOxf3ZHEoCxFkv2YNNyyTm3iy2d ic3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=nTJxz2qhweQ6e9CYeth8IVKPVXEpYklR+d63++BYOp4=; b=GVvaWTv4mLX21x9VZgoWAgPM51N6vRZIk9CBovPlx1bLJqQ6yS2q7u2IDnQLsr/JhH Br9knMoTDvybjbJtvwNAffZzhRmexZitjln4ik+hEDcpT5rJfavmjcTtZw0eeA0xn4a1 /dsUyWERf0gw227nUm2mOARHU04hv+ukozS55doeCpTA9Aq83+atRuVt4IpU54CpDZwI 54MejE8izA6J8UVno3uRHDlho/yN3DKDDNU9ijPkcP5mNfuG96Zr8s6WZaeDGJMjeT41 H53Q1uZyJMrTTBMYAR931k5mZUqwwnNTDZ9hpBMm/DljECuyylmyCEuQ8JWICdVoKvWm MRWw== X-Gm-Message-State: APt69E34xEAJ5pWXUIn7bB0iEJU6eNYAFgmPPn2+OsjLfE2Hb4Y4Ed+s lOrHywxtNU+UvzWGgZDK8sz0sBGI X-Google-Smtp-Source: AAOMgpfOhcPBBg3D32KQ4KVwJBfX4Y9jdtfPQfzQP9Rg5xu6i08HHasNF3FgHnjGZo/tTAM0BDKFlQ== X-Received: by 2002:a37:4712:: with SMTP id u18-v6mr17165816qka.301.1531315813534; Wed, 11 Jul 2018 06:30:13 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id y128-v6sm13794451qkc.1.2018.07.11.06.30.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 06:30:12 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com Subject: [PATCH] blk-iolatency: fix max_depth comparisons Date: Wed, 11 Jul 2018 09:30:11 -0400 Message-Id: <20180711133012.15552-1-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Josef Bacik --- 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);