bi_vcnt checks for repair
Hi all,
btrfs_check_repairable and bio_readpage_error have somewhat odd looking check for bi_vcnt, checking on how to proceed based on that.
Does anyone remember what they actually are checking for? Depending on the exact devices merging bi_vcnt can mean quite a few different things, and we should probably check for what people actually intended to check.
The suspect for adding these checks are in Cc, although the commit history is a bit murky.
Quoted 9 lines · Christoph Hellwig
Hi all,
btrfs_check_repairableandbio_readpage_errorhave somewhat odd looking check forbi_vcnt, checking on how to proceed based on that.Does anyone remember what they actually are checking for? Depending on the exact devices merging
bi_vcntcan mean quite a few different things, and we should probably check for what people actually intended to check.
(These two guys have been silent for some time. :) )
Try to explain it a bit, the following assumes that the data that's being read has at least one copy in another device,
if a read bio contains two pages and the second one is failing on checksum check, then we get into bio_readpage_error, in which it finds this bio has two pages, so it creats a new bio (so-called validation request) which only includes the fail-on-checksum victim page and issues it with REQ_FAILFAST_DEV to read the page again in hope of passing the checksum check, if it stills fails somehow, it comes into bio_readpage_error again to do another try but along with a different copy.
Overall, this bi_vcnt is to tell whether the bio is a normal one and a validation one. If the validation bio got merged somehow, then we need to do something to prevent that from happening.
Thanks,
-liubo
Quoted 12 lines · Liu Bo
Try to explain it a bit, the following assumes that the data that's being read has at least one copy in another device,
if a read bio contains two pages and the second one is failing on checksum check, then we get into
bio_readpage_error, in which it finds this bio has two pages, so it creats a new bio (so-called validation request) which only includes the fail-on-checksum victim page and issues it withREQ_FAILFAST_DEVto read the page again in hope of passing the checksum check, if it stills fails somehow, it comes intobio_readpage_erroragain to do another try but along with a different copy.
Quoted 3 lines
Overall, this
bi_vcntis to tell whether the bio is a normal one and a validation one. If the validation bio got merged somehow, then we need to do something to prevent that from happening.
Can't we just set a different end_io handler for the two cases?