linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/3] btrfs: make read time repair to be only submitted for each corrupted sector
@ 2021-05-12  4:53 Qu Wenruo
  2021-05-12  4:53 ` [PATCH v5 1/3] btrfs: make btrfs_verify_data_csum() to return a bitmap Qu Wenruo
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Qu Wenruo @ 2021-05-12  4:53 UTC (permalink / raw)
  To: linux-btrfs

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 without any extra
modification.

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.

v3:
- Fix the return value type mismatch in repair_one_sector()
  An error happens in v2 patch split, which can lead to hang when
  we can't repair the error.

v4:
- Fix a bug that end_page_read() get called twice for the same range
  This happens when the corrupted sector has no extra copy, thus
  btrfs_submit_read_repair() return -EIO, leaving both
  btrfs_submit_read_repair() and end_bio_extent_readpage() to
  call end_page_read() twice on the good copy.
  Thankfully this only affects subpage.

- Fix a bug that sectors after unrepairable corruption are not released
  Since btrfs_submit_read_repair() is responsible for the page release,
  we can no longer just error out.
  Or some ordered extent will not be able to finish.

- Remove patch "btrfs: remove the dead branch in btrfs_io_needs_validation()"
  The cleanup will break bisect, as DIO can still generate cloned bio.
  Thus remove it and let the final cleanup patch to handle everything.

- Apply the style fixes from David

v5:
- Fix a bug where we grab wrong fs_info from DIO page
  Exposed by btrfs/215.
  And for DIO case we don't need end_page_read() and extent unrelease
  call at all.

- Unexport btrfs_submit_read_repair(), export btrfs_repair_one_sector()
  Since DIO only needs to repair one sector, unexport
  btrfs_submit_read_repair() and just export btrfs_repair_one_sector().

Qu Wenruo (3):
  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 | 348 +++++++++++++++++++++----------------------
 fs/btrfs/extent_io.h |  13 +-
 fs/btrfs/inode.c     |  27 ++--
 4 files changed, 191 insertions(+), 201 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-07  8:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-12  4:53 [PATCH v5 0/3] btrfs: make read time repair to be only submitted for each corrupted sector Qu Wenruo
2021-05-12  4:53 ` [PATCH v5 1/3] btrfs: make btrfs_verify_data_csum() to return a bitmap Qu Wenruo
2021-05-12  4:53 ` [PATCH v5 2/3] btrfs: submit read time repair only for each corrupted sector Qu Wenruo
2021-06-07  8:27   ` Qu Wenruo
2021-05-12  4:53 ` [PATCH v5 3/3] btrfs: remove io_failure_record::in_validation Qu Wenruo
2021-05-12 13:57 ` [PATCH v5 0/3] btrfs: make read time repair to be only submitted for each corrupted sector David Sterba
2021-05-13 16:45 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).