From patchwork Mon Apr 10 06:51:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9672017 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 C173C60381 for ; Mon, 10 Apr 2017 06:52:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B35E426490 for ; Mon, 10 Apr 2017 06:52:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A885826E3A; Mon, 10 Apr 2017 06:52:21 +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 427CD269A3 for ; Mon, 10 Apr 2017 06:52:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751876AbdDJGwU (ORCPT ); Mon, 10 Apr 2017 02:52:20 -0400 Received: from mail-pg0-f51.google.com ([74.125.83.51]:33598 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751588AbdDJGwU (ORCPT ); Mon, 10 Apr 2017 02:52:20 -0400 Received: by mail-pg0-f51.google.com with SMTP id x125so101053194pgb.0 for ; Sun, 09 Apr 2017 23:52:19 -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=0o0cs2EygNFhQzA2u5efNv42BZKCXn4rW2p3+dkGHcVKq2HbJzdhA07UmVudT8cBWl 95NL7rnuim4IMWdqgcd+tgcf6Q2VhBj0iM1SrSC5/YdtIGGPOl0IDaPSIW/o1k1Wbh6y IZGMSH4DLq9vqZkpqsJ9KDTOjcQxtHYbKgy7aX3j5p8aV+Ffa/rsysiJeicqOWdNkwP/ pBFdDNoMnKjrd7PhJd4LIZwCESVeYHskZSf/3zgb6C5DL6Q9YLXfLaWQi46kMS40DY8s BStpYTjL0KebYRKs26t3v3MFmX1YOPd3xpaSEsPp9oDnhD47Yl4zUvH8dPfHGeiSmI2Y dbLg== 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=knd5NAVn/ZAu8dDvWO+PFqgdskMoOJPXX5xkKE+1Q5SAM8k+9iYw1laOSQLdEgaLcE CAK730ZaDDyiWnTREhW7ZTM7WgXbkBlU2TTK4SV8dZWCYkqQrWbB4TA7Kv9+1rSGoExi ZqxgosckG+tdZOzzsm6IGywoFPyi17mxHmkyehOb2ZOt9njUaAwPDAiYZpXX+/fjzEOq KWeLw0GqAfToaVvniBCwvv2hcqfmBboCEE6vD9EM8zezxDZHS7KouSizAwDIGpqFKv1u 1DdkqrH6gEM1NG+aLszYi1AnH2aSU6RPAIwy90rra4E6HeEsTz3L+wFWlJM/VVDDhOum EiIA== X-Gm-Message-State: AN3rC/7jobVnFAptnlaaVHInOa2pu1ji47zPJtJsjbQi7b1EbQcTZ7lglSUH/QrRKcFTRpNu X-Received: by 10.98.7.17 with SMTP id b17mr9220389pfd.20.1491807139432; Sun, 09 Apr 2017 23:52:19 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:180::da80]) by smtp.gmail.com with ESMTPSA id b185sm10679391pfa.61.2017.04.09.23.52.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Apr 2017 23:52:18 -0700 (PDT) From: Omar Sandoval To: Jens Axboe , linux-block@vger.kernel.org Cc: kernel-team@fb.com Subject: [PATCH v3 2/5] blk-mq: add shallow depth option for blk_mq_get_tag() Date: Sun, 9 Apr 2017 23:51:10 -0700 Message-Id: <21ada8d490f8b662fd0866e651622f2dd64e73fb.1491806249.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;