Re: md: In raid1_write_request(), when WriteErrorSeen and first_bad <= r1_bio->sector , why max_sectors is updated?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux