diff options
author | Omar Sandoval <osandov@fb.com> | 2020-04-16 14:46:23 -0700 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-05-25 11:25:26 +0200 |
commit | fd9d6670edba68cedd87b3db04cbdcdfc492cc0a (patch) | |
tree | 10e27b4861ba655c6f6dc2f805fceb55baf4a284 /fs/btrfs/disk-io.c | |
parent | 769b4f2497bdb31cd2c7b53d171bc7c13ef4e793 (diff) |
btrfs: simplify direct I/O read repair
Direct I/O read repair was originally implemented in commit 8b110e393c5a
("Btrfs: implement repair function when direct read fails"). This
implementation is unnecessarily complicated. 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.
Additionally, these functions are very hard to follow due to their
excessive use of goto.
This commit replaces the original implementation. 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 simplify the control flow. We
also no longer have to wait for each repair I/O to complete one by one.
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
0 files changed, 0 insertions, 0 deletions