• Home
  • Raw
  • Download

Lines Matching refs:req

498 	struct ceph_mon_generic_request *req =  in DEFINE_RB_FUNCS()  local
501 dout("%s greq %p request %p reply %p\n", __func__, req, req->request, in DEFINE_RB_FUNCS()
502 req->reply); in DEFINE_RB_FUNCS()
503 WARN_ON(!RB_EMPTY_NODE(&req->node)); in DEFINE_RB_FUNCS()
505 if (req->reply) in DEFINE_RB_FUNCS()
506 ceph_msg_put(req->reply); in DEFINE_RB_FUNCS()
507 if (req->request) in DEFINE_RB_FUNCS()
508 ceph_msg_put(req->request); in DEFINE_RB_FUNCS()
510 kfree(req); in DEFINE_RB_FUNCS()
513 static void put_generic_request(struct ceph_mon_generic_request *req) in put_generic_request() argument
515 if (req) in put_generic_request()
516 kref_put(&req->kref, release_generic_request); in put_generic_request()
519 static void get_generic_request(struct ceph_mon_generic_request *req) in get_generic_request() argument
521 kref_get(&req->kref); in get_generic_request()
527 struct ceph_mon_generic_request *req; in alloc_generic_request() local
529 req = kzalloc(sizeof(*req), gfp); in alloc_generic_request()
530 if (!req) in alloc_generic_request()
533 req->monc = monc; in alloc_generic_request()
534 kref_init(&req->kref); in alloc_generic_request()
535 RB_CLEAR_NODE(&req->node); in alloc_generic_request()
536 init_completion(&req->completion); in alloc_generic_request()
538 dout("%s greq %p\n", __func__, req); in alloc_generic_request()
539 return req; in alloc_generic_request()
542 static void register_generic_request(struct ceph_mon_generic_request *req) in register_generic_request() argument
544 struct ceph_mon_client *monc = req->monc; in register_generic_request()
546 WARN_ON(req->tid); in register_generic_request()
548 get_generic_request(req); in register_generic_request()
549 req->tid = ++monc->last_tid; in register_generic_request()
550 insert_generic_request(&monc->generic_request_tree, req); in register_generic_request()
554 struct ceph_mon_generic_request *req) in send_generic_request() argument
556 WARN_ON(!req->tid); in send_generic_request()
558 dout("%s greq %p tid %llu\n", __func__, req, req->tid); in send_generic_request()
559 req->request->hdr.tid = cpu_to_le64(req->tid); in send_generic_request()
560 ceph_con_send(&monc->con, ceph_msg_get(req->request)); in send_generic_request()
563 static void __finish_generic_request(struct ceph_mon_generic_request *req) in __finish_generic_request() argument
565 struct ceph_mon_client *monc = req->monc; in __finish_generic_request()
567 dout("%s greq %p tid %llu\n", __func__, req, req->tid); in __finish_generic_request()
568 erase_generic_request(&monc->generic_request_tree, req); in __finish_generic_request()
570 ceph_msg_revoke(req->request); in __finish_generic_request()
571 ceph_msg_revoke_incoming(req->reply); in __finish_generic_request()
574 static void finish_generic_request(struct ceph_mon_generic_request *req) in finish_generic_request() argument
576 __finish_generic_request(req); in finish_generic_request()
577 put_generic_request(req); in finish_generic_request()
580 static void complete_generic_request(struct ceph_mon_generic_request *req) in complete_generic_request() argument
582 if (req->complete_cb) in complete_generic_request()
583 req->complete_cb(req); in complete_generic_request()
585 complete_all(&req->completion); in complete_generic_request()
586 put_generic_request(req); in complete_generic_request()
589 static void cancel_generic_request(struct ceph_mon_generic_request *req) in cancel_generic_request() argument
591 struct ceph_mon_client *monc = req->monc; in cancel_generic_request()
594 dout("%s greq %p tid %llu\n", __func__, req, req->tid); in cancel_generic_request()
598 req->tid); in cancel_generic_request()
600 WARN_ON(lookup_req != req); in cancel_generic_request()
601 finish_generic_request(req); in cancel_generic_request()
607 static int wait_generic_request(struct ceph_mon_generic_request *req) in wait_generic_request() argument
611 dout("%s greq %p tid %llu\n", __func__, req, req->tid); in wait_generic_request()
612 ret = wait_for_completion_interruptible(&req->completion); in wait_generic_request()
614 cancel_generic_request(req); in wait_generic_request()
616 ret = req->result; /* completed */ in wait_generic_request()
626 struct ceph_mon_generic_request *req; in get_generic_reply() local
631 req = lookup_generic_request(&monc->generic_request_tree, tid); in get_generic_reply()
632 if (!req) { in get_generic_reply()
637 dout("get_generic_reply %lld got %p\n", tid, req->reply); in get_generic_reply()
639 m = ceph_msg_get(req->reply); in get_generic_reply()
656 struct ceph_mon_generic_request *req; in handle_statfs_reply() local
666 req = lookup_generic_request(&monc->generic_request_tree, tid); in handle_statfs_reply()
667 if (!req) { in handle_statfs_reply()
672 req->result = 0; in handle_statfs_reply()
673 *req->u.st = reply->st; /* struct */ in handle_statfs_reply()
674 __finish_generic_request(req); in handle_statfs_reply()
677 complete_generic_request(req); in handle_statfs_reply()
691 struct ceph_mon_generic_request *req; in ceph_monc_do_statfs() local
695 req = alloc_generic_request(monc, GFP_NOFS); in ceph_monc_do_statfs()
696 if (!req) in ceph_monc_do_statfs()
699 req->request = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), GFP_NOFS, in ceph_monc_do_statfs()
701 if (!req->request) in ceph_monc_do_statfs()
704 req->reply = ceph_msg_new(CEPH_MSG_STATFS_REPLY, 64, GFP_NOFS, true); in ceph_monc_do_statfs()
705 if (!req->reply) in ceph_monc_do_statfs()
708 req->u.st = buf; in ceph_monc_do_statfs()
709 req->request->hdr.version = cpu_to_le16(2); in ceph_monc_do_statfs()
712 register_generic_request(req); in ceph_monc_do_statfs()
714 h = req->request->front.iov_base; in ceph_monc_do_statfs()
721 send_generic_request(monc, req); in ceph_monc_do_statfs()
724 ret = wait_generic_request(req); in ceph_monc_do_statfs()
726 put_generic_request(req); in ceph_monc_do_statfs()
734 struct ceph_mon_generic_request *req; in handle_get_version_reply() local
748 req = lookup_generic_request(&monc->generic_request_tree, handle); in handle_get_version_reply()
749 if (!req) { in handle_get_version_reply()
754 req->result = 0; in handle_get_version_reply()
755 req->u.newest = ceph_decode_64(&p); in handle_get_version_reply()
756 __finish_generic_request(req); in handle_get_version_reply()
759 complete_generic_request(req); in handle_get_version_reply()
771 struct ceph_mon_generic_request *req; in __ceph_monc_get_version() local
773 req = alloc_generic_request(monc, GFP_NOIO); in __ceph_monc_get_version()
774 if (!req) in __ceph_monc_get_version()
777 req->request = ceph_msg_new(CEPH_MSG_MON_GET_VERSION, in __ceph_monc_get_version()
780 if (!req->request) in __ceph_monc_get_version()
783 req->reply = ceph_msg_new(CEPH_MSG_MON_GET_VERSION_REPLY, 32, GFP_NOIO, in __ceph_monc_get_version()
785 if (!req->reply) in __ceph_monc_get_version()
788 req->complete_cb = cb; in __ceph_monc_get_version()
789 req->private_data = private_data; in __ceph_monc_get_version()
792 register_generic_request(req); in __ceph_monc_get_version()
794 void *p = req->request->front.iov_base; in __ceph_monc_get_version()
795 void *const end = p + req->request->front_alloc_len; in __ceph_monc_get_version()
797 ceph_encode_64(&p, req->tid); /* handle */ in __ceph_monc_get_version()
801 send_generic_request(monc, req); in __ceph_monc_get_version()
804 return req; in __ceph_monc_get_version()
807 put_generic_request(req); in __ceph_monc_get_version()
819 struct ceph_mon_generic_request *req; in ceph_monc_get_version() local
822 req = __ceph_monc_get_version(monc, what, NULL, 0); in ceph_monc_get_version()
823 if (IS_ERR(req)) in ceph_monc_get_version()
824 return PTR_ERR(req); in ceph_monc_get_version()
826 ret = wait_generic_request(req); in ceph_monc_get_version()
828 *newest = req->u.newest; in ceph_monc_get_version()
830 put_generic_request(req); in ceph_monc_get_version()
843 struct ceph_mon_generic_request *req; in ceph_monc_get_version_async() local
845 req = __ceph_monc_get_version(monc, what, cb, private_data); in ceph_monc_get_version_async()
846 if (IS_ERR(req)) in ceph_monc_get_version_async()
847 return PTR_ERR(req); in ceph_monc_get_version_async()
849 put_generic_request(req); in ceph_monc_get_version_async()
857 struct ceph_mon_generic_request *req; in handle_command_ack() local
869 req = lookup_generic_request(&monc->generic_request_tree, tid); in handle_command_ack()
870 if (!req) { in handle_command_ack()
875 req->result = ceph_decode_32(&p); in handle_command_ack()
876 __finish_generic_request(req); in handle_command_ack()
879 complete_generic_request(req); in handle_command_ack()
890 struct ceph_mon_generic_request *req; in ceph_monc_blacklist_add() local
895 req = alloc_generic_request(monc, GFP_NOIO); in ceph_monc_blacklist_add()
896 if (!req) in ceph_monc_blacklist_add()
899 req->request = ceph_msg_new(CEPH_MSG_MON_COMMAND, 256, GFP_NOIO, true); in ceph_monc_blacklist_add()
900 if (!req->request) in ceph_monc_blacklist_add()
903 req->reply = ceph_msg_new(CEPH_MSG_MON_COMMAND_ACK, 512, GFP_NOIO, in ceph_monc_blacklist_add()
905 if (!req->reply) in ceph_monc_blacklist_add()
909 register_generic_request(req); in ceph_monc_blacklist_add()
910 h = req->request->front.iov_base; in ceph_monc_blacklist_add()
921 send_generic_request(monc, req); in ceph_monc_blacklist_add()
924 ret = wait_generic_request(req); in ceph_monc_blacklist_add()
935 put_generic_request(req); in ceph_monc_blacklist_add()
945 struct ceph_mon_generic_request *req; in __resend_generic_request() local
949 req = rb_entry(p, struct ceph_mon_generic_request, node); in __resend_generic_request()
950 ceph_msg_revoke(req->request); in __resend_generic_request()
951 ceph_msg_revoke_incoming(req->reply); in __resend_generic_request()
952 ceph_con_send(&monc->con, ceph_msg_get(req->request)); in __resend_generic_request()