Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964865AbcDYUcW (ORCPT ); Mon, 25 Apr 2016 16:32:22 -0400 Received: from zimbra13.linbit.com ([212.69.166.240]:50486 "EHLO zimbra13.linbit.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933411AbcDYUcV (ORCPT ); Mon, 25 Apr 2016 16:32:21 -0400 Date: Mon, 25 Apr 2016 22:32:17 +0200 From: Lars Ellenberg To: Bart Van Assche Cc: Philipp Reisner , Jens Axboe , "linux-kernel@vger.kernel.org" , "drbd-dev@lists.linbit.com" Subject: [PATCH 11/30] drbd: when receiving P_TRIM, zero-out partial unaligned chunks Message-ID: <20160425203217.GC25048@soda.linbit> Mail-Followup-To: Bart Van Assche , Philipp Reisner , Jens Axboe , "linux-kernel@vger.kernel.org" , "drbd-dev@lists.linbit.com" References: <1461586077-11581-1-git-send-email-philipp.reisner@linbit.com> <1461586077-11581-12-git-send-email-philipp.reisner@linbit.com> <571E47C8.5010805@sandisk.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <571E47C8.5010805@sandisk.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1039 Lines: 30 On Mon, Apr 25, 2016 at 09:37:28AM -0700, Bart Van Assche wrote: > 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? Right. Did not realize that was "legal". > 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, Lars