aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.h
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2011-07-22 09:41:52 -0400
committerJan Schmidt <list.btrfs@jan-o-sch.net>2011-09-29 07:38:42 -0400
commit4a54c8c165b66300830a67349fc7595e3fc442f7 (patch)
treefea3a5e86c2ee9304711e18b2557912166d6d52f /fs/btrfs/extent_io.h
parent2774b2ca3d49124bf1ae89e8d575b3dab4221266 (diff)
btrfs: Moved repair code from inode.c to extent_io.c
The raid-retry code in inode.c can be generalized so that it works for metadata as well. Thus, this patch moves it to extent_io.c and makes the raid-retry code a raid-repair code. Repair works that way: Whenever a read error occurs and we have more mirrors to try, note the failed mirror, and retry another. If we find a good one, check if we did note a failure earlier and if so, do not allow the read to complete until after the bad sector was written with the good data we just fetched. As we have the extent locked while reading, no one can change the data in between. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs/btrfs/extent_io.h')
-rw-r--r--fs/btrfs/extent_io.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 435d454b9926..a8e20b672922 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -68,7 +68,7 @@ struct extent_io_ops {
68 unsigned long bio_flags); 68 unsigned long bio_flags);
69 int (*readpage_io_hook)(struct page *page, u64 start, u64 end); 69 int (*readpage_io_hook)(struct page *page, u64 start, u64 end);
70 int (*readpage_io_failed_hook)(struct bio *bio, struct page *page, 70 int (*readpage_io_failed_hook)(struct bio *bio, struct page *page,
71 u64 start, u64 end, 71 u64 start, u64 end, u64 failed_mirror,
72 struct extent_state *state); 72 struct extent_state *state);
73 int (*writepage_io_failed_hook)(struct bio *bio, struct page *page, 73 int (*writepage_io_failed_hook)(struct bio *bio, struct page *page,
74 u64 start, u64 end, 74 u64 start, u64 end,
@@ -252,6 +252,8 @@ void free_extent_buffer(struct extent_buffer *eb);
252int read_extent_buffer_pages(struct extent_io_tree *tree, 252int read_extent_buffer_pages(struct extent_io_tree *tree,
253 struct extent_buffer *eb, u64 start, int wait, 253 struct extent_buffer *eb, u64 start, int wait,
254 get_extent_t *get_extent, int mirror_num); 254 get_extent_t *get_extent, int mirror_num);
255unsigned long num_extent_pages(u64 start, u64 len);
256struct page *extent_buffer_page(struct extent_buffer *eb, unsigned long i);
255 257
256static inline void extent_buffer_get(struct extent_buffer *eb) 258static inline void extent_buffer_get(struct extent_buffer *eb)
257{ 259{
@@ -301,4 +303,10 @@ int extent_clear_unlock_delalloc(struct inode *inode,
301struct bio * 303struct bio *
302btrfs_bio_alloc(struct block_device *bdev, u64 first_sector, int nr_vecs, 304btrfs_bio_alloc(struct block_device *bdev, u64 first_sector, int nr_vecs,
303 gfp_t gfp_flags); 305 gfp_t gfp_flags);
306
307struct btrfs_mapping_tree;
308
309int repair_io_failure(struct btrfs_mapping_tree *map_tree, u64 start,
310 u64 length, u64 logical, struct page *page,
311 int mirror_num);
304#endif 312#endif