linux内核奇遇记之md源代码解读之八阵列同步二
linux内核奇遇记之md源代码解读之八阵列同步二转载请注明出处:http://blog.csdn.net/liumangxiong
在上一小节里讲到启动同步线程:
7518 wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active));7519 7520 /* tell personality that we are finished */7521 mddev->pers->sync_request(mddev, max_sectors, &skipped, 1);7522 7523 if (!test_bit(MD_RECOVERY_CHECK, &mddev->recovery) &&7524 mddev->curr_resync > 2) {7525 if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {7526 if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {7527 if (mddev->curr_resync >= mddev->recovery_cp) {7528 printk(KERN_INFO7529 "md: checkpointing %s of %s.\n",7530 desc, mdname(mddev));7531 mddev->recovery_cp =7532 mddev->curr_resync_completed;7533 }7534 } else7535 mddev->recovery_cp = MaxSector;7536 } else {7537 if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery))7538 mddev->curr_resync = MaxSector;7539 rcu_read_lock();7540 rdev_for_each_rcu(rdev, mddev)7541 if (rdev->raid_disk >= 0 &&7542 mddev->delta_disks >= 0 &&7543 !test_bit(Faulty, &rdev->flags) &&7544 !test_bit(In_sync, &rdev->flags) &&7545 rdev->recovery_offset < mddev->curr_resync)7546 rdev->recovery_offset = mddev->curr_resync;7547 rcu_read_unlock();7548 }7549 }7550 skip:7551 set_bit(MD_CHANGE_DEVS, &mddev->flags);7552 7553 if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {7554 /* We completed so min/max setting can be forgotten if used. */7555 if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))7556 mddev->resync_min = 0;7557 mddev->resync_max = MaxSector;7558 } else if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))7559 mddev->resync_min = mddev->curr_resync_completed;7560 mddev->curr_resync = 0;7561 wake_up(&resync_wait);7562 set_bit(MD_RECOVERY_DONE, &mddev->recovery);7563 md_wakeup_thread(mddev->thread);7564 return;