Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] dm: log: rename complete_resync_work

The complete_resync_work function only provides the ability to change an
out-of-sync region to in-sync. This patch enhances the function to allow us
to change the status from in-sync to out-of-sync as well, something that is
needed when a mirror write to one of the devices or an initial resync on a
given region fails.

Signed-off-by: Jonathan E Brassow <jbrassow@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Jonathan E Brassow and committed by
Linus Torvalds
f3ee6b2f 31c93a0c

+26 -16
+9 -6
drivers/md/dm-log.c
··· 549 549 return 1; 550 550 } 551 551 552 - static void core_complete_resync_work(struct dirty_log *log, region_t region, 553 - int success) 552 + static void core_set_region_sync(struct dirty_log *log, region_t region, 553 + int in_sync) 554 554 { 555 555 struct log_c *lc = (struct log_c *) log->context; 556 556 557 557 log_clear_bit(lc, lc->recovering_bits, region); 558 - if (success) { 558 + if (in_sync) { 559 559 log_set_bit(lc, lc->sync_bits, region); 560 560 lc->sync_count++; 561 - } 561 + } else if (log_test_bit(lc->sync_bits, region)) { 562 + lc->sync_count--; 563 + log_clear_bit(lc, lc->sync_bits, region); 564 + } 562 565 } 563 566 564 567 static region_t core_get_sync_count(struct dirty_log *log) ··· 628 625 .mark_region = core_mark_region, 629 626 .clear_region = core_clear_region, 630 627 .get_resync_work = core_get_resync_work, 631 - .complete_resync_work = core_complete_resync_work, 628 + .set_region_sync = core_set_region_sync, 632 629 .get_sync_count = core_get_sync_count, 633 630 .status = core_status, 634 631 }; ··· 647 644 .mark_region = core_mark_region, 648 645 .clear_region = core_clear_region, 649 646 .get_resync_work = core_get_resync_work, 650 - .complete_resync_work = core_complete_resync_work, 647 + .set_region_sync = core_set_region_sync, 651 648 .get_sync_count = core_get_sync_count, 652 649 .status = disk_status, 653 650 };
+5 -5
drivers/md/dm-log.h
··· 90 90 int (*get_resync_work)(struct dirty_log *log, region_t *region); 91 91 92 92 /* 93 - * This notifies the log that the resync of an area has 94 - * been completed. The log should then mark this region 95 - * as CLEAN. 93 + * This notifies the log that the resync status of a region 94 + * has changed. It also clears the region from the recovering 95 + * list (if present). 96 96 */ 97 - void (*complete_resync_work)(struct dirty_log *log, 98 - region_t region, int success); 97 + void (*set_region_sync)(struct dirty_log *log, 98 + region_t region, int in_sync); 99 99 100 100 /* 101 101 * Returns the number of regions that are in sync.
+12 -5
drivers/md/dm-raid1.c
··· 344 344 } 345 345 } 346 346 347 + static void complete_resync_work(struct region *reg, int success) 348 + { 349 + struct region_hash *rh = reg->rh; 350 + 351 + rh->log->type->set_region_sync(rh->log, reg->key, success); 352 + dispatch_bios(rh->ms, &reg->delayed_bios); 353 + if (atomic_dec_and_test(&rh->recovery_in_flight)) 354 + wake_up_all(&_kmirrord_recovery_stopped); 355 + up(&rh->recovery_count); 356 + } 357 + 347 358 static void rh_update_states(struct region_hash *rh) 348 359 { 349 360 struct region *reg, *next; ··· 394 383 */ 395 384 list_for_each_entry_safe (reg, next, &recovered, list) { 396 385 rh->log->type->clear_region(rh->log, reg->key); 397 - rh->log->type->complete_resync_work(rh->log, reg->key, 1); 398 - dispatch_bios(rh->ms, &reg->delayed_bios); 399 - if (atomic_dec_and_test(&rh->recovery_in_flight)) 400 - wake_up_all(&_kmirrord_recovery_stopped); 401 - up(&rh->recovery_count); 386 + complete_resync_work(reg, 1); 402 387 mempool_free(reg, rh->region_pool); 403 388 } 404 389