On 2020-08-06 20:24, Keith Busch wrote: > On Thu, Aug 06, 2020 at 06:25:50PM -0700, Bart Van Assche wrote: >> This should work better than what was mentioned in my previous email: >> >> - return sectors & (lbs - 1); >> + return sectors; > > It used to be something like that. There were some situations where it > didn't work, which brought d0e5fbb01a67e, but I think the real problem > was from mismatched queue_limits, which I think I addressed with > 5f009d3f8e668, so maybe this is okay now. Hi Keith, How about replacing your patch with the (untested) patch below? Thanks, Bart. diff --git a/block/blk-merge.c b/block/blk-merge.c index 5196dc145270..2d10fa3768a3 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -135,10 +135,9 @@ static struct bio *blk_bio_write_same_split(struct request_queue *q, /* * Return the maximum number of sectors from the start of a bio that may be * submitted as a single request to a block device. If enough sectors remain, - * align the end to the physical block size. Otherwise align the end to the - * logical block size. This approach minimizes the number of non-aligned - * requests that are submitted to a block device if the start of a bio is not - * aligned to a physical block boundary. + * align the end to the physical block size. This approach minimizes the + * number of non-aligned requests that are submitted to a block device if the + * start of a bio is not aligned to a physical block boundary. */ static inline unsigned get_max_io_size(struct request_queue *q, struct bio *bio) @@ -146,7 +145,6 @@ static inline unsigned get_max_io_size(struct request_queue *q, unsigned sectors = blk_max_size_offset(q, bio->bi_iter.bi_sector); unsigned max_sectors = sectors; unsigned pbs = queue_physical_block_size(q) >> SECTOR_SHIFT; - unsigned lbs = queue_logical_block_size(q) >> SECTOR_SHIFT; unsigned start_offset = bio->bi_iter.bi_sector & (pbs - 1); max_sectors += start_offset; @@ -154,7 +152,7 @@ static inline unsigned get_max_io_size(struct request_queue *q, if (max_sectors > start_offset) return max_sectors - start_offset; - return sectors & (lbs - 1); + return sectors; } static inline unsigned get_max_segment_size(const struct request_queue *q,