diff options
author | Jianpeng Ma <majianpeng@gmail.com> | 2012-10-10 23:17:59 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-10-10 23:17:59 -0400 |
commit | 7f7583d420231b9d09897afd57a957011b606a5b (patch) | |
tree | aa45d88b926bfc8e22f841b9ea83d338afa4c3ae /drivers/md/md.c | |
parent | 1ed850f356a0a422013846b5291acff08815008b (diff) |
Subject: [PATCH] md:change resync_mismatches to atomic64_t to avoid races
Now that multiple threads can handle stripes, it is safer to
use an atomic64_t for resync_mismatches, to avoid update races.
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 85e6786653ea..7564c44b8045 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -4269,7 +4269,8 @@ static ssize_t | |||
4269 | mismatch_cnt_show(struct mddev *mddev, char *page) | 4269 | mismatch_cnt_show(struct mddev *mddev, char *page) |
4270 | { | 4270 | { |
4271 | return sprintf(page, "%llu\n", | 4271 | return sprintf(page, "%llu\n", |
4272 | (unsigned long long) mddev->resync_mismatches); | 4272 | (unsigned long long) |
4273 | atomic64_read(&mddev->resync_mismatches)); | ||
4273 | } | 4274 | } |
4274 | 4275 | ||
4275 | static struct md_sysfs_entry md_scan_mode = | 4276 | static struct md_sysfs_entry md_scan_mode = |
@@ -5235,7 +5236,7 @@ static void md_clean(struct mddev *mddev) | |||
5235 | mddev->new_layout = 0; | 5236 | mddev->new_layout = 0; |
5236 | mddev->new_chunk_sectors = 0; | 5237 | mddev->new_chunk_sectors = 0; |
5237 | mddev->curr_resync = 0; | 5238 | mddev->curr_resync = 0; |
5238 | mddev->resync_mismatches = 0; | 5239 | atomic64_set(&mddev->resync_mismatches, 0); |
5239 | mddev->suspend_lo = mddev->suspend_hi = 0; | 5240 | mddev->suspend_lo = mddev->suspend_hi = 0; |
5240 | mddev->sync_speed_min = mddev->sync_speed_max = 0; | 5241 | mddev->sync_speed_min = mddev->sync_speed_max = 0; |
5241 | mddev->recovery = 0; | 5242 | mddev->recovery = 0; |
@@ -7357,7 +7358,7 @@ void md_do_sync(struct md_thread *thread) | |||
7357 | * which defaults to physical size, but can be virtual size | 7358 | * which defaults to physical size, but can be virtual size |
7358 | */ | 7359 | */ |
7359 | max_sectors = mddev->resync_max_sectors; | 7360 | max_sectors = mddev->resync_max_sectors; |
7360 | mddev->resync_mismatches = 0; | 7361 | atomic64_set(&mddev->resync_mismatches, 0); |
7361 | /* we don't use the checkpoint if there's a bitmap */ | 7362 | /* we don't use the checkpoint if there's a bitmap */ |
7362 | if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) | 7363 | if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) |
7363 | j = mddev->resync_min; | 7364 | j = mddev->resync_min; |