Message ID | 1479796729-25517-1-git-send-email-damien.lemoal@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-block-owner@kernel.org> 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 8F55C605EE for <patchwork-linux-block@patchwork.kernel.org>; Tue, 22 Nov 2016 06:39:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C30B282EC for <patchwork-linux-block@patchwork.kernel.org>; Tue, 22 Nov 2016 06:39:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80DD028462; Tue, 22 Nov 2016 06:39:12 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 07CDF283C1 for <patchwork-linux-block@patchwork.kernel.org>; Tue, 22 Nov 2016 06:39:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932127AbcKVGjF (ORCPT <rfc822;patchwork-linux-block@patchwork.kernel.org>); Tue, 22 Nov 2016 01:39:05 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:22894 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752541AbcKVGjD (ORCPT <rfc822;linux-block@vger.kernel.org>); Tue, 22 Nov 2016 01:39:03 -0500 X-IronPort-AV: E=Sophos;i="5.31,531,1473091200"; d="scan'";a="34427969" Received: from mail-by2nam03lp0048.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) ([216.32.180.48]) by ob1.hgst.iphmx.com with ESMTP; 22 Nov 2016 14:39:03 +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=u1IRHaaT99C0bfhTQrj2jWacd7wPPo3jcfwUhaAxHEM=; b=Hu7HSYbZu7NdJUcRKYRFwdZgGioeeNMdWy/P6R91qi7ryYSbXs9LwfxY2OdT4J64kJPgM39uj+g1NtFmwZw/Z95noHiISyRcNotvOqKJR9kxdW9yvIamzoKWUA9YC6V05/JWaZ7WGX4n8cu17B18l8ipg+OP9FVAF+9e2Y0bPEU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Damien.LeMoal@wdc.com; Received: from washi.fujisawa.hgst.com (199.255.47.8) by CY1PR04MB1978.namprd04.prod.outlook.com (10.166.191.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8; Tue, 22 Nov 2016 06:38:59 +0000 From: Damien Le Moal <damien.lemoal@wdc.com> To: Jens Axboe <axboe@kernel.dk> CC: <linux-block@vger.kernel.org>, Christoph Hellwig <hch@lst.de>, Damien Le Moal <damien.lemoal@wdc.com> Subject: [PATCH 1/1] block_dev: Fixed direct I/O bio sector calculation Date: Tue, 22 Nov 2016 15:38:49 +0900 Message-ID: <1479796729-25517-1-git-send-email-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [199.255.47.8] X-ClientProxiedBy: BY2PR02CA0044.namprd02.prod.outlook.com (10.141.216.34) To CY1PR04MB1978.namprd04.prod.outlook.com (10.166.191.14) X-Microsoft-Exchange-Diagnostics: 1; CY1PR04MB1978; 2:q8P89oe/7IFXefFtM1v68bcziLScYPiGkzIRbeboGeJ9IslEm8gsEPv25JSwRQyf8yUyM7NmePnzp1SiVx03PQeHSJwdf1W5+byhXf6NFdBzUle/fbiq1333UYQakjzR84uC0hVzaNKqR6iCzDJG+Q1KCIwPdK7tWCq50gKBcPU=; 3:63fex6Nk+reX2S2BqLIvX3PXDKNHNMvvo4BDX8pOMDad4nojXPGm3tmpAivjxE0IpW/PAmirE3lj6SLHHfYV2LFWB9+laf+psYye6FK4UuKbPIt4vgez9oq9MMSQj8KBW04IpzA+fovAg9ENtX+g4g3gCPCK3NG3FLhpqcnySew= X-MS-Office365-Filtering-Correlation-Id: eed363b6-f26f-4505-c266-08d412a23e13 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR04MB1978; X-Microsoft-Exchange-Diagnostics: 1; CY1PR04MB1978; 25:tdSm+j0XDRqbz7jfA1/sVEusM3cJaRnTwJSE86OSKUVmqYAooU95oJffwOPsJoe8sQQdKuvTAvn5kve3XDmKiR9qd8wifraYtkaa3S/9CreYeQ/7x5KEZ4GUgaqQdPxlt4NRy1Sgb0ar+iiPbH7sO5xiccPYGgx/zhQa+UqBHETpmuJk9YanICJJFJMmvDWaQBQ+H1rKPsGlpGqvtK86+LTeKmEhq+dvcnE+FDDZjkKH9Mm3U46Bli0RcMYKKe+6EGylyOUpeVcJnD+uFcaTmN4e8GEyxtRCEzf1vYMxE/ptiaKSgINWRsP/t/eO8gVEwcJSXepFxlpfocCpd/p7Is05VgU55oaWVnyzqweM9ZAVrXskPXYMn1I3t+LfnbK0otKRkSplDbVXLmpOsj35/XWG4k2C5DQZjNIZB50PQ/XhSeEnkSHl4aNlfQC95BZN7EE+kKs2JQAChiV+H+S+uOF8j1Ox3PdbF7onCWqYGsl8hpqm8s+WyetQGcsRR19XD17yzjvlWkLzOrB91+qPOy2XR7Ppia4iIJL41nkX+drcWdWtiE0Lxy1kGGYWlHkJojopNHKBJC9/IWa6pFomIulkMNR0AquYrxQ84HXHSxtaXWB8ypUx08UmnOCuQ6vXQdljWqBGFcoGga/H4uqdcC7vg4+fVH+No0gKC9XzIVDe1f/gb42aMIt90WxxFozoDj7S77BU3sen9U850tr8hn1uT7lo0KgGtQ3qeiLg7Fm0GNreQgNn35q8zYf0qbXx9iJEZEYMrgQ/cYKqQEYaUg== X-Microsoft-Exchange-Diagnostics: 1; CY1PR04MB1978; 31:ql+3OEmxC6dg7qqDtuSPIpYfuoNuL2PYoHjOx7keV1unKXBBd2/tDDsJKxChkCK8ibAQz+/NxccgsAOTm62fVPwp7PLhR7AAfBN9GuPrnrArqiNZ+Cn8SE/y6MznD7ce1ogMuV2eH0RX71/cHNeeLbQwHzPFvX3u4sJmXJdtdz0UDEYCAVVaJsbtJlBNrdN7wjECET0PHHGvLVWYtqXAM8gqPDipjcxcx0IYKDq/oqFsS+hcc9r6BUPN+0HhoLCD3sZLANxfKI8p0LzqYnS5Vg==; 20:MbKUyc/X2wdowh9GW3+QVOE3kUTFCsCGt/lYXLsWslSRtFWJNXjT5YZtOskIbDvf68LvHRuR5ZkhIGrVJVNdgQhtke3ulRiX9h6KtJBQKBqFM2qClsR2+KWzYCPM1l2ELansB4B2jDy/+5VcKoMbpdQrUR0adNlPIRkatpmU5nBP9U44t/us6KD7aEPaMoAIfnx9yrmvyDytscBcJAvUfghbDokVfhgjb1QPDnsJmUVWsa7twknBg4Ph28XM3SDxgfG4XLiHUwWtALAYfcS2/E0meDZiPlevj7VIvHb+OGrJuQlrL6C0cBMYkUYfSSMd6Cs+LDMDAZ2ujZXPWywYG3IWYc2pTsM4+Ucu4juWOom8Zhl3JkA+lAK2ujs8E/XxcK1fm1WABMIeZBet+qp2xuN265iCmdHfmabRMJyZjh25wyggxMrBE33LPRIetUgpSe+BPp0qKhQ9RzE4SKzWuaoN7CYCnN/C2tEPF4jGKvRtHBvLfgQMg8ctCgNhz31K X-Microsoft-Antispam-PRVS: <CY1PR04MB197856E28348B31D3CAB2D7CE7B40@CY1PR04MB1978.namprd04.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040307)(6045199)(6060326)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(6061324)(6072148); SRVR:CY1PR04MB1978; BCL:0; PCL:0; RULEID:; SRVR:CY1PR04MB1978; X-Microsoft-Exchange-Diagnostics: 1; CY1PR04MB1978; 4:oVkUNkxYJtqwuDvKM6DWpWbf8tupphgUkEuKWG0xsz1+yUaL+P8sbQ2tDQv57DlkaP9C1zf8ahSiT+Sa7zjGhJRLtCiTTgOOrVyRWR02Jl3CWEwhBPhEBlUErRWwAU0v8cVQ6iTFymaMqPNYsVKUO2v8O72sNQu4I74Ba5qGJ1i3fa5eWOQx1BTd040/vE9BCReaPwFiWMmNP6wCHe2vM9PtK0D4H1M6s+3XFye73mDCoFU6OLxf7xm8o8vyznx+TrVNhneNDKGv+iwNz40A1ZAP2ErXgtV6/gRjYiHj4giLscPuR3B3XusMOA+lROOZVK0s1CnboH2O4Q33ucwk7EPLO9fmeYwYgXwEwskFE5jrH4XmwvMax+DMAbL9rp1+wnmnFUKfz9EXANRO3/kI3EqQvWC1xre2hL7f7/oHL7Jtkl8nQRhkWmNUEwQwQqh1heBQR+3AIIp1xNXhABePDy4NtpHi6OhwZgqDX0rgXRImyVCYZCk/bOk2+ISoIt+f X-Forefront-PRVS: 0134AD334F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(92566002)(7846002)(2906002)(189998001)(305945005)(7736002)(3846002)(4326007)(6116002)(81156014)(81166006)(50226002)(47776003)(105586002)(101416001)(42186005)(106356001)(86362001)(68736007)(48376002)(36756003)(50986999)(77096005)(8676002)(5003940100001)(50466002)(6916009)(33646002)(5660300001)(66066001)(6666003)(38730400001)(110136003)(97736004)(7099028); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR04MB1978; 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; CY1PR04MB1978; 23:bZ/L25/MNxzgZTY9817P73kncjeUc2NVuZMAwlQDB?= =?us-ascii?Q?km9Xw3mW1bgyQOs9OZ3JHjA9+7Y8XTVs9Djj02Ym557PL9uUCvpM1xVDpFHC?= =?us-ascii?Q?3p+kjqHIDeZf4907+CKCB9FX1N1NgOpi49TIdYOnPckJu8AeBdn8I7GT34/e?= =?us-ascii?Q?cK+L5RuNl3R4LBb/nYkUYj9ry3SZkdka0mVDZBAufM2Ain29CISTR16OorWP?= =?us-ascii?Q?/er3jy6l/4uS5NzfPzgPnx5n5mHXyO7uI6PZG8aH7YqmD1EsUOr5NGvnHZ+q?= =?us-ascii?Q?FJXdYIml0eyJJl9TOvUqajcfYWA76fJmoRUktGk4cXskXtmekL9Q/roVlNwy?= =?us-ascii?Q?yn3mh2YcckmM19Vi9KxySH2fm7IaqZMidO5zrmkV2H1psRXLvgW6ehVlFYLw?= =?us-ascii?Q?tpVTej1Wexsyr1Dlov/EOj9nl+8D6ijVWTmzeVjJyIoQgxjYHa0KmsG1hjfX?= =?us-ascii?Q?1e0sf+XKBASfKe60e/1J5R6SHMcIvgAay5nQVyHre/D/E7xKBmQiDdsvWqVJ?= =?us-ascii?Q?v9UAbZKgjSvC1mti3kqKisxp43jGKNTrW7O5Sh8i1eFDe83hILRnORZ+e4JI?= =?us-ascii?Q?A3oCU6HlHuTYWuwYnxldhZckGr7k6WRwtwN++b4pQW8BtjgPRhrwdk9WMZWd?= =?us-ascii?Q?BCobrmSjN+sJDQww8XxCo7oOZM78KsVN9SZy08VCOI62vdQlj53zwMjapip/?= =?us-ascii?Q?deuVqK2qB5D2yvZuaZVpMqYO8ZpwQ2XSdiFz4LgwJEvfjN0pRj5zR4Ld7HCk?= =?us-ascii?Q?qmoh9ohgCDFfxSFrp1Cb4mYnE3FvQ1IaGasHK55/08wVogzPBRFXTYhT/5PF?= =?us-ascii?Q?fLqrGRp4o5kDTJFLAIAVHOHcFNt/dSbTOpDAAyLKvKN1sAisSdVAycWeWHQu?= =?us-ascii?Q?OynSWMtg2Li414TDpbQNIbFCRrDfyum+15LW5S8ui/UDQYnJSDqOdbYSLbsP?= =?us-ascii?Q?r+guqkBDsG4XFA3IIHyN/mvx5HDiLZzOB3jir7jhck7qKQyqNvdVYID9PZFr?= =?us-ascii?Q?t8=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR04MB1978; 6:RtdCpiHBeh5zUV8QOUADNJywZIYSZc9GU4Q5t9AuTOd3ZseL9stENxFSsDuvkNjJPfsDiKr6CsnPbCYlhsfuB2vtH8NnmMR5qaQH2UsyCVjA9zBMLeHeXFOq1qELyA17MoMpV1JJIuux04h2aidWjrBg0F4SYcJzqpGE+cfbdcMf6rRDjQpUkcl2ll6MyedCEW8m+gF77O9f9RK/29GI2JGYYNGLl0ozNHrNBllEArw70x3apMMe71TcYx2jlSCvjCo/D4KAd7rpSSmt+UDf27sZsSJQlni18FMSyCu7EGGk8pc9YZ7bhaM6mJNKyOJRW1dAdDy+YqNmyHWdc8aivB46+2eqG6+oEjhou74AjPorbG9NwqLIW3QZZcP4sUgR; 5:KzdAdAQ7L22kK6JJfOHbvh2HuEabygSUV+Ag2xASOXhj8OFQRb69SB+PfIpZSmLj4yXaXUooFoiLwehsHi1yIlOHllQoi1c14kmmcJ/YsahThAnP/1FbyAXgWvmszWPEk4nVjb1TjqaDpebhBtNFsQ==; 24:3wjWrxfnczLmITinqIlISYn4GiGuV+8uG56uPxNCobWMARPEuMhhUdFLeknVG+IszcFbFuhivjfI1LMjFHJ4OfOqnJ8/2/qCTRx6fv3gz7U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR04MB1978; 7:1hNcKfUDJOgx3w1rl47tnUTwYnJKZC6O4FV+bmUhZSG6uneJAnuZOrnUQfE5ShfZT+s3ausv9WaW8yl0CbeYIua5sS0I0LC7pVnma94fin+Wdgsl3SRIrtpg9wGiBNkUFWcxhFstvCz3Bea4CQLPIvh7QxaIXvw5hlOHQNVB02B7/nGOzef70E/M2+CWuwlR10MqX8xVQEmfyPaq0jy6hYzYeo+ZSD+t+2abMVavJCuQgQ1jttlRUTBOBizR4m9d3RPBfbY2bjpZnv0EjNSCQC5WIs0mVzUUG+y5iTyGQFJ+AUGWwL3arWVTUJmU8IMPP71tZ2VcyYK9jZfXlNnaJAAvcnH47EVyYRtIRRvSvUY=; 20:+PA2+wxqr3f0gXaNng3eKRGJad9OqrDnNwnTx23boPpLO/oKEkE5U/urisCrFkT06p76Lwn8fnTiHr3gOONhimvbwQtuEyH9rD3pGBhzHNWq3c5LQn2IcDIzTW+X9TsPSHzrDgDGl2Cnr177zgzqx5oQDxdxcdnIdPoyFENlDi5pzDGk3okvJQRB/AOmIg7O3k3oDqV14KWkHMEzBhn1/eQhx3DlaYRs8Ghl2PqRPhs2k2MyD4IFmf/jDzaz/q7o X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2016 06:38:59.2398 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR04MB1978 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: <linux-block.vger.kernel.org> X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
On Tue, Nov 22, 2016 at 03:38:49PM +0900, Damien Le Moal wrote: > A direct I/O alignment must be always checked against the device blocks size, > but the I/O offset (bio->bi_iter.bi_sector must always use 512B sector unit, and > not the actual logical block size. > > Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Ooops, yeah.. Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de> -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/block_dev.c b/fs/block_dev.c index 35cc494..e49fb79 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -226,7 +226,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, bio.bi_max_vecs = nr_pages; bio.bi_io_vec = vecs; bio.bi_bdev = bdev; - bio.bi_iter.bi_sector = pos >> blkbits; + bio.bi_iter.bi_sector = pos >> 9; bio.bi_private = current; bio.bi_end_io = blkdev_bio_end_io_simple; @@ -358,7 +358,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) for (;;) { bio->bi_bdev = bdev; - bio->bi_iter.bi_sector = pos >> blkbits; + bio->bi_iter.bi_sector = pos >> 9; bio->bi_private = dio; bio->bi_end_io = blkdev_bio_end_io;
A direct I/O alignment must be always checked against the device blocks size, but the I/O offset (bio->bi_iter.bi_sector must always use 512B sector unit, and not the actual logical block size. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> --- fs/block_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)