On Sun, Aug 17, 2025 at 11:26:45PM +0800, colyli@xxxxxxxxxx wrote: > This patch introduces bio_split_by_io_opt() to solve the above issue, > 1, If the incoming bio is not limits.io_opt aligned, split the non- > aligned head part. Then the next one will be aligned. > 2, If the imcoming bio is limits.io_opt aligned, and split is necessary, > then try to split a by multiple of limits.io_opt but not exceed > limits.max_hw_sectors. > > Then for large bio, the sligned split part will be full-stripes covered > to all data disks, no extra read-in I/Os when rmw_level is 0. And for > rmw_level > 0 condistions, the limits.io_opt aligned bios are welcomed > for performace as well. > > This patch only tests on 8 disks raid5 array with 64KiB chunk size. > By this patch, 64KiB chunk size for a 8 disks raid5 array, sequential > write performance increases from 900MiB/s to 1.1GiB/s by fio bs=10M. > If fio bs=488K (exact limits.io_opt size) the peak sequential write > throughput can reach 1.51GiB/s. All this code duplication seems like a bad idea. What is the problem with setting max_hw_sectors to a stripe size aligned value and then letting bio_split_by_io_opt do the work?