diff options
author | Zhao Lei <zhaolei@cn.fujitsu.com> | 2015-08-24 09:32:06 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-11-10 22:27:10 -0500 |
commit | affe4a5ae18baa2ab67af42eb21d7d734b851819 (patch) | |
tree | 838762b328b89e199b0fdcca4adfbc1ebd732693 | |
parent | ba7cf9882bd25bed77aad7dd8865e80c7ae0070a (diff) |
btrfs: Reduce unnecessary arguments in scrub_recheck_block
We don't need pass so many arguments for recheck sblock now,
this patch cleans them.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r-- | fs/btrfs/scrub.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 3e4db4b46a7d..f8a4ca2f39b0 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -248,9 +248,8 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check); | |||
248 | static int scrub_setup_recheck_block(struct scrub_block *original_sblock, | 248 | static int scrub_setup_recheck_block(struct scrub_block *original_sblock, |
249 | struct scrub_block *sblocks_for_recheck); | 249 | struct scrub_block *sblocks_for_recheck); |
250 | static void scrub_recheck_block(struct btrfs_fs_info *fs_info, | 250 | static void scrub_recheck_block(struct btrfs_fs_info *fs_info, |
251 | struct scrub_block *sblock, int is_metadata, | 251 | struct scrub_block *sblock, |
252 | int have_csum, u8 *csum, u64 generation, | 252 | int retry_failed_mirror); |
253 | u16 csum_size, int retry_failed_mirror); | ||
254 | static void scrub_recheck_block_checksum(struct scrub_block *sblock); | 253 | static void scrub_recheck_block_checksum(struct scrub_block *sblock); |
255 | static int scrub_repair_block_from_good_copy(struct scrub_block *sblock_bad, | 254 | static int scrub_repair_block_from_good_copy(struct scrub_block *sblock_bad, |
256 | struct scrub_block *sblock_good); | 255 | struct scrub_block *sblock_good); |
@@ -885,11 +884,9 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) | |||
885 | struct btrfs_fs_info *fs_info; | 884 | struct btrfs_fs_info *fs_info; |
886 | u64 length; | 885 | u64 length; |
887 | u64 logical; | 886 | u64 logical; |
888 | u64 generation; | ||
889 | unsigned int failed_mirror_index; | 887 | unsigned int failed_mirror_index; |
890 | unsigned int is_metadata; | 888 | unsigned int is_metadata; |
891 | unsigned int have_csum; | 889 | unsigned int have_csum; |
892 | u8 *csum; | ||
893 | struct scrub_block *sblocks_for_recheck; /* holds one for each mirror */ | 890 | struct scrub_block *sblocks_for_recheck; /* holds one for each mirror */ |
894 | struct scrub_block *sblock_bad; | 891 | struct scrub_block *sblock_bad; |
895 | int ret; | 892 | int ret; |
@@ -914,13 +911,11 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) | |||
914 | } | 911 | } |
915 | length = sblock_to_check->page_count * PAGE_SIZE; | 912 | length = sblock_to_check->page_count * PAGE_SIZE; |
916 | logical = sblock_to_check->pagev[0]->logical; | 913 | logical = sblock_to_check->pagev[0]->logical; |
917 | generation = sblock_to_check->pagev[0]->generation; | ||
918 | BUG_ON(sblock_to_check->pagev[0]->mirror_num < 1); | 914 | BUG_ON(sblock_to_check->pagev[0]->mirror_num < 1); |
919 | failed_mirror_index = sblock_to_check->pagev[0]->mirror_num - 1; | 915 | failed_mirror_index = sblock_to_check->pagev[0]->mirror_num - 1; |
920 | is_metadata = !(sblock_to_check->pagev[0]->flags & | 916 | is_metadata = !(sblock_to_check->pagev[0]->flags & |
921 | BTRFS_EXTENT_FLAG_DATA); | 917 | BTRFS_EXTENT_FLAG_DATA); |
922 | have_csum = sblock_to_check->pagev[0]->have_csum; | 918 | have_csum = sblock_to_check->pagev[0]->have_csum; |
923 | csum = sblock_to_check->pagev[0]->csum; | ||
924 | dev = sblock_to_check->pagev[0]->dev; | 919 | dev = sblock_to_check->pagev[0]->dev; |
925 | 920 | ||
926 | if (sctx->is_dev_replace && !is_metadata && !have_csum) { | 921 | if (sctx->is_dev_replace && !is_metadata && !have_csum) { |
@@ -983,8 +978,7 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) | |||
983 | sblock_bad = sblocks_for_recheck + failed_mirror_index; | 978 | sblock_bad = sblocks_for_recheck + failed_mirror_index; |
984 | 979 | ||
985 | /* build and submit the bios for the failed mirror, check checksums */ | 980 | /* build and submit the bios for the failed mirror, check checksums */ |
986 | scrub_recheck_block(fs_info, sblock_bad, is_metadata, have_csum, | 981 | scrub_recheck_block(fs_info, sblock_bad, 1); |
987 | csum, generation, sctx->csum_size, 1); | ||
988 | 982 | ||
989 | if (!sblock_bad->header_error && !sblock_bad->checksum_error && | 983 | if (!sblock_bad->header_error && !sblock_bad->checksum_error && |
990 | sblock_bad->no_io_error_seen) { | 984 | sblock_bad->no_io_error_seen) { |
@@ -1097,9 +1091,7 @@ nodatasum_case: | |||
1097 | sblock_other = sblocks_for_recheck + mirror_index; | 1091 | sblock_other = sblocks_for_recheck + mirror_index; |
1098 | 1092 | ||
1099 | /* build and submit the bios, check checksums */ | 1093 | /* build and submit the bios, check checksums */ |
1100 | scrub_recheck_block(fs_info, sblock_other, is_metadata, | 1094 | scrub_recheck_block(fs_info, sblock_other, 0); |
1101 | have_csum, csum, generation, | ||
1102 | sctx->csum_size, 0); | ||
1103 | 1095 | ||
1104 | if (!sblock_other->header_error && | 1096 | if (!sblock_other->header_error && |
1105 | !sblock_other->checksum_error && | 1097 | !sblock_other->checksum_error && |
@@ -1211,9 +1203,7 @@ nodatasum_case: | |||
1211 | * is verified, but most likely the data comes out | 1203 | * is verified, but most likely the data comes out |
1212 | * of the page cache. | 1204 | * of the page cache. |
1213 | */ | 1205 | */ |
1214 | scrub_recheck_block(fs_info, sblock_bad, | 1206 | scrub_recheck_block(fs_info, sblock_bad, 1); |
1215 | is_metadata, have_csum, csum, | ||
1216 | generation, sctx->csum_size, 1); | ||
1217 | if (!sblock_bad->header_error && | 1207 | if (!sblock_bad->header_error && |
1218 | !sblock_bad->checksum_error && | 1208 | !sblock_bad->checksum_error && |
1219 | sblock_bad->no_io_error_seen) | 1209 | sblock_bad->no_io_error_seen) |
@@ -1482,9 +1472,8 @@ static int scrub_submit_raid56_bio_wait(struct btrfs_fs_info *fs_info, | |||
1482 | * the pages that are errored in the just handled mirror can be repaired. | 1472 | * the pages that are errored in the just handled mirror can be repaired. |
1483 | */ | 1473 | */ |
1484 | static void scrub_recheck_block(struct btrfs_fs_info *fs_info, | 1474 | static void scrub_recheck_block(struct btrfs_fs_info *fs_info, |
1485 | struct scrub_block *sblock, int is_metadata, | 1475 | struct scrub_block *sblock, |
1486 | int have_csum, u8 *csum, u64 generation, | 1476 | int retry_failed_mirror) |
1487 | u16 csum_size, int retry_failed_mirror) | ||
1488 | { | 1477 | { |
1489 | int page_num; | 1478 | int page_num; |
1490 | 1479 | ||
@@ -2151,9 +2140,8 @@ static void scrub_missing_raid56_worker(struct btrfs_work *work) | |||
2151 | logical = sblock->pagev[0]->logical; | 2140 | logical = sblock->pagev[0]->logical; |
2152 | dev = sblock->pagev[0]->dev; | 2141 | dev = sblock->pagev[0]->dev; |
2153 | 2142 | ||
2154 | if (sblock->no_io_error_seen) { | 2143 | if (sblock->no_io_error_seen) |
2155 | scrub_recheck_block_checksum(sblock); | 2144 | scrub_recheck_block_checksum(sblock); |
2156 | } | ||
2157 | 2145 | ||
2158 | if (!sblock->no_io_error_seen) { | 2146 | if (!sblock->no_io_error_seen) { |
2159 | spin_lock(&sctx->stat_lock); | 2147 | spin_lock(&sctx->stat_lock); |