Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755346AbcJMXCU (ORCPT ); Thu, 13 Oct 2016 19:02:20 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:62749 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751532AbcJMXB4 (ORCPT ); Thu, 13 Oct 2016 19:01:56 -0400 X-IronPort-AV: E=Sophos;i="5.31,490,1473091200"; d="scan'208";a="25178985" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Adam.Manzanares@wdc.com; From: Adam Manzanares To: , , , , , , , , , , CC: , , , , , Adam Manzanares , Adam Manzananares Subject: [PATCH v5 1/4] block: Add iocontext priority to request Date: Thu, 13 Oct 2016 16:00:28 -0700 Message-ID: <1476399631-5799-2-git-send-email-adam.manzanares@hgst.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1476399631-5799-1-git-send-email-adam.manzanares@hgst.com> References: <1476399631-5799-1-git-send-email-adam.manzanares@hgst.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [199.255.44.173] X-ClientProxiedBy: BY1PR13CA0002.namprd13.prod.outlook.com (10.162.107.140) To BLUPR0401MB1713.namprd04.prod.outlook.com (10.162.215.15) X-MS-Office365-Filtering-Correlation-Id: 9ed2b9e6-7de3-4664-404a-08d3f3bcc641 X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1713;2:mqg5yNbbNDs14dKPJSXLuTUGZ53pXBz1DERxg9LFdhQSSSngcpb+DkM9TRzyVFgkHNk/LUs6aWwtB3WrCCa9iBwuEwzZeLdUgh36vS1patV1WL8u9VWWh/RLZGP+S4WOU7Ui8H7doDrMfYb5GIbSBUWHaCnUaRtHfaVivoFvcLzgKIvX6wqquOTBwbGPPs+naJ6+m+99CApXiZZrHmmjZw==;3:iWcKbBDl3DSL+QObQvj2BNlQLjlhtLdfGibKVKHqUG3REjC4DUHybUE8fST3b92nbJr4lD1KLsUqwH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vKE5EzXbN9lzooG2V3a2r5bAjhd72yOqNapa55ZM9qoiJswzU7PxYvQYJcKKq5Gg0w/hilobrkwH0OsBfPtUkVRZFj5L2tGBa6B/mfYUP1C2pGMmd2wwI7KsV74FOM42+qy4ueCAUnJaz1VWtj16P05WUwzISqqLVfgL7zhsW8+jxn9Iuvab70lY5HS+BoG+vPaKv81ww+kx5wAv7cfMp3ZYsoL/UTEs3KVGLuijdKbhCHUv7od7S0AqejODe57Cm5i5GVApdeIgtJlcotxJlIcQNStheKivNcVd4l3DrMuw/gVajJpuK3lVsvZbUyOAXCFwZuAX8R9qqBJNY35cD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026);SRVR:BLUPR0401MB1713;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0401MB1713; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1713;4:5WmaPO4mp+KIsIbKgY8zsEEvDzAl8wDc+OOmEmdLPyFuB0lTLVePCgcddyYt9V0MjWA38crnjIeWeIEZLcWe6vIPuy8jJFbIYPkBIYPKvB9N/n0cwYXBAf+cAF47w1Jx/G1Wk89ZSrMz3/JH87bSRBE2o3hZ0oygJCG9tp4MXJCPo7SUL8Z+a4rOKa5tBtMlYmpuOsO5Wu3PtAtDjPCMIyDb5cJ5UU2GFVtYIGOdYaDox7FcBMvyvDwZ6thUWpOPoAnTDsyScls2n9/8ojvRuljeK/5e22bfw66J1XVOk3bxLLxK2NXTuPtU0VOpMXyPHcZLxou3PiPcxAd2e2YHKOFfqiJVfDiHQ7qG7uF+Pp6M42dGbDeP6YPI5bcQk57AnGs5A5ktbFkyUWQY4rKuBfZLX1A81Zrf1bDhWNlTOmk= X-Forefront-PRVS: 0094E3478A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(92566002)(4326007)(42882006)(7416002)(3846002)(36756003)(106356001)(7846002)(305945005)(6116002)(2906002)(50226002)(97736004)(575784001)(105586002)(19580395003)(47776003)(2201001)(2950100002)(48376002)(33646002)(586003)(7736002)(66066001)(19580405001)(76176999)(6666003)(42186005)(5003940100001)(189998001)(50466002)(77096005)(229853001)(5001770100001)(68736007)(50986999)(5660300001)(8676002)(81166006)(81156014)(101416001)(7099028)(921003)(1121003)(2101003)(83996005);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR0401MB1713;H:penguito.sanjose.hgst.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR0401MB1713;23:iGURzy1wbBRoesLhAr0BT+5tACbMZ8j5BFx7HLQ?= =?us-ascii?Q?ThJv1Ux70LXH5uMve3Ne7XHGZwXmIWpYqQCGAGD//zBf3uKrisSLuf8eJbOC?= =?us-ascii?Q?YHrK8ATN+22z1eP+mluPP4N+/V351fi8gYZpR1eiKo5BpwNQT5qH8/K3OE5w?= =?us-ascii?Q?HOA/YbJZtcfWPF3/WX4wbd2idPJwNtLrvGdw3BmBmE7TLWgGuwGQDHDziQ7c?= =?us-ascii?Q?okdZNNa4YTwjGfdaQT/8MVlgUMw4vNPSEfB1MKMoUA5/oksSJU57MduQH+tN?= =?us-ascii?Q?EDFNGUahBamjrR8NqovAL+1p4x3DFuYVBPojXe+7JDsHLzX4ZtVb2xgru87n?= =?us-ascii?Q?8YogYlO+6PXeUAZ8m1B2IhK1/EtvkRcpOo/GxOBVfRN47b/uG1R6vrQa8QeD?= =?us-ascii?Q?Fmo+sH46L3GXDqMJoebS+vIVgc4q9uSRqOSRDZDH1ia9Xjk17IFStzVY4HNd?= =?us-ascii?Q?17bfPibbLx7H9rF6D8knCuLbwrXuc9NJV/3s5Q22oSCaB0OLCRvXFRLzy6GC?= =?us-ascii?Q?rBhBTQoyXLpf7C39xAjPdZH5pZURT28mA8s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SBsJAQvSBXaR3y/LMRZ3NphE0MM2FvnMQV4Qvp+tO22rI6pjaRnAmZx+WWeS7fLspd/UmRsgWfltyVghHHlNX7FjFSL X-OriginatorOrg: hgst.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2016 23:00:48.0394 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0401MB1713 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2564 Lines: 72 Patch adds an association between iocontext ioprio and the ioprio of a request. This is done to enable request based drivers the ability to act on priority information stored in the request. An example being ATA devices that support command priorities. If the ATA driver discovers that the device supports command priorities and the request has valid priority information indicating the request is high priority, then a high priority command can be sent to the device. This should improve tail latencies for high priority IO on any device that queues requests internally and can make use of the priority information stored in the request. The ioprio of the request is set in blk_rq_set_prio which takes the request and the ioc as arguments. If the ioc is valid in blk_rq_set_prio then the iopriority of the request is set as the iopriority of the ioc. In init_request_from_bio a check is made to see if the ioprio of the bio is valid and if so then the request prio comes from the bio. Signed-off-by: Adam Manzananares --- block/blk-core.c | 4 +++- include/linux/blkdev.h | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 14d7c07..361b1b9 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1153,6 +1153,7 @@ static struct request *__get_request(struct request_list *rl, int op, blk_rq_init(q, rq); blk_rq_set_rl(rq, rl); + blk_rq_set_prio(rq, ioc); req_set_op_attrs(rq, op, op_flags | REQ_ALLOCED); /* init elvpriv */ @@ -1656,7 +1657,8 @@ void init_request_from_bio(struct request *req, struct bio *bio) req->errors = 0; req->__sector = bio->bi_iter.bi_sector; - req->ioprio = bio_prio(bio); + if (ioprio_valid(bio_prio(bio))) + req->ioprio = bio_prio(bio); blk_rq_bio_prep(req->q, req, bio); } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c47c358..9a0ceaa 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -934,6 +934,20 @@ static inline unsigned int blk_rq_count_bios(struct request *rq) } /* + * blk_rq_set_prio - associate a request with prio from ioc + * @rq: request of interest + * @ioc: target iocontext + * + * Assocate request prio with ioc prio so request based drivers + * can leverage priority information. + */ +static inline void blk_rq_set_prio(struct request *rq, struct io_context *ioc) +{ + if (ioc) + rq->ioprio = ioc->ioprio; +} + +/* * Request issue related functions. */ extern struct request *blk_peek_request(struct request_queue *q); -- 2.1.4