On 2022-04-26 19:53, Guoqing Jiang wrote: >> +static bool stripe_ahead_of_reshape(struct mddev *mddev, struct >> r5conf *conf, >> + struct stripe_head *sh) >> +{ >> + sector_t max_sector = 0, min_sector = MaxSector; >> + bool ret = false; >> + int dd_idx; >> + >> + for (dd_idx = 0; dd_idx < sh->disks; dd_idx++) { >> + if (dd_idx == sh->pd_idx) >> + continue; >> + >> + min_sector = min(min_sector, sh->dev[dd_idx].sector); >> + max_sector = min(max_sector, sh->dev[dd_idx].sector); >> + } >> + >> + spin_lock_irq(&conf->device_lock); >> + >> + if (!range_ahead_of_reshape(mddev, min_sector, max_sector, >> + conf->reshape_progress)) >> + /* mismatch, need to try again */ >> + ret = true; > > I think we can just open code range_ahead_of_reshape. I think this way is much easier to read. GCC is much > And seems the above is not same as below original checking which compare > logical_sector with reshape_progress. Is it intentional or am I miss > something? Yes, this was intentional, the change is necessary for the next patch to ensure that all pages in a stripe are ahead of the reshape. This was not intended as just a cleanup patch. Logan