aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_main.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-02-09 05:10:24 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-09-28 04:33:14 -0400
commit6699b6553374e85785fada94ac1e8dfc5629b02e (patch)
tree78e6e9fc1bfd2dd1fa946f9ac35dbf7a43d50256 /drivers/block/drbd/drbd_main.c
parent392c8801922f51466045ece2f1f2884b8c9cd9a2 (diff)
drbd: Moved some initializing code into drbd_new_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.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 2c44cc36deed..b3f5a02cdb87 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -1801,17 +1801,9 @@ void drbd_init_set_defaults(struct drbd_conf *mdev)
1801 atomic_set(&mdev->ap_in_flight, 0); 1801 atomic_set(&mdev->ap_in_flight, 0);
1802 1802
1803 mutex_init(&mdev->md_io_mutex); 1803 mutex_init(&mdev->md_io_mutex);
1804 mutex_init(&mdev->tconn->data.mutex);
1805 mutex_init(&mdev->tconn->meta.mutex);
1806 sema_init(&mdev->tconn->data.work.s, 0);
1807 sema_init(&mdev->tconn->meta.work.s, 0);
1808 mutex_init(&mdev->state_mutex); 1804 mutex_init(&mdev->state_mutex);
1809 1805
1810 spin_lock_init(&mdev->tconn->data.work.q_lock);
1811 spin_lock_init(&mdev->tconn->meta.work.q_lock);
1812
1813 spin_lock_init(&mdev->al_lock); 1806 spin_lock_init(&mdev->al_lock);
1814 spin_lock_init(&mdev->tconn->req_lock);
1815 spin_lock_init(&mdev->peer_seq_lock); 1807 spin_lock_init(&mdev->peer_seq_lock);
1816 spin_lock_init(&mdev->epoch_lock); 1808 spin_lock_init(&mdev->epoch_lock);
1817 1809
@@ -1821,8 +1813,6 @@ void drbd_init_set_defaults(struct drbd_conf *mdev)
1821 INIT_LIST_HEAD(&mdev->read_ee); 1813 INIT_LIST_HEAD(&mdev->read_ee);
1822 INIT_LIST_HEAD(&mdev->net_ee); 1814 INIT_LIST_HEAD(&mdev->net_ee);
1823 INIT_LIST_HEAD(&mdev->resync_reads); 1815 INIT_LIST_HEAD(&mdev->resync_reads);
1824 INIT_LIST_HEAD(&mdev->tconn->data.work.q);
1825 INIT_LIST_HEAD(&mdev->tconn->meta.work.q);
1826 INIT_LIST_HEAD(&mdev->resync_work.list); 1816 INIT_LIST_HEAD(&mdev->resync_work.list);
1827 INIT_LIST_HEAD(&mdev->unplug_work.list); 1817 INIT_LIST_HEAD(&mdev->unplug_work.list);
1828 INIT_LIST_HEAD(&mdev->go_diskless.list); 1818 INIT_LIST_HEAD(&mdev->go_diskless.list);
@@ -2179,6 +2169,13 @@ out:
2179 return r; 2169 return r;
2180} 2170}
2181 2171
2172static void drbd_init_workqueue(struct drbd_work_queue* wq)
2173{
2174 sema_init(&wq->s, 0);
2175 spin_lock_init(&wq->q_lock);
2176 INIT_LIST_HEAD(&wq->q);
2177}
2178
2182struct drbd_tconn *drbd_new_tconn(char *name) 2179struct drbd_tconn *drbd_new_tconn(char *name)
2183{ 2180{
2184 struct drbd_tconn *tconn; 2181 struct drbd_tconn *tconn;
@@ -2191,10 +2188,17 @@ struct drbd_tconn *drbd_new_tconn(char *name)
2191 if (!tconn->name) 2188 if (!tconn->name)
2192 goto fail; 2189 goto fail;
2193 2190
2191 spin_lock_init(&tconn->req_lock);
2194 atomic_set(&tconn->net_cnt, 0); 2192 atomic_set(&tconn->net_cnt, 0);
2195 init_waitqueue_head(&tconn->net_cnt_wait); 2193 init_waitqueue_head(&tconn->net_cnt_wait);
2196 idr_init(&tconn->volumes); 2194 idr_init(&tconn->volumes);
2197 2195
2196 drbd_init_workqueue(&tconn->data.work);
2197 mutex_init(&tconn->data.mutex);
2198
2199 drbd_init_workqueue(&tconn->meta.work);
2200 mutex_init(&tconn->meta.mutex);
2201
2198 drbd_thread_init(tconn, &tconn->receiver, drbdd_init, "receiver"); 2202 drbd_thread_init(tconn, &tconn->receiver, drbdd_init, "receiver");
2199 drbd_thread_init(tconn, &tconn->worker, drbd_worker, "worker"); 2203 drbd_thread_init(tconn, &tconn->worker, drbd_worker, "worker");
2200 drbd_thread_init(tconn, &tconn->asender, drbd_asender, "asender"); 2204 drbd_thread_init(tconn, &tconn->asender, drbd_asender, "asender");