Return-Path: Received: from mail-pg1-f196.google.com ([209.85.215.196]:45907 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726511AbeK0JIe (ORCPT ); Tue, 27 Nov 2018 04:08:34 -0500 Received: by mail-pg1-f196.google.com with SMTP id y4so6807201pgc.12 for ; Mon, 26 Nov 2018 14:12:59 -0800 (PST) Date: Mon, 26 Nov 2018 14:12:56 -0800 From: Omar Sandoval To: Ming Lei Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o , Omar Sandoval , Sagi Grimberg , Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, Shaohua Li , linux-raid@vger.kernel.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , Christoph Hellwig , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: Re: [PATCH V12 03/20] block: remove the "cluster" flag Message-ID: <20181126221256.GD30411@vader> References: <20181126021720.19471-1-ming.lei@redhat.com> <20181126021720.19471-4-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181126021720.19471-4-ming.lei@redhat.com> Sender: linux-ext4-owner@vger.kernel.org List-ID: On Mon, Nov 26, 2018 at 10:17:03AM +0800, Ming Lei wrote: > From: Christoph Hellwig > > The cluster flag implements some very old SCSI behavior. As far as I > can tell the original intent was to enable or disable any kind of > segment merging. But the actually visible effect to the LLDD is that > it limits each segments to be inside a single page, which we can > also affect by setting the maximum segment size and the segment > boundary. Reviewed-by: Omar Sandoval One comment typo below. > Signed-off-by: Christoph Hellwig > > Replace virt boundary with segment boundary limit. > > Signed-off-by: Ming Lei > --- > block/blk-merge.c | 20 ++++++++------------ > block/blk-settings.c | 3 --- > block/blk-sysfs.c | 5 +---- > drivers/scsi/scsi_lib.c | 20 ++++++++++++++++---- > include/linux/blkdev.h | 6 ------ > 5 files changed, 25 insertions(+), 29 deletions(-) > [snip] > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > index 0df15cb738d2..78d6d05992b0 100644 > --- a/drivers/scsi/scsi_lib.c > +++ b/drivers/scsi/scsi_lib.c > @@ -1810,6 +1810,8 @@ static int scsi_map_queues(struct blk_mq_tag_set *set) > void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) > { > struct device *dev = shost->dma_dev; > + unsigned max_segment_size = dma_get_max_seg_size(dev); > + unsigned long segment_boundary = shost->dma_boundary; > > /* > * this limit is imposed by hardware restrictions > @@ -1828,13 +1830,23 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) > blk_queue_max_hw_sectors(q, shost->max_sectors); > if (shost->unchecked_isa_dma) > blk_queue_bounce_limit(q, BLK_BOUNCE_ISA); > - blk_queue_segment_boundary(q, shost->dma_boundary); > dma_set_seg_boundary(dev, shost->dma_boundary); > > - blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); > + /* > + * Clustering is a really old concept from the stone age of Linux > + * SCSI support. But the basic idea is that we never give the > + * driver a segment that spans multiple pages. For that we need > + * to limit the segment size, and set the segment boundary so that > + * we never merge a second segment which is no page aligned. Typo, "which is not page aligned".