Copied, thanks for the advice Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> 于2025年8月8日周五 09:27写道: > > Hi, > > 在 2025/08/07 20:57, chen cheng 写道: > > if (test_bit(WriteErrorSeen, &rdev->flags)) { > > ... > > if (is_bad && first_bad <= r1_bio->sector) { > > bad_sectors -= (r1_bio->sector - first_bad); > > if (bad_sectors < max_sectors) > > max_sectors = bad_sectors; > > rdev_dec_pending(rdev, mddev); > > continue; > > } > > > > ... > > } > > > > > > When the condition "is_bad && first_bad <= r1_bio->sector" is true, > > this rdev device will be skipped and will no participate in io, so I > > think the following code snippet is unnecessary: > > > > bad_sectors -= (r1_bio->sector - first_bad); > > if (bad_sectors < max_sectors) > > max_sectors = bad_sectors; > > > > So I am confused why we need to update max_sectors in this case? > > > > . > > > > Becase other good rdevs still have to hanlde this IO, and this IO must > to be splited to bypass badblock regions. > > However, please notice maillist is exclusively for active kernel > development like patch submit and review, bug reports and discussion. > It is encouraged to discuss if you understand implemantaion details and > figure out something is wrong or can be improved, but it is not > appropriate for implementation specific question like this. > > Thanks, > Kuai >