]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: implement repair function when direct read fails
authorMiao Xie <miaox@cn.fujitsu.com>
Fri, 12 Sep 2014 10:44:03 +0000 (18:44 +0800)
committerChris Mason <clm@fb.com>
Wed, 17 Sep 2014 20:39:01 +0000 (13:39 -0700)
commit8d5ac818581aca85ff362d300a7da1a4a9c829c3
tree36f6b0048c79fd63c55892cd45f0b78e8c0cc15b
parentf4f42172a2d484a513e219df4333e3c9b1642a79
Btrfs: implement repair function when direct read fails

This patch implement data repair function when direct read fails.

The detail of the implementation is:
- When we find the data is not right, we try to read the data from the other
  mirror.
- When the io on the mirror ends, we will insert the endio work into the
  dedicated btrfs workqueue, not common read endio workqueue, because the
  original endio work is still blocked in the btrfs endio workqueue, if we
  insert the endio work of the io on the mirror into that workqueue, deadlock
  would happen.
- After we get right data, we write it back to the corrupted mirror.
- And if the data on the new mirror is still corrupted, we will try next
  mirror until we read right data or all the mirrors are traversed.
- After the above work, we set the uptodate flag according to the result.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/async-thread.c
fs/btrfs/async-thread.h
fs/btrfs/btrfs_inode.h
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/inode.c