diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-11-09 13:18:00 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:58:08 -0500 |
commit | 12038a3a71ce6fabbcc2956cc8697fcbf729be57 (patch) | |
tree | 4852bf1216081f37e1cf0708660dcde92a458ec3 /drivers/block/drbd/drbd_main.c | |
parent | 1d2783d532207531ba8e3bfb016a4512dec97666 (diff) |
drbd: Move list of epochs from mdev to tconn
This is necessary since the transfer_log on the sending is also
per tconn.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 7b1cad895d16..8b99f4e28ccc 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -2082,7 +2082,6 @@ void drbd_init_set_defaults(struct drbd_conf *mdev) | |||
2082 | 2082 | ||
2083 | spin_lock_init(&mdev->al_lock); | 2083 | spin_lock_init(&mdev->al_lock); |
2084 | spin_lock_init(&mdev->peer_seq_lock); | 2084 | spin_lock_init(&mdev->peer_seq_lock); |
2085 | spin_lock_init(&mdev->epoch_lock); | ||
2086 | 2085 | ||
2087 | INIT_LIST_HEAD(&mdev->active_ee); | 2086 | INIT_LIST_HEAD(&mdev->active_ee); |
2088 | INIT_LIST_HEAD(&mdev->sync_ee); | 2087 | INIT_LIST_HEAD(&mdev->sync_ee); |
@@ -2142,9 +2141,6 @@ void drbd_mdev_cleanup(struct drbd_conf *mdev) | |||
2142 | dev_err(DEV, "ASSERT FAILED: receiver t_state == %d expected 0.\n", | 2141 | dev_err(DEV, "ASSERT FAILED: receiver t_state == %d expected 0.\n", |
2143 | mdev->tconn->receiver.t_state); | 2142 | mdev->tconn->receiver.t_state); |
2144 | 2143 | ||
2145 | /* no need to lock it, I'm the only thread alive */ | ||
2146 | if (atomic_read(&mdev->current_epoch->epoch_size) != 0) | ||
2147 | dev_err(DEV, "epoch_size:%d\n", atomic_read(&mdev->current_epoch->epoch_size)); | ||
2148 | mdev->al_writ_cnt = | 2144 | mdev->al_writ_cnt = |
2149 | mdev->bm_writ_cnt = | 2145 | mdev->bm_writ_cnt = |
2150 | mdev->read_cnt = | 2146 | mdev->read_cnt = |
@@ -2377,7 +2373,6 @@ void drbd_minor_destroy(struct kref *kref) | |||
2377 | kfree(mdev->p_uuid); | 2373 | kfree(mdev->p_uuid); |
2378 | /* mdev->p_uuid = NULL; */ | 2374 | /* mdev->p_uuid = NULL; */ |
2379 | 2375 | ||
2380 | kfree(mdev->current_epoch); | ||
2381 | if (mdev->bitmap) /* should no longer be there. */ | 2376 | if (mdev->bitmap) /* should no longer be there. */ |
2382 | drbd_bm_cleanup(mdev); | 2377 | drbd_bm_cleanup(mdev); |
2383 | __free_page(mdev->md_io_page); | 2378 | __free_page(mdev->md_io_page); |
@@ -2624,6 +2619,12 @@ struct drbd_tconn *conn_create(const char *name, struct res_opts *res_opts) | |||
2624 | if (!tl_init(tconn)) | 2619 | if (!tl_init(tconn)) |
2625 | goto fail; | 2620 | goto fail; |
2626 | 2621 | ||
2622 | tconn->current_epoch = kzalloc(sizeof(struct drbd_epoch), GFP_KERNEL); | ||
2623 | if (!tconn->current_epoch) | ||
2624 | goto fail; | ||
2625 | INIT_LIST_HEAD(&tconn->current_epoch->list); | ||
2626 | tconn->epochs = 1; | ||
2627 | spin_lock_init(&tconn->epoch_lock); | ||
2627 | tconn->write_ordering = WO_bdev_flush; | 2628 | tconn->write_ordering = WO_bdev_flush; |
2628 | 2629 | ||
2629 | tconn->cstate = C_STANDALONE; | 2630 | tconn->cstate = C_STANDALONE; |
@@ -2649,6 +2650,7 @@ struct drbd_tconn *conn_create(const char *name, struct res_opts *res_opts) | |||
2649 | return tconn; | 2650 | return tconn; |
2650 | 2651 | ||
2651 | fail: | 2652 | fail: |
2653 | kfree(tconn->current_epoch); | ||
2652 | tl_cleanup(tconn); | 2654 | tl_cleanup(tconn); |
2653 | free_cpumask_var(tconn->cpu_mask); | 2655 | free_cpumask_var(tconn->cpu_mask); |
2654 | drbd_free_socket(&tconn->meta); | 2656 | drbd_free_socket(&tconn->meta); |
@@ -2663,6 +2665,10 @@ void conn_destroy(struct kref *kref) | |||
2663 | { | 2665 | { |
2664 | struct drbd_tconn *tconn = container_of(kref, struct drbd_tconn, kref); | 2666 | struct drbd_tconn *tconn = container_of(kref, struct drbd_tconn, kref); |
2665 | 2667 | ||
2668 | if (atomic_read(&tconn->current_epoch->epoch_size) != 0) | ||
2669 | conn_err(tconn, "epoch_size:%d\n", atomic_read(&tconn->current_epoch->epoch_size)); | ||
2670 | kfree(tconn->current_epoch); | ||
2671 | |||
2666 | idr_destroy(&tconn->volumes); | 2672 | idr_destroy(&tconn->volumes); |
2667 | 2673 | ||
2668 | free_cpumask_var(tconn->cpu_mask); | 2674 | free_cpumask_var(tconn->cpu_mask); |
@@ -2744,13 +2750,6 @@ enum drbd_ret_code conn_new_minor(struct drbd_tconn *tconn, unsigned int minor, | |||
2744 | mdev->read_requests = RB_ROOT; | 2750 | mdev->read_requests = RB_ROOT; |
2745 | mdev->write_requests = RB_ROOT; | 2751 | mdev->write_requests = RB_ROOT; |
2746 | 2752 | ||
2747 | mdev->current_epoch = kzalloc(sizeof(struct drbd_epoch), GFP_KERNEL); | ||
2748 | if (!mdev->current_epoch) | ||
2749 | goto out_no_epoch; | ||
2750 | |||
2751 | INIT_LIST_HEAD(&mdev->current_epoch->list); | ||
2752 | mdev->epochs = 1; | ||
2753 | |||
2754 | if (!idr_pre_get(&minors, GFP_KERNEL)) | 2753 | if (!idr_pre_get(&minors, GFP_KERNEL)) |
2755 | goto out_no_minor_idr; | 2754 | goto out_no_minor_idr; |
2756 | if (idr_get_new_above(&minors, mdev, minor, &minor_got)) | 2755 | if (idr_get_new_above(&minors, mdev, minor, &minor_got)) |
@@ -2786,8 +2785,6 @@ out_idr_remove_minor: | |||
2786 | idr_remove(&minors, minor_got); | 2785 | idr_remove(&minors, minor_got); |
2787 | synchronize_rcu(); | 2786 | synchronize_rcu(); |
2788 | out_no_minor_idr: | 2787 | out_no_minor_idr: |
2789 | kfree(mdev->current_epoch); | ||
2790 | out_no_epoch: | ||
2791 | drbd_bm_cleanup(mdev); | 2788 | drbd_bm_cleanup(mdev); |
2792 | out_no_bitmap: | 2789 | out_no_bitmap: |
2793 | __free_page(mdev->md_io_page); | 2790 | __free_page(mdev->md_io_page); |