Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756767AbcJMT5q (ORCPT ); Thu, 13 Oct 2016 15:57:46 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:32112 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754217AbcJMT5O (ORCPT ); Thu, 13 Oct 2016 15:57:14 -0400 X-IronPort-AV: E=Sophos;i="5.31,489,1473091200"; d="scan'";a="25155211" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Adam.Manzanares@wdc.com; From: Adam Manzanares To: , , , , , , , , , , CC: , , , , , Adam Manzanares , Adam Manzananares Subject: [PATCH v4 1/4] block: Add iocontext priority to request Date: Thu, 13 Oct 2016 12:53:50 -0700 Message-ID: <1476388433-2539-2-git-send-email-adam.manzanares@hgst.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1476388433-2539-1-git-send-email-adam.manzanares@hgst.com> References: <1476388433-2539-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: CY1PR21CA0075.namprd21.prod.outlook.com (10.163.250.171) To BLUPR0401MB1715.namprd04.prod.outlook.com (10.162.215.17) X-MS-Office365-Filtering-Correlation-Id: a411ed08-996c-42c2-7d9f-08d3f3a2b140 X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1715;2:4TVku67xxtWtyPq8njZ/3J9yyt20smCg9QxomaS1A4TJAyoY8DEwakCsab8vfoRxBT07lvvuKyjwZ1GJGcxfjIAU+ErwjZdk/FH/G7tuoXnBFDSABImmTwaqBnyRLp+10qSbNW5JNw6R2rnt2Ekwr9OS4wHXFuUTKb51mUsEC3XU/Zsh31zdTCTsMfjQcsyf11VDnfovNQ4ben8eYNT9yw==;3:q4ZGjcNAmR65qZ5YIbxfUKxr9UL4jFD2n3jcIGNCI0qCkgJA4abrs1Eq3XWAC1mspYOQ7x4VPVXxwsnFjhZm19jNShg9ZLI0JGeppk+dME7uNLARa4C5akf9z/G+aISb3WDjPkUoUgsgOQ81c/o59Q== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0401MB1715; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1715;25:FfOLsxX3iT0h+LH14tTWrX75414NejPOLRkvEwmzyWi7UHaNizhQIVHP04FKYtXJjNcgDoK7+kbVihrsX+rNFHtnQDaftccTFWZ0lpLG2/W9G4HrQ0mar5UxNq6jQLJFSckokyOAr9j7aqJjt9Rtn+dxePvCnFcZLKFnINCb95jAVhDldSckGskNp2N9KZcXfHLojittxCg8K6IF5XMd2xSvarHiaSISCtHcIbthTTcDFs+SIyo9SQn55qmg2n0O16RByNw+FaedONEiCHOQ8GQbGc2kNwiZ/pi3FRSjMU5NPBq8ixNVHMc/ZVb9kZ0/Blclu0fPCes6HKBb+eQ/V8RE+rFnzSszi/b+IrSr87bS6NzMyQcvJuW0N8GKT973PqJImwXFTxX8h8NLyMrfIiBRZFEkmggqwI1vc9trPatel61g/Jim00nt2TgW+1a1HHQw/lChXShCrwh3ssNs30fJWWgdYZJCT4Eo3OqzkisOSIi2Bf2sK/4J8vJ4ctHlIUa1fcT4TGZk4CYn8u4dSZxZrqBynu05Pjw4vS58gKV8Nh8NpZn9TyPP5IHRR3Gw+G5CVwPcmz2O9VtIN+K0OU5JyXtykOSnrjP8ftnHXGHrM1/P8drmVBUX4YupJul6kRnK2B7CXC4xtkbhCwZq1yPiQWJa1Z7t3Rr4WpS3OABAPujKp8bmQTsQJWEzkbC3ZHq7tD+3L/g5bxXPea28IL/KxiOALb7S9tqLnmQo8+4= X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1715;31:8eQZV52hITT9AYV0CdBQmbNu6JsCKacOUX/3128FcBVXMGwCrBpOR0dDuaFzmK/mHtYJ31P6nsWgywmSomklx1a5N7fH1UEtoo06XzuLbdskYimD1eqklnmQZHDbJW0+FfSxQXWuX0U1E9+pB+OF7L1UGvZxO6ecpt5T9EiLeqLMSjpfRFrXkE6UuU+Lz2Ttji4MuVtjHQYPwerqKF7d4hlxZFK+cVTE9KavBxdcWcDbamw4b4fFvDCg8KCHHdbOsWEeN6lTefOK/kETAlxTnA==;20:ql0XQRZypZ4pGyEdIliLnRfcOo3DVQg68QBL0nF4SGBfFrBo4g4YpsHKg5+fxubgKMF79Yttxl6Q6BG/tY4WdWfDdK9gLN7jAqoGweb2EcDcwsSMeCLzrV/Q+Af7Lq1FnlP5F3Ywweh3KqXzkDEdVC9fajGfvm8D6WqqYeCoEP8UpZw0iT6sRaM9+4IgFBk+HmK+MvUKjPRNXUFb1Gs3fkW7eyWl6pw6UN5nIUpP19biiIZe4F1vYMGxpBWvQs7QMZWrKj99fDqHHvC8pYc8v0e6xKEnbpZ6FXqwzk+USNIDNf4R4l0ivC9773bOc7NevLhtoS5TiqzK2KqRf2zbliik4Vl4V/PQVLtFU+jaDnf0NBE4N1xNDuMG5hpfN5ybXdieMR3DdFwuX7nElGGEsoyUlSIDNVBrfcKGezHde1qZpnD/Sumiu8WJ68gsd6INpToiYPiHysCslxrm7K7rQHuIw+F24yS89WhKYboAb2JUGIGzDER6Noq7nC6JrIul X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026);SRVR:BLUPR0401MB1715;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0401MB1715; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1715;4:vi18ZV5AwqUPifasZaFM98xMaSZBfbKHhF6R4yrZhYCw92bVNDCPDYhxo4Oxe/BYBJFeYj3C5PMJ5Y53k/y4tUrISLS5OVYLfEqWwNlu1yPeg7xO7mHF0dinpgQKProbpIBk//ui8cIJhOr+/hmiK76CHPbplNMHU/212iEEAcNc/swb7CtWYXvrAE5iO0vxfmgh75FKgjXy9ZxaxG5unDbsNMfwTiAntR5j/mRMb0mdqiNIwpuoYTpwwHR7EA+i6T/1r0KQ3fYV9FbrwNiHBnBE3/9Rf+cITUMqVI8eo86SGGiZU9AGp/uMs1Bvpydx4um2NQm03QjoooSH6CxXQGDbQ7QMUJ80H6KXhKVVBM1oh/UFt3ZMVFhp755wK1z+cwXlYAnKjit0uOv+oFYAdMrybHu9a+6EUzNPxpEDyjw= X-Forefront-PRVS: 0094E3478A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(105586002)(189998001)(50466002)(36756003)(101416001)(42186005)(92566002)(6666003)(42882006)(2950100002)(4326007)(33646002)(19580395003)(2906002)(19580405001)(2201001)(68736007)(5660300001)(50986999)(48376002)(76176999)(575784001)(229853001)(50226002)(6116002)(3846002)(81166006)(81156014)(305945005)(47776003)(5003940100001)(77096005)(7736002)(7416002)(5001770100001)(7846002)(586003)(8676002)(97736004)(106356001)(66066001)(7099028)(921003)(83996005)(2101003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR0401MB1715;H:penguito.sanjose.hgst.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR0401MB1715;23:PJIGgQLQalP/9vmxgPxCDXg+ZH5qVOKV4s4lkn+?= =?us-ascii?Q?xERDCa1jMYgRCbruEv7RNRv7sBybk85s5Kv99xw6xeIMNx5t1Dm9r+PDsMpp?= =?us-ascii?Q?ZQmjFmb2Wvbmyb6IKCn77uTU+SxpLuVYOis6AUwg9JQ2aX8ej8hpe8iEtZJU?= =?us-ascii?Q?3fs1QaWY50OjeUEOX/XbgiZ4nAzfM1Kn4D/+4LVG6zyh45Y3Bf0YSAt3zENl?= =?us-ascii?Q?V2AUEPvfcqRGn2sMnpZ8ymMgkGXdhq1c5Cr+xCGPr810/2UkAlhLjQOIlRpg?= =?us-ascii?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FCX4UikX7?= =?us-ascii?Q?Ye9gqrPnMbP8ekB0gK0SPA304DNu41vPumrhlNIJ5JeOge4o0AO2zE7V/Fw?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1715;6:v8kRpLeNEwEPIJDXxN8qXvJ0lWFmFJHIujrrnc9REbw6V46gRm8ErfcrfSBH9wk8JJBrGBHkbgSj4la2QpP+7nEo8gWJBJzyOMdR0XTiQcVQMXc/Ma8QT0gv4REjbsxpuEdfkW2glKYfHKdoNMYedyGug/zcm95gO1g5fHs+ii3l1gL15Mk1A/sAQrLd1d2WXl+f+q2QEfJgSi7v+iZyIdmULK4lcmyQrX/L3jbAeQ+iWrUMLSz50foVXdWyDi1EuxVDdDy9YsCgxZhddPOg3rbl4nHxvtNek9HwWDIdvdezTEZ3ywj/E/q1AoLqbhalMEONP18GRytbNBhLWIh3e7JmPE32rVGdgp1BTHy5vUE=;5:Z5193rB2ibyJFTPp+hjOA6KYSA6QCulhvjLP6SJSdLulcz95cyybOsC6zbr3AjCGgiFrqrwB6ChFjpg/TKANgJAmKBBlupfa75JIMRwRumZEQ3WnaL6bpCSlz8nXsPrxiPAK4bxcJPwG5w7ba5tWbrKzPLEy4dkmXfTyuH3eUSg=;24:GFJsZXor52to3KNUOgLHlPG9nCzd6NSqOlykWMtdQaQPg+w/IikeKGJDxWYAFGKGcamTDHIPCoCdc2YBkEK1kewZl3Z8xb60Eqovy101VJs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1715;7:ik92q+RDnAWLNQtpeO/wlz2onX3493xfWJLvyqv2UHVjaZOFkutSdQ5tXoUA95njMsDcphs8mws3ThaBpETmh4vhtp95mgNOZrG9Cny0gRPDN74fQQs3ZJ/su0x6uExwWuCEq5T4LjR6PnCq3/5mr5FnpEFEvwX1JtpXTSuNdRIObmULvImV7beHSc3pKiA7i7Yktxkhmi4vlTzAbiqIhBPpPb1c7772mZILWp1fKH98xwFoI00bw4gkwGbS0Hhd3G/Vxkcrqzgi8S8KCXa8ohL07E8jlFhPqfKp32eYv8DA+KnVnZsf6I5q2BTMHlsmNG47LlbSEhE+4Ib96SXfMncHZcREbNeDj6iiyQ0E8GI=;20:6rsCO4mgNNvfROJir10pJgNx+wIWmEi1mTrDDVv8Yj3vfTfSv/kjx5nrh5c6MbuYzAhjxgL/hc2egQy8ObOPoM4bStC6Yd/fhRzEPmvvRjURsPbUQKGdVaezNFrFBbLylzXx5/iWqoeQNQhqfzn8/gQapBeq3h67kZwI6ano8oLHFZFgpQB9zpzzpYmlkbNVa24ZJxShA1ac8jwzhoIdSsKYE8dqjmAoB5QXN4S/KtMjfONsIVkpvNQgeshLUnqo X-OriginatorOrg: hgst.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2016 19:54:05.7791 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0401MB1715 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1989 Lines: 62 Patch adds an association between iocontext ioprio and the ioprio of a request. This value 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