diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2014-09-12 06:43:58 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-09-17 16:38:55 -0400 |
commit | 454ff3de42872870ffc3580b69132a9ef40f5cc5 (patch) | |
tree | 12cf6ec8bcd0007f82376b37b935176d548a801b /fs | |
parent | 6c387ab20db15f2bd448f7c508e2638101b16ea1 (diff) |
Btrfs: Cleanup unused variant and argument of IO failure handlers
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/extent_io.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index dc501a9ca227..c7648f53f63d 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1981,8 +1981,7 @@ struct io_failure_record { | |||
1981 | int in_validation; | 1981 | int in_validation; |
1982 | }; | 1982 | }; |
1983 | 1983 | ||
1984 | static int free_io_failure(struct inode *inode, struct io_failure_record *rec, | 1984 | static int free_io_failure(struct inode *inode, struct io_failure_record *rec) |
1985 | int did_repair) | ||
1986 | { | 1985 | { |
1987 | int ret; | 1986 | int ret; |
1988 | int err = 0; | 1987 | int err = 0; |
@@ -2109,7 +2108,6 @@ static int clean_io_failure(u64 start, struct page *page) | |||
2109 | struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info; | 2108 | struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info; |
2110 | struct extent_state *state; | 2109 | struct extent_state *state; |
2111 | int num_copies; | 2110 | int num_copies; |
2112 | int did_repair = 0; | ||
2113 | int ret; | 2111 | int ret; |
2114 | 2112 | ||
2115 | private = 0; | 2113 | private = 0; |
@@ -2130,7 +2128,6 @@ static int clean_io_failure(u64 start, struct page *page) | |||
2130 | /* there was no real error, just free the record */ | 2128 | /* there was no real error, just free the record */ |
2131 | pr_debug("clean_io_failure: freeing dummy error at %llu\n", | 2129 | pr_debug("clean_io_failure: freeing dummy error at %llu\n", |
2132 | failrec->start); | 2130 | failrec->start); |
2133 | did_repair = 1; | ||
2134 | goto out; | 2131 | goto out; |
2135 | } | 2132 | } |
2136 | if (fs_info->sb->s_flags & MS_RDONLY) | 2133 | if (fs_info->sb->s_flags & MS_RDONLY) |
@@ -2147,19 +2144,16 @@ static int clean_io_failure(u64 start, struct page *page) | |||
2147 | num_copies = btrfs_num_copies(fs_info, failrec->logical, | 2144 | num_copies = btrfs_num_copies(fs_info, failrec->logical, |
2148 | failrec->len); | 2145 | failrec->len); |
2149 | if (num_copies > 1) { | 2146 | if (num_copies > 1) { |
2150 | ret = repair_io_failure(fs_info, start, failrec->len, | 2147 | repair_io_failure(fs_info, start, failrec->len, |
2151 | failrec->logical, page, | 2148 | failrec->logical, page, |
2152 | failrec->failed_mirror); | 2149 | failrec->failed_mirror); |
2153 | did_repair = !ret; | ||
2154 | } | 2150 | } |
2155 | ret = 0; | ||
2156 | } | 2151 | } |
2157 | 2152 | ||
2158 | out: | 2153 | out: |
2159 | if (!ret) | 2154 | free_io_failure(inode, failrec); |
2160 | ret = free_io_failure(inode, failrec, did_repair); | ||
2161 | 2155 | ||
2162 | return ret; | 2156 | return 0; |
2163 | } | 2157 | } |
2164 | 2158 | ||
2165 | /* | 2159 | /* |
@@ -2269,7 +2263,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, | |||
2269 | */ | 2263 | */ |
2270 | pr_debug("bio_readpage_error: cannot repair, num_copies=%d, next_mirror %d, failed_mirror %d\n", | 2264 | pr_debug("bio_readpage_error: cannot repair, num_copies=%d, next_mirror %d, failed_mirror %d\n", |
2271 | num_copies, failrec->this_mirror, failed_mirror); | 2265 | num_copies, failrec->this_mirror, failed_mirror); |
2272 | free_io_failure(inode, failrec, 0); | 2266 | free_io_failure(inode, failrec); |
2273 | return -EIO; | 2267 | return -EIO; |
2274 | } | 2268 | } |
2275 | 2269 | ||
@@ -2312,13 +2306,13 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, | |||
2312 | if (failrec->this_mirror > num_copies) { | 2306 | if (failrec->this_mirror > num_copies) { |
2313 | pr_debug("bio_readpage_error: (fail) num_copies=%d, next_mirror %d, failed_mirror %d\n", | 2307 | pr_debug("bio_readpage_error: (fail) num_copies=%d, next_mirror %d, failed_mirror %d\n", |
2314 | num_copies, failrec->this_mirror, failed_mirror); | 2308 | num_copies, failrec->this_mirror, failed_mirror); |
2315 | free_io_failure(inode, failrec, 0); | 2309 | free_io_failure(inode, failrec); |
2316 | return -EIO; | 2310 | return -EIO; |
2317 | } | 2311 | } |
2318 | 2312 | ||
2319 | bio = btrfs_io_bio_alloc(GFP_NOFS, 1); | 2313 | bio = btrfs_io_bio_alloc(GFP_NOFS, 1); |
2320 | if (!bio) { | 2314 | if (!bio) { |
2321 | free_io_failure(inode, failrec, 0); | 2315 | free_io_failure(inode, failrec); |
2322 | return -EIO; | 2316 | return -EIO; |
2323 | } | 2317 | } |
2324 | bio->bi_end_io = failed_bio->bi_end_io; | 2318 | bio->bi_end_io = failed_bio->bi_end_io; |
@@ -2349,7 +2343,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, | |||
2349 | failrec->this_mirror, | 2343 | failrec->this_mirror, |
2350 | failrec->bio_flags, 0); | 2344 | failrec->bio_flags, 0); |
2351 | if (ret) { | 2345 | if (ret) { |
2352 | free_io_failure(inode, failrec, 0); | 2346 | free_io_failure(inode, failrec); |
2353 | bio_put(bio); | 2347 | bio_put(bio); |
2354 | } | 2348 | } |
2355 | 2349 | ||