On Tue, Feb 27, 2024 at 4:09 AM Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> wrote: > > From: Yu Kuai <yukuai3@xxxxxxxxxx> > > Changes in v2: > - add new conter in conf for patch 2; > - fix the case choose next idle while there is no other idle disk in > patch 3; > - add some review tag from Xiao Ni for patch 1, 4-8 > > The original idea is that Paul want to optimize raid1 read > performance([1]), however, we think that the original code for > read_balance() is quite complex, and we don't want to add more > complexity. Hence we decide to refactor read_balance() first, to make > code cleaner and easier for follow up. > > Before this patchset, read_balance() has many local variables and many > branches, it want to consider all the scenarios in one iteration. The > idea of this patch is to divide them into 4 different steps: > > 1) If resync is in progress, find the first usable disk, patch 5; > Otherwise: > 2) Loop through all disks and skipping slow disks and disks with bad > blocks, choose the best disk, patch 10. If no disk is found: > 3) Look for disks with bad blocks and choose the one with most number of > sectors, patch 8. If no disk is found: > 4) Choose first found slow disk with no bad blocks, or slow disk with > most number of sectors, patch 7. > > Note that step 3) and step 4) are super code path, and performance > should not be considered. > > And after this patchset, we'll continue to optimize read_balance for > step 2), specifically how to choose the best rdev to read. > > [1] https://lore.kernel.org/all/20240102125115.129261-1-paul.e.luse@xxxxxxxxxxxxxxx/ v2 looks good to me. Thanks! I will give Xiao some more time to review it one more time before pushing it to md-6.9. Song