Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754897AbcDYQhi (ORCPT ); Mon, 25 Apr 2016 12:37:38 -0400 Received: from mail-bl2on0059.outbound.protection.outlook.com ([65.55.169.59]:10821 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752389AbcDYQhg (ORCPT ); Mon, 25 Apr 2016 12:37:36 -0400 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; linbit.com; dkim=none (message not signed) header.d=none;linbit.com; dmarc=bestguesspass action=none header.from=sandisk.com; X-AuditID: ac160c69-5dfff70000000be7-d5-571e475dab1b Subject: Re: [Drbd-dev] [PATCH 11/30] drbd: when receiving P_TRIM, zero-out partial unaligned chunks To: Philipp Reisner , Jens Axboe , "linux-kernel@vger.kernel.org" References: <1461586077-11581-1-git-send-email-philipp.reisner@linbit.com> <1461586077-11581-12-git-send-email-philipp.reisner@linbit.com> CC: Lars Ellenberg , "drbd-dev@lists.linbit.com" From: Bart Van Assche Message-ID: <571E47C8.5010805@sandisk.com> Date: Mon, 25 Apr 2016 09:37:28 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <1461586077-11581-12-git-send-email-philipp.reisner@linbit.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGLMWRmVeSWpSXmKPExsWyRoxnkW6su1y4wZUtchb/9xxjs3h4dQWL xfzu9ywWl3fNYbN4OfMxkwOrx8Tmd+weT68cYfJoedDG5vF5k1wASxSXTUpqTmZZapG+XQJX xoK//cwF89grOuZfYGxg/MXaxcjJISFgIrF62mamLkYuDiGBuUwSJ1+tZIZwdjBKzJj1nQWm 6tyTJkaIxFJGiYWTZzKDJIQF0iRuz53PDpIQEegB6ng9HaoKy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OrF3T/GESBq6JoUrfwjbY3h6ki5 uLMCX7aUPXaNTn038cjMYEnBR78nWliyqt3ZocRSnJFoqMVcVJwIAHvOCmz+AQAA 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)(24454002)(189002)(199003)(57704003)(377454003)(11100500001)(6806005)(106466001)(87266999)(2906002)(65816999)(54356999)(76176999)(50986999)(23676002)(5008740100001)(87936001)(64126003)(5001770100001)(33656002)(2501003)(2950100001)(86362001)(65806001)(65956001)(47776003)(53416004)(15975445007)(77096005)(5003600100002)(189998001)(230700001)(1220700001)(2270400002)(19580395003)(80316001)(36756003)(81166005)(586003)(83506001)(92566002)(1096002)(4326007);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0201MB1865;H:milsmgep15.sandisk.com;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD031;1:eXv55PmDlpkHpvo9FBsu3dAcRdL+6bx0CWVqd5pEb41Pa3n81oPEDgeykvvfuJeaJxnxrtAJFNPJ0r9ED/2v0FhUpPIE5O3XRDLYPFw8qF76xMGZA9CRT5BD9iBPtIOTs4j1P2WMdhF7aP0poL+0uvUokgyWuWnl7G4ncRum/fjeViIp9m0SYRSel64/9j92wqrJluSqtpLqcsD48Z0iRk5xusvi9/DvpIT4ziSsGSxG4YMwj+Vul0AEojZ25nlR8n+ASxsDhiLCcqIX/CzJwVjno7JEKuQ73K9EIPiP40x9KG9GHeUycRmk75z0Ecq9ffT7GhCCOrTp1yRo5XhlzkJYqq49E/hk0syookZnCDi544w0L8QFHlXKjzto0oXQA9+LW8m6LkXvJlUS968hUEY4nIm7ernrChAwJgvIIPDfkKlih6xV0G24BkOBdjmf X-MS-Office365-Filtering-Correlation-Id: 34f55d5d-d8f4-4610-ac4b-08d36d27e555 X-Microsoft-Exchange-Diagnost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s6hjrL983z47Fy6vDt0UPExysp4l4Ed/gDrb/58+EHsDZI6Irlk23oL9/Pz/pOzKmGcbna5mL0tXMOEsJvo4RqEpZHy9v7gOw59EVRsamLG+jYS/Dj+f4Jeevv5pmDMmnwJygCji/b8V3FAm9D9OdZFGWzHLohK4sfIv84ADqdurq6lcmJpMWgYkcRpaAmHVdpgk0wVZFVc+wst7MtfuGUG0uAUshv/xuPBvMgOGh5XIudbQyvdIO1UEBN5So/WeTu+6V2pHUXeUoTdvGDO1muWMJIPaDnVRGgnGbyKptE9SChhiQ== X-Microsoft-Exchange-Diagnostics: 1;CY1PR0201MB1865;20:C8d9t/dv+ONgJZvYC7LGIbZMW/QQKc3zF2HjPASuIBBLq1mn8Kn9C4OKfzTh2T49G1ywrsme82poJ6ExGf2o074ZrxxM3in6DEwPYSBwLYKMTRMfJHmFC5HkZLg/DL3HBpcSY0SZxPbCyurMy8gVJgknEFwqHrEzhhhRmFuY4UZuRJHSLIg+qicCoAMwMWe0Ko+rpYYCWih01GjK6bh7Adhg39TiRHahgR4XXM0uBujns/uTYjpqgrohCMla+bv4iRHjH9NzlOGzRQdHtwTq3wvBFpHXS8BHtQm+vuzhmlDcCX5sx+ZJEV41hF6TjkrMDTCi2Sea+/h/B74u2FSCN3FZngM002oQ3PZye5hEPWfbi7w9EdrHJCu0kMPB7HTII0/+3wboB3UjjXUR5xc3d01bwG2f3yp2d/lDtm2qnPhDTfD+31ZP3j9kbCrnE+FZ4eYtsSxpRTJYqUbko0liDwtXMbrRNK85oUuwJ4GWuI0sK88ohGWNLUwtBN3+Y4EN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521026)(601004)(2401047)(13016025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026);SRVR:CY1PR0201MB1865;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0201MB1865; X-Microsoft-Exchange-Diagnostics: 1;C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Ci0qGg0ISp SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2016 16:37:30.2661 (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: CY1PR0201MB1865 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 897 Lines: 27 On 04/25/2016 05:13 AM, Philipp Reisner wrote: > + while (nr_sectors >= granularity) { > + nr = min_t(sector_t, nr_sectors, max_discard_sectors); > + err |= blkdev_issue_discard(bdev, start, nr, GFP_NOIO, 0); > + nr_sectors -= nr; > + start += nr; > + } Hello Phil, In blk_bio_discard_split() the following statement protects against block drivers for which max_discard_sectors is not a multiple of the discard granularity: max_discard_sectors -= max_discard_sectors % granularity; Do we need something similar in the above loop? To Jens: should the drbd_issue_discard_or_zero_out() function go upstream or should rather what this function does be integrated in blkdev_issue_zeroout() as is done by the patch series "[PATCH v2 0/6] Make blkdev_issue_discard() submit aligned discard requests" (http://thread.gmane.org/gmane.linux.kernel.device-mapper.devel/23801)? Thanks, Bart.