Thread (48 messages) 48 messages, 5 authors, 2018-11-29

Re: [PATCH V12 03/20] block: remove the "cluster" flag

From: Omar Sandoval <osandov@osandov.com>
Date: 2018-11-26 22:12:56
Also in: dm-devel, linux-bcache, linux-block, linux-btrfs, linux-ext4, linux-fsdevel, linux-mm, linux-xfs, lkml

On Mon, Nov 26, 2018 at 10:17:03AM +0800, Ming Lei wrote:
From: Christoph Hellwig <hch@lst.de>

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 <redacted>

One comment typo below.
Signed-off-by: Christoph Hellwig <hch@lst.de>

Replace virt boundary with segment boundary limit.

Signed-off-by: Ming Lei <redacted>
---
 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]
quoted hunk ↗ jump to hunk
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".
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help