From patchwork Tue Feb 28 10:25:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 9595097 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 95065601D7 for ; Tue, 28 Feb 2017 10:28:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D19827F60 for ; Tue, 28 Feb 2017 10:28:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 915E728520; Tue, 28 Feb 2017 10:28:31 +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 45ABC27F60 for ; Tue, 28 Feb 2017 10:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751726AbdB1K2a (ORCPT ); Tue, 28 Feb 2017 05:28:30 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:23318 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751060AbdB1K22 (ORCPT ); Tue, 28 Feb 2017 05:28:28 -0500 X-IronPort-AV: E=Sophos;i="5.35,218,1483977600"; d="scan'208";a="99640192" Received: from mail-sn1nam02lp0019.outbound.protection.outlook.com (HELO NAM02-SN1-obe.outbound.protection.outlook.com) ([216.32.180.19]) by ob1.hgst.iphmx.com with ESMTP; 28 Feb 2017 18:26:01 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UoOY6ad+7XY+FLlQbKkFvpZLrprbevgUpQtg4EGTt08=; b=FQLCiUfzUOsqY6RU+GCA8qQ75mkq1W6wFKNFJBmTXglS9SwWJidSbvjKwcijxvSoBD7A7lXmzRqFKo0XFkS1FVwHpLl8xXb/sycNbz4CfS0gNoBVkwpJzGdk2X2wlgyEqDXBvXxviFkkWwFEoQW6sEI6sAzi04ND/n5lDxV1N9I= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Damien.LeMoal@wdc.com; Received: from washi.fujisawa.hgst.com (199.255.44.5) by BY2PR04MB1973.namprd04.prod.outlook.com (10.166.111.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Tue, 28 Feb 2017 10:25:58 +0000 From: Damien Le Moal To: Jens Axboe , linux-block@vger.kernel.org, "Martin K . Petersen" , linux-scsi@vger.kernel.org Cc: MPT-FusionLinux.pdl@broadcom.com, Hannes Reinecke , Christoph Hellwig , Bart Van Assche Subject: [PATCH 1/3] block: Introduce blk_rq_accesses_medium() Date: Tue, 28 Feb 2017 19:25:33 +0900 Message-Id: <20170228102535.15966-2-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170228102535.15966-1-damien.lemoal@wdc.com> References: <20170228102535.15966-1-damien.lemoal@wdc.com> MIME-Version: 1.0 X-Originating-IP: [199.255.44.5] X-ClientProxiedBy: MWHPR1201CA0013.namprd12.prod.outlook.com (10.174.253.23) To BY2PR04MB1973.namprd04.prod.outlook.com (10.166.111.13) X-MS-Office365-Filtering-Correlation-Id: 8b261971-bc9d-4a11-c76f-08d45fc43103 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR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Y2t9dxtfFrWk7iQAkkd6u+WhIITI7BY7nEungr8; 20:5spaGsOwBGncAyseaF5+RK/rd8QtS7sMXGJq2TAlICk/5s2HIEp1WSNPl+jCzsm40qThuMr0/yBUFtRhe+DPoVxvZelzD0IEn/gnY75dWprZ51XNnO1HmXVyxoK/wgM9a1U9h50kDK+tpACMmxtUguPS6Stg92eb9PNSYRjnRyc+EsX3qBWuaWdhEJk0C2u8PprkBKtKQbDRpkaQoC92pjFaglPAFCTe4/hjYB/KKzun2rbSqdcPuK0CMJiWdZXqLDKk2i9KpDMaHBmjwVoDFzaIKIudQg/nhuk1B3Sswx4hmS5bNMv8jcst02HTKGzLcq5NYHe64/m7ZfId0QyTjBWJncHfEnOrsXRP1lpBCw1kY/veohzdXuNTrO5ndAMNVbwpmYjJebQYRKrPD9rL4MoLhtwxPhxWda9GqeJe0o5iK4+WNtvAhYMjlpfRX7OBnLNUOyq7DI61pPl+TzIgam6C9f965q5KJsr6tLTNqK17Hd6I5bGVV+OipANDhwEh X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123558025)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148); SRVR:BY2PR04MB1973; BCL:0; PCL:0; RULEID:; SRVR:BY2PR04MB1973; X-Microsoft-Exchange-Diagnostics: 1; BY2PR04MB1973; 4:EWOiqVKAamXaTlj5HnxY0ilZkNPMnPI9R1M71vslPARwhQ/wF/9CrMJKOwn6JwA4f7giIvjYfPw9Um8A+IryOb9hHuq3yKgxSXROojPWOq5VVIl8ACtzvqEZrH5LpvJ+hR2yss3QKWQN4lzJI7PhKPVXt7VgbaBIYM+VknznI8uzeSeAuZ+YMtYOgPkOEpjrDStS7v3SXYYctcXsj6UurfFx3JZeurggR+nEYwXyn1KI4E2lZNGov/dT1ZG52NSsNHezgts7O7m7Eika9W7V0WmiC3olJ3MIFm+ndZBiBbxYS/JzVf2TQV++aL/v8ayNs5fCJUAm618WfwEXvnk4bfpnbjLQaahYq32+mq+al5MTIwb5tmQHt53RKQpfhUuQujRa75YekZ8B3+puTA5zfbCSKcRRqP06c5PwlV/N+PDoo1nHzLZg8ii+j3QY1+z46PmBe6smlBgfvol8GScvgKqyj4Z529YXQPBSs/Jq9rr82gL2JFJ3js67EJsPmEdsglF5VMgnFOpcHD6+6QQXDXAGogwCPanUZBbTeXAYoCptlhGYrTlHNv+Get2Pl+8QFlrz2soRgyrliVQD7BUcEtKSKRfEESb30SJdWOd1jT5MZzwnRVujL2fZvMGYolFuU4VKsehvJemkbIAYMs1Ko3ik7q6m5zNY0VSon2Bec2Q= X-Forefront-PRVS: 0232B30BBC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(39450400003)(39840400002)(39860400002)(39410400002)(39850400002)(199003)(189002)(6506006)(6666003)(36756003)(101416001)(2950100002)(6486002)(50226002)(189998001)(81166006)(81156014)(76176999)(50466002)(54906002)(6512007)(50986999)(25786008)(305945005)(7736002)(5660300001)(8676002)(97736004)(48376002)(53936002)(92566002)(2906002)(4326007)(33646002)(6116002)(107886003)(38730400002)(575784001)(3846002)(5003940100001)(1076002)(105586002)(106356001)(68736007)(42186005)(86362001)(66066001)(47776003)(7099028)(5005270100013); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR04MB1973; H:washi.fujisawa.hgst.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: wdc.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR04MB1973; 23:m0PBvZzXr63HVpZZYy2fmk9PD2WKB1unerYDOItYO?= =?us-ascii?Q?YnSluq8aCNPXjkMGF/G47vfTZ+g/tZ7VUkFS95PlKOxT75VYeqX15nP4v58V?= =?us-ascii?Q?3eEGai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sHNJz6V/AwGA/gwmukE6IGcOxhTFk5ovh3z59bCAvhf+zIuUMJFHRTjrOSp0AvHf4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR04MB1973; 7:Qo+8JwVVdkbXRkNagxu3UqAlj2MODuVEDactOKPrFGYKeg9BmmO40NrBy8OrXH/3GTqh1slLUh5KETYXI4jyN6Jwr1zlFD1SXiO7/nbHX9hlfEKDWqrcXFsFcBWMZ4M95pwnYbh6aH3NG2wVrkfXzSmmpDaYjUnRWAQXW7Ig87VSS+N/cg5wbRVBXGDrZoWDn+2QXIiG88Lxfz4rFOoCePq2IWMqD21eQ4eujSfYFiOOtU7lIo5h2SwoAWXJ33o9M+7hFYCvbkkbod7WquNvyhi1QN9SOMuvEo6z0bQMzgHyeeIH10cXGOof9x+RUEBDzK+JW8+3T00IA4VsVoY92Q==; 20:DbOWhKK246ZznQbTw5EmZqycuy44S335w/gMYf7vbsKSwDswlCWX+Kpjv4/SM+FKP3IInnDL4mSfiLg7kOLiudlEV17Zix68iTF1Ka0BrFkjymkrx79MEuuJRfyXkbP4mbKKxdOMc+kjn+kMey9lsBAB7ZuxXF39/JGJ+OFc9mcmtYH/6BNmvYfXSB4gH9wOQqTGPR66CQ8EQdaxCqbU8MMTZRWnVRJNjRC1hd3dneJZhun7gpvIuPtArSirVb2m X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2017 10:25:58.8985 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR04MB1973 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: Bart Van Assche A medium access request is defined as an internal regular request that operates on a whole number of logical blocks of the storage medium. These include REQ_OP_READ, REQ_OP_WRITE, REQ_OP_FLUSH, REQ_OP_DISCARD, REQ_OP_SECURE_ERASE, REQ_OP_WRITE_SAME and REQ_OP_WRITE_ZEROES. Zoned block device requests (REQ_OP_ZONE_REPORT and REQ_OP_ZONE_RESET) as well as SCSI passthrough and driver private commands are not considered medium access request. Reshuffle enum req_opf definitions grouping medium access request up to REQ_OP_MEDIUM_LAST and introduce the helper function blk_rq_accesses_medium() to test a request. Signed-off-by: Bart Van Assche --- include/linux/blk_types.h | 17 ++++++++++------- include/linux/blkdev.h | 12 ++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index d703acb..6420057 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -151,16 +151,19 @@ enum req_opf { REQ_OP_FLUSH = 2, /* discard sectors */ REQ_OP_DISCARD = 3, - /* get zone information */ - REQ_OP_ZONE_REPORT = 4, /* securely erase sectors */ - REQ_OP_SECURE_ERASE = 5, - /* seset a zone write pointer */ - REQ_OP_ZONE_RESET = 6, + REQ_OP_SECURE_ERASE = 4, /* write the same sector many times */ - REQ_OP_WRITE_SAME = 7, + REQ_OP_WRITE_SAME = 5, /* write the zero filled sector many times */ - REQ_OP_WRITE_ZEROES = 8, + REQ_OP_WRITE_ZEROES = 6, + + REQ_OP_MEDIUM_LAST = REQ_OP_WRITE_ZEROES, + + /* get zone information */ + REQ_OP_ZONE_REPORT = 16, + /* reset a zone write pointer */ + REQ_OP_ZONE_RESET = 17, /* SCSI passthrough using struct scsi_request */ REQ_OP_SCSI_IN = 32, diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index aecca0e..7d1ce2d 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -248,6 +248,18 @@ static inline bool blk_rq_is_passthrough(struct request *rq) return blk_rq_is_scsi(rq) || blk_rq_is_private(rq); } +/** + * blk_rq_accesses_medium - test if a request is a medium access request + * @rq: A block layer request. + * + * A medium access request is a regular internal request that operates on + * a whole number of logical blocks of the storage medium. + */ +static inline bool blk_rq_accesses_medium(const struct request *rq) +{ + return req_op(rq) <= REQ_OP_MEDIUM_LAST; +} + static inline unsigned short req_get_ioprio(struct request *req) { return req->ioprio;