aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorKurt Hackel <kurt.hackel@oracle.com>2006-05-01 17:39:29 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2006-06-26 17:43:18 -0400
commit3156d267016627fe427a6b0d4ed8a9678557e91e (patch)
treefec0545da2e9593d1b5a2db4dd0d7360203cee4d /fs/ocfs2
parent495ac96e638cb0ad33baa7113531d742bfb328d4 (diff)
ocfs2: move dlm work to a private work queue
The work that is done can block for long periods of time and so is not appropriate for keventd. Signed-off-by: Kurt Hackel <kurt.hackel@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/dlm/dlmcommon.h1
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c19
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c2
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c13
4 files changed, 32 insertions, 3 deletions
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
index 9bea5c6ef9bf..9bdc9cf65991 100644
--- a/fs/ocfs2/dlm/dlmcommon.h
+++ b/fs/ocfs2/dlm/dlmcommon.h
@@ -131,6 +131,7 @@ struct dlm_ctxt
131 struct o2hb_callback_func dlm_hb_down; 131 struct o2hb_callback_func dlm_hb_down;
132 struct task_struct *dlm_thread_task; 132 struct task_struct *dlm_thread_task;
133 struct task_struct *dlm_reco_thread_task; 133 struct task_struct *dlm_reco_thread_task;
134 struct workqueue_struct *dlm_worker;
134 wait_queue_head_t dlm_thread_wq; 135 wait_queue_head_t dlm_thread_wq;
135 wait_queue_head_t dlm_reco_thread_wq; 136 wait_queue_head_t dlm_reco_thread_wq;
136 wait_queue_head_t ast_wq; 137 wait_queue_head_t ast_wq;
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 3511930a34ee..c3462ea694ea 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -303,11 +303,21 @@ int dlm_domain_fully_joined(struct dlm_ctxt *dlm)
303 return ret; 303 return ret;
304} 304}
305 305
306static void dlm_destroy_dlm_worker(struct dlm_ctxt *dlm)
307{
308 if (dlm->dlm_worker) {
309 flush_workqueue(dlm->dlm_worker);
310 destroy_workqueue(dlm->dlm_worker);
311 dlm->dlm_worker = NULL;
312 }
313}
314
306static void dlm_complete_dlm_shutdown(struct dlm_ctxt *dlm) 315static void dlm_complete_dlm_shutdown(struct dlm_ctxt *dlm)
307{ 316{
308 dlm_unregister_domain_handlers(dlm); 317 dlm_unregister_domain_handlers(dlm);
309 dlm_complete_thread(dlm); 318 dlm_complete_thread(dlm);
310 dlm_complete_recovery_thread(dlm); 319 dlm_complete_recovery_thread(dlm);
320 dlm_destroy_dlm_worker(dlm);
311 321
312 /* We've left the domain. Now we can take ourselves out of the 322 /* We've left the domain. Now we can take ourselves out of the
313 * list and allow the kref stuff to help us free the 323 * list and allow the kref stuff to help us free the
@@ -1151,6 +1161,13 @@ static int dlm_join_domain(struct dlm_ctxt *dlm)
1151 goto bail; 1161 goto bail;
1152 } 1162 }
1153 1163
1164 dlm->dlm_worker = create_singlethread_workqueue("dlm_wq");
1165 if (!dlm->dlm_worker) {
1166 status = -ENOMEM;
1167 mlog_errno(status);
1168 goto bail;
1169 }
1170
1154 do { 1171 do {
1155 unsigned int backoff; 1172 unsigned int backoff;
1156 status = dlm_try_to_join_domain(dlm); 1173 status = dlm_try_to_join_domain(dlm);
@@ -1191,6 +1208,7 @@ bail:
1191 dlm_unregister_domain_handlers(dlm); 1208 dlm_unregister_domain_handlers(dlm);
1192 dlm_complete_thread(dlm); 1209 dlm_complete_thread(dlm);
1193 dlm_complete_recovery_thread(dlm); 1210 dlm_complete_recovery_thread(dlm);
1211 dlm_destroy_dlm_worker(dlm);
1194 } 1212 }
1195 1213
1196 return status; 1214 return status;
@@ -1256,6 +1274,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
1256 1274
1257 dlm->dlm_thread_task = NULL; 1275 dlm->dlm_thread_task = NULL;
1258 dlm->dlm_reco_thread_task = NULL; 1276 dlm->dlm_reco_thread_task = NULL;
1277 dlm->dlm_worker = NULL;
1259 init_waitqueue_head(&dlm->dlm_thread_wq); 1278 init_waitqueue_head(&dlm->dlm_thread_wq);
1260 init_waitqueue_head(&dlm->dlm_reco_thread_wq); 1279 init_waitqueue_head(&dlm->dlm_reco_thread_wq);
1261 init_waitqueue_head(&dlm->reco.event); 1280 init_waitqueue_head(&dlm->reco.event);
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index f186e090a10e..733d9a528873 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -1962,7 +1962,7 @@ int dlm_dispatch_assert_master(struct dlm_ctxt *dlm,
1962 list_add_tail(&item->list, &dlm->work_list); 1962 list_add_tail(&item->list, &dlm->work_list);
1963 spin_unlock(&dlm->work_lock); 1963 spin_unlock(&dlm->work_lock);
1964 1964
1965 schedule_work(&dlm->dispatched_work); 1965 queue_work(dlm->dlm_worker, &dlm->dispatched_work);
1966 return 0; 1966 return 0;
1967} 1967}
1968 1968
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index f0549e9f0024..22e6a5b69584 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -157,12 +157,21 @@ void dlm_dispatch_work(void *data)
157 struct list_head *iter, *iter2; 157 struct list_head *iter, *iter2;
158 struct dlm_work_item *item; 158 struct dlm_work_item *item;
159 dlm_workfunc_t *workfunc; 159 dlm_workfunc_t *workfunc;
160 int tot=0;
161
162 if (!dlm_joined(dlm))
163 return;
160 164
161 spin_lock(&dlm->work_lock); 165 spin_lock(&dlm->work_lock);
162 list_splice_init(&dlm->work_list, &tmp_list); 166 list_splice_init(&dlm->work_list, &tmp_list);
163 spin_unlock(&dlm->work_lock); 167 spin_unlock(&dlm->work_lock);
164 168
165 list_for_each_safe(iter, iter2, &tmp_list) { 169 list_for_each_safe(iter, iter2, &tmp_list) {
170 tot++;
171 }
172 mlog(0, "%s: work thread has %d work items\n", dlm->name, tot);
173
174 list_for_each_safe(iter, iter2, &tmp_list) {
166 item = list_entry(iter, struct dlm_work_item, list); 175 item = list_entry(iter, struct dlm_work_item, list);
167 workfunc = item->func; 176 workfunc = item->func;
168 list_del_init(&item->list); 177 list_del_init(&item->list);
@@ -851,7 +860,7 @@ int dlm_request_all_locks_handler(struct o2net_msg *msg, u32 len, void *data)
851 spin_lock(&dlm->work_lock); 860 spin_lock(&dlm->work_lock);
852 list_add_tail(&item->list, &dlm->work_list); 861 list_add_tail(&item->list, &dlm->work_list);
853 spin_unlock(&dlm->work_lock); 862 spin_unlock(&dlm->work_lock);
854 schedule_work(&dlm->dispatched_work); 863 queue_work(dlm->dlm_worker, &dlm->dispatched_work);
855 864
856 dlm_put(dlm); 865 dlm_put(dlm);
857 return 0; 866 return 0;
@@ -1401,7 +1410,7 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data)
1401 spin_lock(&dlm->work_lock); 1410 spin_lock(&dlm->work_lock);
1402 list_add_tail(&item->list, &dlm->work_list); 1411 list_add_tail(&item->list, &dlm->work_list);
1403 spin_unlock(&dlm->work_lock); 1412 spin_unlock(&dlm->work_lock);
1404 schedule_work(&dlm->dispatched_work); 1413 queue_work(dlm->dlm_worker, &dlm->dispatched_work);
1405 1414
1406leave: 1415leave:
1407 dlm_put(dlm); 1416 dlm_put(dlm);