On 3/9/20 5:32 PM, Omar Sandoval wrote:
From: Omar Sandoval <osandov@xxxxxx> Direct I/O read repair is an over-complicated mess. There is major code duplication between __btrfs_subio_endio_read() (checks checksums and handles I/O errors for files with checksums), __btrfs_correct_data_nocsum() (handles I/O errors for files without checksums), btrfs_retry_endio() (checks checksums and handles I/O errors for retries of files with checksums), and btrfs_retry_endio_nocsum() (handles I/O errors for retries of files without checksum). If it sounds like these should be one function, that's because they should. After the previous commit getting rid of orig_bio, we can reuse the same endio callback for repair I/O and the original I/O, we just need to track the file offset and original iterator in the repair bio. We can also unify the handling of files with and without checksums and replace the atrocity that was probably the inspiration for "Go To Statement Considered Harmful" with normal loops. We also no longer have to wait for each repair I/O to complete one by one. Signed-off-by: Omar Sandoval <osandov@xxxxxx>
Man that was a doozy, took me a while to realize we only ever use our ->logical for DIO.
Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx> Thanks, Josef
