btrfs: make read time repair to be only submitted for each corrupted sector
v2 cover btrfs: make read time repair to be only submitted for each corrupted sector
Btrfs read time repair has to handle two different cases when a corruption or read failure is hit:
- The failed bio contains only one sector
Then it only need to find a good copy
- The failed bio contains several sectors
Then it needs to find which sectors really need to be repaired
But this different behaviors are not really needed, as we can teach btrfs to only submit read repair for each corrupted sector.
By this, we only need to handle the one-sector corruption case.
This not only makes the code smaller and simpler, but also benefits subpage, allow subpage case to use the same infrastructure.
For current subpage code, we hacked the read repair code to make full bvec read repair, which has less granularity compared to regular sector size.
The code is still based on subpage branch, but can be forward ported to non-subpage code basis with minor conflicts.
Changelog:
v2:
- Split the original patch
Now we have two preparation patches, then the core change. And finally a cleanup.
- Fix the uninitialize @error_bitmap when the bio read fails.
Qu Wenruo (4):
btrfs: remove the dead branch in btrfs_io_needs_validation()
btrfs: make btrfs_verify_data_csum() to return a bitmap
btrfs: submit read time repair only for each corrupted sector
btrfs: remove io_failure_record::in_validation
fs/btrfs/ctree.h | 4 +- fs/btrfs/extent_io.c | 256 +++++++++++++++++++------------------------ fs/btrfs/extent_io.h | 4 +- fs/btrfs/inode.c | 19 +++- 4 files changed, 131 insertions(+), 152 deletions(-)
Signature · 1 line
2.31.1