提交 f337bd74 编写于 作者: O Omar Sandoval 提交者: David Sterba

btrfs: don't do repair validation for checksum errors

The purpose of the validation step is to distinguish between good and
bad sectors in a failed multi-sector read. If a multi-sector read
succeeded but some of those sectors had checksum errors, we don't need
to validate anything; we know the sectors with bad checksums need to be
repaired.
Reviewed-by: NJosef Bacik <josef@toxicpanda.com>
Reviewed-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: NOmar Sandoval <osandov@fb.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 c7333972
......@@ -2640,6 +2640,14 @@ static bool btrfs_io_needs_validation(struct inode *inode, struct bio *bio)
u64 len = 0;
int i;
/*
* If bi_status is BLK_STS_OK, then this was a checksum error, not an
* I/O error. In this case, we already know exactly which sector was
* bad, so we don't need to validate.
*/
if (bio->bi_status == BLK_STS_OK)
return false;
/*
* We need to validate each sector individually if the failed I/O was
* for multiple sectors.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册