From patchwork Tue Apr 12 20:40:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 8815471 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BE9029F39A for ; Tue, 12 Apr 2016 20:55:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D58F620361 for ; Tue, 12 Apr 2016 20:55:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC4E22035D for ; Tue, 12 Apr 2016 20:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933727AbcDLUzi (ORCPT ); Tue, 12 Apr 2016 16:55:38 -0400 Received: from mail-bn1bon0085.outbound.protection.outlook.com ([157.56.111.85]:19164 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933667AbcDLUzd (ORCPT ); Tue, 12 Apr 2016 16:55:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=RGJd/kEAxF8b1u7nST8wvbjUfXi8wIRrYbMYutM9a+s=; b=A8dfWa2g+7Rv0lnxgBEDDOw6/z7yBnalJxg3dXcDTrmH4YkXlzSs5OiD0eXi2qQa+kLNnmWKB3bspQMb9eW5sIxTY3w7o80qCIYEJ51i1//1eaa7ogwxoB3JOhOHpmkf9kugxdUvgCtbNElnd1ZA7cEyzZvP9RvAuuN4DHWd+8I= Received: from BLUPR0201CA0033.namprd02.prod.outlook.com (10.163.116.43) by BY2PR0201MB1862.namprd02.prod.outlook.com (10.163.75.28) with Microsoft SMTP Server (TLS) id 15.1.453.26; Tue, 12 Apr 2016 20:40:24 +0000 Received: from BY2FFO11OLC014.protection.gbl (2a01:111:f400:7c0c::118) by BLUPR0201CA0033.outlook.office365.com (2a01:111:e400:52e7::43) with Microsoft SMTP Server (TLS) id 15.1.453.26 via Frontend Transport; Tue, 12 Apr 2016 20:40:23 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; openvz.org; dkim=none (message not signed) header.d=none;openvz.org; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BY2FFO11OLC014.mail.protection.outlook.com (10.1.15.48) with Microsoft SMTP Server (TLS) id 15.1.453.6 via Frontend Transport; Tue, 12 Apr 2016 20:40:22 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [172.22.12.162]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 81.C1.03047.8FC5D075; Tue, 12 Apr 2016 13:39:20 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.279.2; Tue, 12 Apr 2016 13:40:22 -0700 X-AuditID: ac160c69-5f3ff70000000be7-38-570d5cf8c51a Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 40.55.03935.53D5D075; Tue, 12 Apr 2016 13:40:21 -0700 (PDT) Subject: [PATCH v3 4/5] brd: Accept non-aligned discard requests with size zero To: Jens Axboe References: <570D5CC1.1030507@sandisk.com> CC: Christoph Hellwig , Jan Kara , Mike Snitzer , "Martin K. Petersen" , Dmitry Monakhov , "Darrick J. Wong" , Sagi Grimberg , "linux-block@vger.kernel.org" From: Bart Van Assche Message-ID: <570D5D35.2020501@sandisk.com> Date: Tue, 12 Apr 2016 13:40:21 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <570D5CC1.1030507@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBIsWRmVeSWpSXmKPExsWyRoxnke6PGN5wg/XTtSz+7znGZnH3/XZW ixMzPS1Wrj7KZDF7ejOTxd5b2hbLj/9jslj3+j2LRdvGr4wOnB4Tm9+xe5y/t5HFY/fNBjaP SYc/M3l8fHqLxeP9vqtsHmcWHGH3+LxJLoAjissmJTUnsyy1SN8ugStjxsS5rAVf2SteP/jG 2MB4hK2LkZNDQsBEYvvzm4xdjFwcQgJzmSSeNi9lhnB2MEpManoHV7Xq0CKoqqWMEucvv2AG SQgLBErsv7GKFcQWEZCV+L77NViDkICWxNZ3u1hAGpgFzjJJnGi+zASSYBMwkvj2fiYLiM0L VHSy4TQ7iM0ioCox9/0NsGZRgQiJQ43voWoEJU7OfAJkc3BwCmhLTJsnA2IyC2hKrN+lD1LB LCAvsf3tHLCjJQTeskp0vprEDHGDusTJJfOZJjAKz0IyaRZC+ywk7QsYmVcxiuVm5hTnpqcW GJrqFSfmpWQWZ+sl5+duYoTEV+YOxrtPvA8xCnAwKvHwPnDmCRdiTSwrrsw9xCjBwawkwvsz mjdciDclsbIqtSg/vqg0J7X4EKM0B4uSOK/bvS9hQgLpiSWp2ampBalFMFkmDk6pBsaQicaO ulfZ5XWdF/CZcT1j7jXksC7Zm3eyTG7pM7M1hWaHa2uip2VILOPtjJ9hqcMYb/fU9BxPugTj NGXv68kL+SfsvDRDzjSlddut2ikuB8JD5y/8u4tHJfLbrPqtfRrzBK5Mu/d85/qP00+c++P8 siTDw/ONW+O8j9oRVRPrKnxuvQyxaFBiKc5INNRiLipOBADDBLdVqwIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42Lh2siRomsayxtusGiegcX/PcfYLO6+385q cWKmp8XK1UeZLGZPb2ay2HtL22L58X9MFutev2exaNv4ldGB02Ni8zt2j/P3NrJ47L7ZwOYx 6fBnJo+PT2+xeLzfd5XN48yCI+wenzfJBXBEcdmkpOZklqUW6dslcGXMmDiXteAre8XrB98Y GxiPsHUxcnJICJhIrDq0iLGLkYtDSGAxo8TFlbMZQRLCAoES+2+sYgWxRQRkJb7vfg3WICSg JbH13S4WkAZmgYtMEu9nb2EBSbAJGEl8ez8TzOYFKjrZcJodxGYRUJWY+/4GWLOoQITEocb3 UDWCEidnPgGyOTg4BbQlps2TAQkzC6hL/Jl3iRnClpfY/nYO8wRGvllIOmYhKZuFpGwBI/Mq RrHczJzi3PTMAkMjveLEvJTM4my95PzcTYzgIOeM2sF4faL5IUYmDk6pBkaZ3d2f15SwBFhm zr095cSr76Lu94KN/7B+Djmxfs/Sf/Ezdx/iDzzX6m7FNSuSg3HblWaT2mOLj+iePPxULWH3 bJGTrKruD25YrZ+w27f4opuMxOJLX1MKt8XX3D75dM2cK/f9WR5xvDy+anUFh8z64hMfVjbo ltd7vjWTeM+xzmTlC93GD757lViKMxINtZiLihMBP24EcSICAAA= X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(4326007)(6806005)(5008740100001)(50466002)(86362001)(2270400002)(65806001)(65816999)(87936001)(87266999)(54356999)(1220700001)(50986999)(586003)(76176999)(1096002)(5003600100002)(23676002)(80316001)(92566002)(77096005)(36756003)(47776003)(81166005)(53416004)(83506001)(110136002)(2906002)(65956001)(2950100001)(230700001)(189998001)(229853001)(33656002)(19580395003)(19580405001)(106466001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0201MB1862; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC014; 1:tfkbstzvbaOzE0wk90d5tDH6DiWHubP/b0dc/G/T0e9Jhtt0JWJ8SrVtx3vLvcM1l9Y849wHhOECcmXYmIW4HW54rDRnSEkIx5GgEQbUP3WVBZTagEDuw9KGWKH/kI6iQGvRmdYNjR7mKqWEBlXg3wsrXO9KFjQpCNvyyjAVIkGcwZpE4RqfVSzxXVxK/5pX8Vfh+nuxwmiAy2dSFHoYKJBuhNc/YVjHDwUpqsuX2xqL+udmDxzfXrEX5/60p11/pN6ofdTvQDLmZmoJzqd9QXdufdL2sZj2DoKZg/AyHLS3DjBG67Jhow31DrcO626wXPqd3hjrcqkyYkzQfk4TgCEXjKHFukHALhaWbmcxbzUuqaGejzGxgIXfdN1ZtxN69mNz+xfgxTuqbD/NfPsCa1/4AjPoIguA26Gem2PUndKl4UDkg0BCwCIcCA2hJtWn/6+kidNVMptu+OmlA8Vf4xk1uGvMBIDn8crnLCyoB0M= X-MS-Office365-Filtering-Correlation-Id: 78f91be3-7c3b-4680-e7d1-08d36312ab9e X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1862; 2:jFsQOJ2LHiUhV0fjQ53JFTEMFbh4aqrooif9TfJoR+O+dAau+loz9nxU2C4JdlYoHNrNRZV3rvjoEyMvrkYPTRMwBQw2lS+H7MLLcSdex9foDjjsr9RdP75eVCbz/kErGSOnUyUS6wp2yTXZIgHkab2yUxQAt2/z7K7ZYp3/AD2iIA4iAu+KxGgxh5PntWf0; 3:A6j6zTEfkZ9YbzFponBjGeCOv3TwYriXmZvyZVKkeWHhr2XmjrbU7+mIh8Hm0NcjMwjNXzIw75hKnl9C9qLFvJZotT2TkF7QpOwzb72IW9rbijZyPkDYTRVV1+TCKTfdug986Xs+4A7aHzeVcl560hxhEgyBPdFPCQ+0IHf//PqlZdDwuyeXZKup52KuFPFeNx3CFpgcqv0rskm7j1y9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ItDIXSHbrSupOrO8imOscjcyMrXTO0W9iCHISQkJ0qO/bM3uLAjR9KJ2CWrYHza+IU7l83jfqIXZnofo4nJ0J6NYpeXScfU9Dsp6CCyZXjC4TqTOiZUO8v8rZSQLWKpr65OfOPrD3go86oVq2U9PCXqNFOGesP418K3LXVaxmI1d0KGSmLdXM6H2Ob1FW+OrKQYr/mDx0hFSwfVwKgh7hNizxJzFHtpvULZQtHXyJr7jXnaY1aznJdOSc5DoneKIAzilPVfctcDptWqFpPEaoaXNGNX6ncqTRFFNZl7sOz3fUnmZ7Ou2Cp4aPnCDzT+9aGSkgWlrqoyQJ6kownsduZ3vChHsoCYC+GdnQhH96/PP1rebHtg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13016025)(5005006)(8121501046)(3002001)(10201501046); SRVR:BY2PR0201MB1862; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0201MB1862; X-Forefront-PRVS: 0910AAF391 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjAyMDFNQjE4NjI7MjM6Z0RDcHAzUnhCM212bDVOVTlwdC9CcXlM?= =?utf-8?B?WWpqUjh6Y0M2NDFZVHBRME1CQm0wR0JOc2VEcGd4T0kyWjV2Z0tIMEdwL082?= =?utf-8?B?c05EK3gxdFIvcnJxRW5ENlk2K29ua001TEJGbXc0SkFWYmplc1VMNVlsRDhQ?= =?utf-8?B?MTd2amM4L1RNaCtVNjNGR2wxdmdMV3dDRmZSZUVSTG42MlJ0U0hkTmZ5a0to?= =?utf-8?B?M1ZaaVlOZThrQlcrYVFKUUsrUVVGQmRvSTV5V01xREtSS0lDMkl5UGRCc1V6?= =?utf-8?B?TW1FYllUYXJvbU1iSFhId3JtZzhpV2t4UGxPeHlkQzRUckwxeWNrSlVaSDBW?= =?utf-8?B?WUlwb0ZxMjg0RHhrMk1GK1BiMytuMGF0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Yjl2SENqZUxnWWZVYkJtdm82YTNjUk85MjlnTUhIZ1Q0Tzhs?= =?utf-8?B?am5taTcxc2FoNDFBNlk4NVBmT3owL2tsL1Q5bTFaL1RhUmVxanFnckpQY1R0?= =?utf-8?B?TWExa2hxdWdJSWpFMlNhSzhTbVgwejhycFpFYmluL2Ewc09qcHJRRTRPOUNm?= =?utf-8?Q?LNRMxRe5zzS6PGJautcPvbnuFkER/?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1862; 5:zCn8qJQUBVULHMflEvJd4C0fMn5K8zmvvDAMHNDB57ABrcuxxfN1mb023dvCJjmCn85yW+qcxWHYWNSjAuqPWpNYHwFXwm/AlMCLWyB+MsgKGAm6Wv01qCinm4ZGMRncolv6lBrb3uHldVhev8MxYg==; 24:QQbo4VtnUU4PbQenu/JhCA6GEC6ZLCRsbuaZBO1hhHBFsKyUr5upYU9mdrbknJb6Um5wV+AfcIABrUkNFWRxVuNCFdJv2/Scq/aYzlIME24=; 20:wVmjHBHWueqviqrV2DqdJam9Rw3v6dkMpGdl16Ctci7xeBueXTaBJjFwUhHxFPYQ8tuJyZBUcq+9TcOwZHKVpEJzt8FgrJmvN1xk/ndM3MrOakD6oSAaWK/6P15tBJGi+gIRvN1Q2VQjHzgsjj44q4aqHQ4f3DykGQg0pt6XQIx4o5GBqttz32/y5pTKigNm8faql6e7SmMvvCODchHajiptpenFoqjwjF/LsC9rclTOuUI8/AlcK5hRCgBhMyjP SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2016 20:40:22.8315 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0201MB1862 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Bart Van Assche Cc: Jan Kara Cc: Christoph Hellwig Cc: Mike Snitzer Cc: Martin K. Petersen Cc: Dmitry Monakhov Reviewed-by: Hannes Reinecke --- drivers/block/brd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/block/brd.c b/drivers/block/brd.c index 91eb844..9806551 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c @@ -342,8 +342,9 @@ static blk_qc_t brd_make_request(struct request_queue *q, struct bio *bio) blk_queue_split(q, &bio, q->bio_split); if (unlikely(bio->bi_rw & REQ_DISCARD)) { - if (sector & ((PAGE_SIZE >> SECTOR_SHIFT) - 1) || - bio->bi_iter.bi_size & ~PAGE_MASK) + if (bio->bi_iter.bi_size && + (sector & ((PAGE_SIZE >> SECTOR_SHIFT) - 1) || + bio->bi_iter.bi_size & ~PAGE_MASK)) goto io_error; discard_from_brd(brd, sector, bio->bi_iter.bi_size); goto out;