Lines Matching refs:op
61 static void dlm_release_plock_op(struct plock_op *op) in dlm_release_plock_op() argument
63 kfree(op->data); in dlm_release_plock_op()
64 kfree(op); in dlm_release_plock_op()
67 static void send_op(struct plock_op *op) in send_op() argument
69 set_version(&op->info); in send_op()
70 INIT_LIST_HEAD(&op->list); in send_op()
72 list_add_tail(&op->list, &send_list); in send_op()
85 struct plock_op *op; in do_unlock_close() local
87 op = kzalloc(sizeof(*op), GFP_NOFS); in do_unlock_close()
88 if (!op) in do_unlock_close()
91 op->info.optype = DLM_PLOCK_OP_UNLOCK; in do_unlock_close()
92 op->info.pid = info->pid; in do_unlock_close()
93 op->info.fsid = info->fsid; in do_unlock_close()
94 op->info.number = info->number; in do_unlock_close()
95 op->info.start = 0; in do_unlock_close()
96 op->info.end = OFFSET_MAX; in do_unlock_close()
97 op->info.owner = info->owner; in do_unlock_close()
99 op->info.flags |= DLM_PLOCK_FL_CLOSE; in do_unlock_close()
100 send_op(op); in do_unlock_close()
108 struct plock_op *op; in dlm_posix_lock() local
115 op = kzalloc(sizeof(*op), GFP_NOFS); in dlm_posix_lock()
116 if (!op) { in dlm_posix_lock()
121 op->info.optype = DLM_PLOCK_OP_LOCK; in dlm_posix_lock()
122 op->info.pid = fl->fl_pid; in dlm_posix_lock()
123 op->info.ex = (fl->fl_type == F_WRLCK); in dlm_posix_lock()
124 op->info.wait = IS_SETLKW(cmd); in dlm_posix_lock()
125 op->info.fsid = ls->ls_global_id; in dlm_posix_lock()
126 op->info.number = number; in dlm_posix_lock()
127 op->info.start = fl->fl_start; in dlm_posix_lock()
128 op->info.end = fl->fl_end; in dlm_posix_lock()
133 dlm_release_plock_op(op); in dlm_posix_lock()
140 op->info.owner = (__u64) fl->fl_pid; in dlm_posix_lock()
147 op->data = op_data; in dlm_posix_lock()
149 send_op(op); in dlm_posix_lock()
153 op->info.owner = (__u64)(long) fl->fl_owner; in dlm_posix_lock()
156 send_op(op); in dlm_posix_lock()
158 rv = wait_event_killable(recv_wq, (op->done != 0)); in dlm_posix_lock()
161 list_del(&op->list); in dlm_posix_lock()
165 (unsigned long long)number, op->info.pid); in dlm_posix_lock()
166 dlm_release_plock_op(op); in dlm_posix_lock()
167 do_unlock_close(&op->info); in dlm_posix_lock()
172 if (!list_empty(&op->list)) { in dlm_posix_lock()
175 list_del(&op->list); in dlm_posix_lock()
179 rv = op->info.rv; in dlm_posix_lock()
187 dlm_release_plock_op(op); in dlm_posix_lock()
195 static int dlm_plock_callback(struct plock_op *op) in dlm_plock_callback() argument
197 struct plock_async_data *op_data = op->data; in dlm_plock_callback()
205 if (!list_empty(&op->list)) { in dlm_plock_callback()
207 (unsigned long long)op->info.number); in dlm_plock_callback()
208 list_del(&op->list); in dlm_plock_callback()
218 if (op->info.rv) { in dlm_plock_callback()
219 notify(fl, op->info.rv); in dlm_plock_callback()
235 (unsigned long long)op->info.number, file, fl); in dlm_plock_callback()
247 dlm_release_plock_op(op); in dlm_plock_callback()
255 struct plock_op *op; in dlm_posix_unlock() local
263 op = kzalloc(sizeof(*op), GFP_NOFS); in dlm_posix_unlock()
264 if (!op) { in dlm_posix_unlock()
282 op->info.optype = DLM_PLOCK_OP_UNLOCK; in dlm_posix_unlock()
283 op->info.pid = fl->fl_pid; in dlm_posix_unlock()
284 op->info.fsid = ls->ls_global_id; in dlm_posix_unlock()
285 op->info.number = number; in dlm_posix_unlock()
286 op->info.start = fl->fl_start; in dlm_posix_unlock()
287 op->info.end = fl->fl_end; in dlm_posix_unlock()
289 op->info.owner = (__u64) fl->fl_pid; in dlm_posix_unlock()
291 op->info.owner = (__u64)(long) fl->fl_owner; in dlm_posix_unlock()
294 op->info.flags |= DLM_PLOCK_FL_CLOSE; in dlm_posix_unlock()
295 send_op(op); in dlm_posix_unlock()
300 send_op(op); in dlm_posix_unlock()
301 wait_event(recv_wq, (op->done != 0)); in dlm_posix_unlock()
304 if (!list_empty(&op->list)) { in dlm_posix_unlock()
307 list_del(&op->list); in dlm_posix_unlock()
311 rv = op->info.rv; in dlm_posix_unlock()
317 dlm_release_plock_op(op); in dlm_posix_unlock()
329 struct plock_op *op; in dlm_posix_get() local
336 op = kzalloc(sizeof(*op), GFP_NOFS); in dlm_posix_get()
337 if (!op) { in dlm_posix_get()
342 op->info.optype = DLM_PLOCK_OP_GET; in dlm_posix_get()
343 op->info.pid = fl->fl_pid; in dlm_posix_get()
344 op->info.ex = (fl->fl_type == F_WRLCK); in dlm_posix_get()
345 op->info.fsid = ls->ls_global_id; in dlm_posix_get()
346 op->info.number = number; in dlm_posix_get()
347 op->info.start = fl->fl_start; in dlm_posix_get()
348 op->info.end = fl->fl_end; in dlm_posix_get()
350 op->info.owner = (__u64) fl->fl_pid; in dlm_posix_get()
352 op->info.owner = (__u64)(long) fl->fl_owner; in dlm_posix_get()
354 send_op(op); in dlm_posix_get()
355 wait_event(recv_wq, (op->done != 0)); in dlm_posix_get()
358 if (!list_empty(&op->list)) { in dlm_posix_get()
361 list_del(&op->list); in dlm_posix_get()
368 rv = op->info.rv; in dlm_posix_get()
375 fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK; in dlm_posix_get()
377 fl->fl_pid = op->info.pid; in dlm_posix_get()
378 if (op->info.nodeid != dlm_our_nodeid()) in dlm_posix_get()
380 fl->fl_start = op->info.start; in dlm_posix_get()
381 fl->fl_end = op->info.end; in dlm_posix_get()
385 dlm_release_plock_op(op); in dlm_posix_get()
397 struct plock_op *op = NULL; in dev_read() local
404 op = list_entry(send_list.next, struct plock_op, list); in dev_read()
405 if (op->info.flags & DLM_PLOCK_FL_CLOSE) in dev_read()
406 list_del(&op->list); in dev_read()
408 list_move_tail(&op->list, &recv_list); in dev_read()
409 memcpy(&info, &op->info, sizeof(info)); in dev_read()
413 if (!op) in dev_read()
420 if (op->info.flags & DLM_PLOCK_FL_CLOSE) in dev_read()
421 dlm_release_plock_op(op); in dev_read()
433 struct plock_op *op = NULL, *iter; in dev_write() local
463 op = iter; in dev_write()
471 op = iter; in dev_write()
477 if (op) { in dev_write()
480 WARN_ON(op->info.optype != DLM_PLOCK_OP_LOCK); in dev_write()
482 WARN_ON(op->info.number != info.number || in dev_write()
483 op->info.owner != info.owner || in dev_write()
484 op->info.optype != info.optype); in dev_write()
486 list_del_init(&op->list); in dev_write()
487 memcpy(&op->info, &info, sizeof(info)); in dev_write()
488 if (op->data) in dev_write()
491 op->done = 1; in dev_write()
495 if (op) { in dev_write()
497 dlm_plock_callback(op); in dev_write()