From patchwork Fri Jul 20 01:42:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10535855 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 3AC66600D0 for ; Fri, 20 Jul 2018 01:42:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E2C32841D for ; Fri, 20 Jul 2018 01:42:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FB8728459; Fri, 20 Jul 2018 01:42:17 +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 AF1952841D for ; Fri, 20 Jul 2018 01:42:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730913AbeGTC2F (ORCPT ); Thu, 19 Jul 2018 22:28:05 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:41578 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730505AbeGTC2F (ORCPT ); Thu, 19 Jul 2018 22:28:05 -0400 Received: by mail-qt0-f194.google.com with SMTP id e19-v6so8998538qtp.8 for ; Thu, 19 Jul 2018 18:42:15 -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=X7C5+KCLzls7Y7JOx2SZaZc0EMqDHUT/n+9pyNxG6IE=; b=EG7NNyZKqnPhaLOJzf524DbT3xtOagD6uqMJguGQ60dExaHvRc0IhpuYtxbCr77R4A k1nEKDBpEyGxo5Qh+NG3s4I/D1oeOWKVjY0/vdNWGf8EXLAmbYxFd25Co+xUhhAEQ1Nb szTvVwa9b2qPEzNJgBfQz9nlFgJIT1Sn8f4UGixoee/TXUYzN2TvHkft3K0ix2joYkDj RZn20lhZrZWsKTh7EQP9G6EDJIRLGFQ6+EL7kXcEx/fxxuZ55OcJM6FgxLPWEAAG3lKt pYyawEuvTRWtVU5BZJSMHcufU5xCaBnpy3oddB/+w9sj6yrnOc83xGlGttJ2k30tC6oY 29DQ== 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=X7C5+KCLzls7Y7JOx2SZaZc0EMqDHUT/n+9pyNxG6IE=; b=m6d+JW8NuHXmymasDQjN7x6Qpsqr0nxZsGC2Uf9UYhNdbbNH70Cvx7PR4qhapfsIPD ZCPINjLvXc4tMySZUgMdGnH+SY+gSr5/7iTJgkhY/Iy+cJPHYxRoBAzhj7YDpVem6M+J OALxLaw2acVt8WWG5i55sXgR2D2WV6X8gw8Ug8Hi0tSgNXpSM4hft1r86BcRp16sMw/V HKIfcmO5dHAXiAf4dx3dKv/VoFM7TBE316OuLm58jK6ktRc0FmC0Hql1Kn9ZMOQftcBB tkoYjaYC4jM4l5eNEGL5NnJhNLyDve4swiQKKAa3HxIwL51pbHvBGaOB6FtBru2IhEI3 ZGNQ== X-Gm-Message-State: AOUpUlE70Fbh8zi6CwhdHyBIEGmlVZM+OVRCjvjFcsHVB3TQqxQATNKx ISbZpjIHxJvyoHyu213crviLgA== X-Google-Smtp-Source: AAOMgpeJwplVIkJx+eqmDUz2/3I8byuwo5fzbf9AC6Zbss8VrRNDrGLtn0aCGs2SXuus22wGUPo+oA== X-Received: by 2002:ac8:53d2:: with SMTP id c18-v6mr61451qtq.146.1532050934860; Thu, 19 Jul 2018 18:42:14 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id l44-v6sm544076qtb.58.2018.07.19.18.42.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Jul 2018 18:42:14 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com Subject: [PATCH] blk-rq-qos: make depth comparisons unsigned Date: Thu, 19 Jul 2018 21:42:13 -0400 Message-Id: <20180720014213.28772-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 With the change to use UINT_MAX I broke the depth check as any value of inflight (ie 0) would be less than (int)UINT_MAX. Fix this by changing everything to unsigned int to match the depth. Signed-off-by: Josef Bacik --- block/blk-rq-qos.c | 8 ++++---- block/blk-rq-qos.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c index 5134b24482f6..0005dfd568dd 100644 --- a/block/blk-rq-qos.c +++ b/block/blk-rq-qos.c @@ -4,12 +4,12 @@ * Increment 'v', if 'v' is below 'below'. Returns true if we succeeded, * false if 'v' + 1 would be bigger than 'below'. */ -static bool atomic_inc_below(atomic_t *v, int below) +static bool atomic_inc_below(atomic_t *v, unsigned int below) { - int cur = atomic_read(v); + unsigned int cur = atomic_read(v); for (;;) { - int old; + unsigned int old; if (cur >= below) return false; @@ -22,7 +22,7 @@ static bool atomic_inc_below(atomic_t *v, int below) return true; } -bool rq_wait_inc_below(struct rq_wait *rq_wait, int limit) +bool rq_wait_inc_below(struct rq_wait *rq_wait, unsigned int limit) { return atomic_inc_below(&rq_wait->inflight, limit); } diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h index d5e2f68fe41e..32b02efbfa66 100644 --- a/block/blk-rq-qos.h +++ b/block/blk-rq-qos.h @@ -93,7 +93,7 @@ static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos) } } -bool rq_wait_inc_below(struct rq_wait *rq_wait, int limit); +bool rq_wait_inc_below(struct rq_wait *rq_wait, unsigned int limit); void rq_depth_scale_up(struct rq_depth *rqd); void rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle); bool rq_depth_calc_max_depth(struct rq_depth *rqd);