From patchwork Fri Apr 14 07:59:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9680749 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 D8A8860386 for ; Fri, 14 Apr 2017 08:01:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAC752835B for ; Fri, 14 Apr 2017 08:01:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE10C285B6; Fri, 14 Apr 2017 08:01:13 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 4E4002835B for ; Fri, 14 Apr 2017 08:01:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752186AbdDNIBM (ORCPT ); Fri, 14 Apr 2017 04:01:12 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:35210 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752028AbdDNIBH (ORCPT ); Fri, 14 Apr 2017 04:01:07 -0400 Received: by mail-pg0-f54.google.com with SMTP id 72so32637091pge.2 for ; Fri, 14 Apr 2017 01:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=2GfMjXlrrJyL0t3MoQhCCBovBYreEuYiIm3YjcKH4as=; b=sn3e1ucStt3efM7DwayZtuRG1jilansYBC7YyDVOAl6QICSq7ar2wiiabjtRv9q2cT CmOFoQb0E3oiedm72Vwwb0UTkKSofEGM1sTqEwzFzFpXEn7q4E1GGAr1Ykp8KYk1dGPU mlC3eHGBL5szDD8O02CWgSUIbjDKr9N9Q8hvvqm4U0I2PwvwPoWdUuD8YwAZvR3j5NhB /YyV9jrJUowIABW1xVE1GtVg/MFOj8ChEqmZ3uQv55rnGF0TfNtTAeG5v8sw5jXVSIRp yGKe/bw0Ykc9VTE5im+inWSKNRipbFNKExBso4XQVBf73irrB+5mvBeegdTQRXEKDqj1 AP7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=2GfMjXlrrJyL0t3MoQhCCBovBYreEuYiIm3YjcKH4as=; b=QfhXnLr/WmVMEdVDIqB+bv0WINCwBqu32C6pW1miQ8LDVBWaBB37BglzhG96G+kMS+ RJpJSjmZI8Z48E9lETv6sUlYVXm+K8pERn++HR5YF0KslkFzMy/vOUq+/Yj7DF4L8CZZ PRVCLWPDJXsP5RumXLKku5eH8k+W4TOn+YEbmtdksZBbeuADb8l55ibqgqAknZySUZVd m8kTqRK4IICHRbI5U8dHCLZY+SFWzry/WxtjU9aiSmkIgw+eaIuVxuphXY/1WoyCOJKj kHpoMcsQiebZM/tc+zrxDNJbaxrRUooeeV6LbF7jRkMJ0ccLIexrl9fgVQPGyrOmIIA9 FXkA== X-Gm-Message-State: AN3rC/5OulCFWCTVILGtdiQXGYAGxf1omLNMBjGYuxwBBQYGZcMwwkoz fbQ2CXSqJ2WKN3/l X-Received: by 10.98.37.198 with SMTP id l189mr5736693pfl.38.1492156867262; Fri, 14 Apr 2017 01:01:07 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:180::b306]) by smtp.gmail.com with ESMTPSA id s21sm1913250pgg.65.2017.04.14.01.01.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Apr 2017 01:01:06 -0700 (PDT) From: Omar Sandoval To: Jens Axboe , linux-block@vger.kernel.org Cc: kernel-team@fb.com Subject: [PATCH v4 2/5] blk-mq: add shallow depth option for blk_mq_get_tag() Date: Fri, 14 Apr 2017 00:59:59 -0700 Message-Id: <21ada8d490f8b662fd0866e651622f2dd64e73fb.1492156558.git.osandov@fb.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: References: In-Reply-To: References: 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 From: Omar Sandoval Wire up the sbitmap_get_shallow() operation to the tag code so that a caller can limit the number of tags available to it. Signed-off-by: Omar Sandoval --- block/blk-mq-tag.c | 5 ++++- block/blk-mq.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 9d97bfc4d465..d0be72ccb091 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -96,7 +96,10 @@ static int __blk_mq_get_tag(struct blk_mq_alloc_data *data, if (!(data->flags & BLK_MQ_REQ_INTERNAL) && !hctx_may_queue(data->hctx, bt)) return -1; - return __sbitmap_queue_get(bt); + if (data->shallow_depth) + return __sbitmap_queue_get_shallow(bt, data->shallow_depth); + else + return __sbitmap_queue_get(bt); } unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data) diff --git a/block/blk-mq.h b/block/blk-mq.h index 7e6f2e467696..524f44742816 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -141,6 +141,7 @@ struct blk_mq_alloc_data { /* input parameter */ struct request_queue *q; unsigned int flags; + unsigned int shallow_depth; /* input & output parameter */ struct blk_mq_ctx *ctx;