Lines Matching refs:op

49 	struct plock_op *op = NULL, *iter;  in plock_lookup_waiter()  local
60 op = iter; in plock_lookup_waiter()
65 return op; in plock_lookup_waiter()
85 static void dlm_release_plock_op(struct plock_op *op) in dlm_release_plock_op() argument
87 kfree(op->data); in dlm_release_plock_op()
88 kfree(op); in dlm_release_plock_op()
91 static void send_op(struct plock_op *op) in send_op() argument
93 set_version(&op->info); in send_op()
95 list_add_tail(&op->list, &send_list); in send_op()
102 struct plock_op *op; in do_lock_cancel() local
105 op = kzalloc(sizeof(*op), GFP_NOFS); in do_lock_cancel()
106 if (!op) in do_lock_cancel()
109 op->info = *orig_info; in do_lock_cancel()
110 op->info.optype = DLM_PLOCK_OP_CANCEL; in do_lock_cancel()
111 op->info.wait = 0; in do_lock_cancel()
113 send_op(op); in do_lock_cancel()
114 wait_event(recv_wq, (op->done != 0)); in do_lock_cancel()
116 rv = op->info.rv; in do_lock_cancel()
118 dlm_release_plock_op(op); in do_lock_cancel()
127 struct plock_op *op; in dlm_posix_lock() local
134 op = kzalloc(sizeof(*op), GFP_NOFS); in dlm_posix_lock()
135 if (!op) { in dlm_posix_lock()
140 op->info.optype = DLM_PLOCK_OP_LOCK; in dlm_posix_lock()
141 op->info.pid = fl->fl_pid; in dlm_posix_lock()
142 op->info.ex = (fl->fl_type == F_WRLCK); in dlm_posix_lock()
143 op->info.wait = IS_SETLKW(cmd); in dlm_posix_lock()
144 op->info.fsid = ls->ls_global_id; in dlm_posix_lock()
145 op->info.number = number; in dlm_posix_lock()
146 op->info.start = fl->fl_start; in dlm_posix_lock()
147 op->info.end = fl->fl_end; in dlm_posix_lock()
152 dlm_release_plock_op(op); in dlm_posix_lock()
159 op->info.owner = (__u64) fl->fl_pid; in dlm_posix_lock()
166 op->data = op_data; in dlm_posix_lock()
168 send_op(op); in dlm_posix_lock()
172 op->info.owner = (__u64)(long) fl->fl_owner; in dlm_posix_lock()
175 send_op(op); in dlm_posix_lock()
177 if (op->info.wait) { in dlm_posix_lock()
178 rv = wait_event_interruptible(recv_wq, (op->done != 0)); in dlm_posix_lock()
184 if (op->done != 0) { in dlm_posix_lock()
190 rv = do_lock_cancel(&op->info); in dlm_posix_lock()
199 list_del(&op->list); in dlm_posix_lock()
213 (unsigned long long)number, op->info.pid); in dlm_posix_lock()
214 dlm_release_plock_op(op); in dlm_posix_lock()
219 wait_event(recv_wq, (op->done != 0)); in dlm_posix_lock()
224 WARN_ON(!list_empty(&op->list)); in dlm_posix_lock()
226 rv = op->info.rv; in dlm_posix_lock()
234 dlm_release_plock_op(op); in dlm_posix_lock()
242 static int dlm_plock_callback(struct plock_op *op) in dlm_plock_callback() argument
244 struct plock_async_data *op_data = op->data; in dlm_plock_callback()
251 WARN_ON(!list_empty(&op->list)); in dlm_plock_callback()
259 if (op->info.rv) { in dlm_plock_callback()
260 notify(fl, op->info.rv); in dlm_plock_callback()
276 (unsigned long long)op->info.number, file, fl); in dlm_plock_callback()
288 dlm_release_plock_op(op); in dlm_plock_callback()
296 struct plock_op *op; in dlm_posix_unlock() local
304 op = kzalloc(sizeof(*op), GFP_NOFS); in dlm_posix_unlock()
305 if (!op) { in dlm_posix_unlock()
323 op->info.optype = DLM_PLOCK_OP_UNLOCK; in dlm_posix_unlock()
324 op->info.pid = fl->fl_pid; in dlm_posix_unlock()
325 op->info.fsid = ls->ls_global_id; in dlm_posix_unlock()
326 op->info.number = number; in dlm_posix_unlock()
327 op->info.start = fl->fl_start; in dlm_posix_unlock()
328 op->info.end = fl->fl_end; in dlm_posix_unlock()
330 op->info.owner = (__u64) fl->fl_pid; in dlm_posix_unlock()
332 op->info.owner = (__u64)(long) fl->fl_owner; in dlm_posix_unlock()
335 op->info.flags |= DLM_PLOCK_FL_CLOSE; in dlm_posix_unlock()
336 send_op(op); in dlm_posix_unlock()
341 send_op(op); in dlm_posix_unlock()
342 wait_event(recv_wq, (op->done != 0)); in dlm_posix_unlock()
344 WARN_ON(!list_empty(&op->list)); in dlm_posix_unlock()
346 rv = op->info.rv; in dlm_posix_unlock()
352 dlm_release_plock_op(op); in dlm_posix_unlock()
370 struct plock_op *op; in dlm_posix_cancel() local
401 op = plock_lookup_waiter(&info); in dlm_posix_cancel()
402 if (WARN_ON_ONCE(!op)) { in dlm_posix_cancel()
408 list_del(&op->list); in dlm_posix_cancel()
410 WARN_ON(op->info.optype != DLM_PLOCK_OP_LOCK); in dlm_posix_cancel()
411 op->data->callback(op->data->fl, -EINTR); in dlm_posix_cancel()
412 dlm_release_plock_op(op); in dlm_posix_cancel()
433 struct plock_op *op; in dlm_posix_get() local
440 op = kzalloc(sizeof(*op), GFP_NOFS); in dlm_posix_get()
441 if (!op) { in dlm_posix_get()
446 op->info.optype = DLM_PLOCK_OP_GET; in dlm_posix_get()
447 op->info.pid = fl->fl_pid; in dlm_posix_get()
448 op->info.ex = (fl->fl_type == F_WRLCK); in dlm_posix_get()
449 op->info.fsid = ls->ls_global_id; in dlm_posix_get()
450 op->info.number = number; in dlm_posix_get()
451 op->info.start = fl->fl_start; in dlm_posix_get()
452 op->info.end = fl->fl_end; in dlm_posix_get()
454 op->info.owner = (__u64) fl->fl_pid; in dlm_posix_get()
456 op->info.owner = (__u64)(long) fl->fl_owner; in dlm_posix_get()
458 send_op(op); in dlm_posix_get()
459 wait_event(recv_wq, (op->done != 0)); in dlm_posix_get()
461 WARN_ON(!list_empty(&op->list)); in dlm_posix_get()
466 rv = op->info.rv; in dlm_posix_get()
473 fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK; in dlm_posix_get()
475 fl->fl_pid = op->info.pid; in dlm_posix_get()
476 if (op->info.nodeid != dlm_our_nodeid()) in dlm_posix_get()
478 fl->fl_start = op->info.start; in dlm_posix_get()
479 fl->fl_end = op->info.end; in dlm_posix_get()
483 dlm_release_plock_op(op); in dlm_posix_get()
495 struct plock_op *op = NULL; in dev_read() local
502 op = list_first_entry(&send_list, struct plock_op, list); in dev_read()
503 if (op->info.flags & DLM_PLOCK_FL_CLOSE) in dev_read()
504 list_del(&op->list); in dev_read()
506 list_move_tail(&op->list, &recv_list); in dev_read()
507 memcpy(&info, &op->info, sizeof(info)); in dev_read()
511 if (!op) in dev_read()
520 if (op->info.flags & DLM_PLOCK_FL_CLOSE) in dev_read()
521 dlm_release_plock_op(op); in dev_read()
533 struct plock_op *op = NULL, *iter; in dev_write() local
556 op = plock_lookup_waiter(&info); in dev_write()
561 op = iter; in dev_write()
567 if (op) { in dev_write()
570 WARN_ON(op->info.optype != DLM_PLOCK_OP_LOCK); in dev_write()
572 WARN_ON(op->info.number != info.number || in dev_write()
573 op->info.owner != info.owner || in dev_write()
574 op->info.optype != info.optype); in dev_write()
576 list_del_init(&op->list); in dev_write()
577 memcpy(&op->info, &info, sizeof(info)); in dev_write()
578 if (op->data) in dev_write()
581 op->done = 1; in dev_write()
585 if (op) { in dev_write()
587 dlm_plock_callback(op); in dev_write()