From patchwork Wed Apr 19 00:31:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9686731 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 707526037E for ; Wed, 19 Apr 2017 00:32:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61DAE2621B for ; Wed, 19 Apr 2017 00:32:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 558CF28387; Wed, 19 Apr 2017 00:32:07 +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,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 F1EDE2621B for ; Wed, 19 Apr 2017 00:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757619AbdDSAcG (ORCPT ); Tue, 18 Apr 2017 20:32:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35598 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757515AbdDSAcG (ORCPT ); Tue, 18 Apr 2017 20:32:06 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8780D61B8F; Wed, 19 Apr 2017 00:32:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8780D61B8F Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ming.lei@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8780D61B8F Received: from localhost (ovpn-12-39.pek2.redhat.com [10.72.12.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1331677CAF; Wed, 19 Apr 2017 00:31:57 +0000 (UTC) From: Ming Lei To: Jens Axboe , linux-block@vger.kernel.org Cc: Christoph Hellwig , Omar Sandoval , Jozef Mikovic , Ming Lei Subject: [PATCH 1/3] blk-mq: export blk_mq_get_driver_tag Date: Wed, 19 Apr 2017 08:31:40 +0800 Message-Id: <20170419003142.9581-2-ming.lei@redhat.com> In-Reply-To: <20170419003142.9581-1-ming.lei@redhat.com> References: <20170419003142.9581-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 19 Apr 2017 00:32:05 +0000 (UTC) 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 Before blk-mq iosched is introduced, drivers may suppose the the allocated request includes one valid tag number, but it becomes not true any more after we bring mq iosched in. So introduces this helper to make driver get req's hw tag. Mtip32xx needs this helper for sending internal command via one request. Signed-off-by: Ming Lei --- block/blk-mq.c | 1 + include/linux/blk-mq.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/block/blk-mq.c b/block/blk-mq.c index 572966f49596..4614ab8b941e 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -865,6 +865,7 @@ bool blk_mq_get_driver_tag(struct request *rq, struct blk_mq_hw_ctx **hctx, *hctx = data.hctx; return rq->tag != -1; } +EXPORT_SYMBOL(blk_mq_get_driver_tag); static void __blk_mq_put_driver_tag(struct blk_mq_hw_ctx *hctx, struct request *rq) diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 9382c5da7a2e..ecb7b681aa7c 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -255,6 +255,9 @@ int blk_mq_reinit_tagset(struct blk_mq_tag_set *set); int blk_mq_map_queues(struct blk_mq_tag_set *set); void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues); +bool blk_mq_get_driver_tag(struct request *rq, struct blk_mq_hw_ctx **hctx, + bool wait); + /* * Driver command data is immediately after the request. So subtract request * size to get back to the original request, add request size to get the PDU.