diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2010-10-07 09:18:08 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-10-15 04:52:42 -0400 |
commit | ac7241211ded714873e8dc6d2f7c98ae7ea2cc30 (patch) | |
tree | 9faa8e0012c9543978cc09654c9a5a3eac00057d /drivers/block | |
parent | be70e2671b95a8982ff133ebaafff6399ad393d4 (diff) |
drbd: use dynamic_dev_dbg to optionally log uuid changes
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 2e6a07e3848d..bbe3bff2cad6 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -3557,6 +3557,28 @@ int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev) | |||
3557 | return rv; | 3557 | return rv; |
3558 | } | 3558 | } |
3559 | 3559 | ||
3560 | static void debug_drbd_uuid(struct drbd_conf *mdev, enum drbd_uuid_index index) | ||
3561 | { | ||
3562 | static char *uuid_str[UI_EXTENDED_SIZE] = { | ||
3563 | [UI_CURRENT] = "CURRENT", | ||
3564 | [UI_BITMAP] = "BITMAP", | ||
3565 | [UI_HISTORY_START] = "HISTORY_START", | ||
3566 | [UI_HISTORY_END] = "HISTORY_END", | ||
3567 | [UI_SIZE] = "SIZE", | ||
3568 | [UI_FLAGS] = "FLAGS", | ||
3569 | }; | ||
3570 | |||
3571 | if (index >= UI_EXTENDED_SIZE) { | ||
3572 | dev_warn(DEV, " uuid_index >= EXTENDED_SIZE\n"); | ||
3573 | return; | ||
3574 | } | ||
3575 | |||
3576 | dynamic_dev_dbg(DEV, " uuid[%s] now %016llX\n", | ||
3577 | uuid_str[index], | ||
3578 | (unsigned long long)mdev->ldev->md.uuid[index]); | ||
3579 | } | ||
3580 | |||
3581 | |||
3560 | /** | 3582 | /** |
3561 | * drbd_md_mark_dirty() - Mark meta data super block as dirty | 3583 | * drbd_md_mark_dirty() - Mark meta data super block as dirty |
3562 | * @mdev: DRBD device. | 3584 | * @mdev: DRBD device. |
@@ -3586,8 +3608,10 @@ static void drbd_uuid_move_history(struct drbd_conf *mdev) __must_hold(local) | |||
3586 | { | 3608 | { |
3587 | int i; | 3609 | int i; |
3588 | 3610 | ||
3589 | for (i = UI_HISTORY_START; i < UI_HISTORY_END; i++) | 3611 | for (i = UI_HISTORY_START; i < UI_HISTORY_END; i++) { |
3590 | mdev->ldev->md.uuid[i+1] = mdev->ldev->md.uuid[i]; | 3612 | mdev->ldev->md.uuid[i+1] = mdev->ldev->md.uuid[i]; |
3613 | debug_drbd_uuid(mdev, i+1); | ||
3614 | } | ||
3591 | } | 3615 | } |
3592 | 3616 | ||
3593 | void _drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val) __must_hold(local) | 3617 | void _drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val) __must_hold(local) |
@@ -3602,6 +3626,7 @@ void _drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val) __must_hold(local) | |||
3602 | } | 3626 | } |
3603 | 3627 | ||
3604 | mdev->ldev->md.uuid[idx] = val; | 3628 | mdev->ldev->md.uuid[idx] = val; |
3629 | debug_drbd_uuid(mdev, idx); | ||
3605 | drbd_md_mark_dirty(mdev); | 3630 | drbd_md_mark_dirty(mdev); |
3606 | } | 3631 | } |
3607 | 3632 | ||
@@ -3611,6 +3636,7 @@ void drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val) __must_hold(local) | |||
3611 | if (mdev->ldev->md.uuid[idx]) { | 3636 | if (mdev->ldev->md.uuid[idx]) { |
3612 | drbd_uuid_move_history(mdev); | 3637 | drbd_uuid_move_history(mdev); |
3613 | mdev->ldev->md.uuid[UI_HISTORY_START] = mdev->ldev->md.uuid[idx]; | 3638 | mdev->ldev->md.uuid[UI_HISTORY_START] = mdev->ldev->md.uuid[idx]; |
3639 | debug_drbd_uuid(mdev, UI_HISTORY_START); | ||
3614 | } | 3640 | } |
3615 | _drbd_uuid_set(mdev, idx, val); | 3641 | _drbd_uuid_set(mdev, idx, val); |
3616 | } | 3642 | } |
@@ -3629,6 +3655,7 @@ void drbd_uuid_new_current(struct drbd_conf *mdev) __must_hold(local) | |||
3629 | dev_info(DEV, "Creating new current UUID\n"); | 3655 | dev_info(DEV, "Creating new current UUID\n"); |
3630 | D_ASSERT(mdev->ldev->md.uuid[UI_BITMAP] == 0); | 3656 | D_ASSERT(mdev->ldev->md.uuid[UI_BITMAP] == 0); |
3631 | mdev->ldev->md.uuid[UI_BITMAP] = mdev->ldev->md.uuid[UI_CURRENT]; | 3657 | mdev->ldev->md.uuid[UI_BITMAP] = mdev->ldev->md.uuid[UI_CURRENT]; |
3658 | debug_drbd_uuid(mdev, UI_BITMAP); | ||
3632 | 3659 | ||
3633 | get_random_bytes(&val, sizeof(u64)); | 3660 | get_random_bytes(&val, sizeof(u64)); |
3634 | _drbd_uuid_set(mdev, UI_CURRENT, val); | 3661 | _drbd_uuid_set(mdev, UI_CURRENT, val); |
@@ -3643,6 +3670,8 @@ void drbd_uuid_set_bm(struct drbd_conf *mdev, u64 val) __must_hold(local) | |||
3643 | drbd_uuid_move_history(mdev); | 3670 | drbd_uuid_move_history(mdev); |
3644 | mdev->ldev->md.uuid[UI_HISTORY_START] = mdev->ldev->md.uuid[UI_BITMAP]; | 3671 | mdev->ldev->md.uuid[UI_HISTORY_START] = mdev->ldev->md.uuid[UI_BITMAP]; |
3645 | mdev->ldev->md.uuid[UI_BITMAP] = 0; | 3672 | mdev->ldev->md.uuid[UI_BITMAP] = 0; |
3673 | debug_drbd_uuid(mdev, UI_HISTORY_START); | ||
3674 | debug_drbd_uuid(mdev, UI_BITMAP); | ||
3646 | } else { | 3675 | } else { |
3647 | if (mdev->ldev->md.uuid[UI_BITMAP]) | 3676 | if (mdev->ldev->md.uuid[UI_BITMAP]) |
3648 | dev_warn(DEV, "bm UUID already set"); | 3677 | dev_warn(DEV, "bm UUID already set"); |
@@ -3650,6 +3679,7 @@ void drbd_uuid_set_bm(struct drbd_conf *mdev, u64 val) __must_hold(local) | |||
3650 | mdev->ldev->md.uuid[UI_BITMAP] = val; | 3679 | mdev->ldev->md.uuid[UI_BITMAP] = val; |
3651 | mdev->ldev->md.uuid[UI_BITMAP] &= ~((u64)1); | 3680 | mdev->ldev->md.uuid[UI_BITMAP] &= ~((u64)1); |
3652 | 3681 | ||
3682 | debug_drbd_uuid(mdev, UI_BITMAP); | ||
3653 | } | 3683 | } |
3654 | drbd_md_mark_dirty(mdev); | 3684 | drbd_md_mark_dirty(mdev); |
3655 | } | 3685 | } |