Lines Matching refs:rqstp

567 svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node)  in svc_init_buffer()  argument
572 if (svc_is_backchannel(rqstp)) in svc_init_buffer()
586 rqstp->rq_pages[arghi++] = p; in svc_init_buffer()
596 svc_release_buffer(struct svc_rqst *rqstp) in svc_release_buffer() argument
600 for (i = 0; i < ARRAY_SIZE(rqstp->rq_pages); i++) in svc_release_buffer()
601 if (rqstp->rq_pages[i]) in svc_release_buffer()
602 put_page(rqstp->rq_pages[i]); in svc_release_buffer()
608 struct svc_rqst *rqstp; in svc_rqst_alloc() local
610 rqstp = kzalloc_node(sizeof(*rqstp), GFP_KERNEL, node); in svc_rqst_alloc()
611 if (!rqstp) in svc_rqst_alloc()
612 return rqstp; in svc_rqst_alloc()
614 __set_bit(RQ_BUSY, &rqstp->rq_flags); in svc_rqst_alloc()
615 spin_lock_init(&rqstp->rq_lock); in svc_rqst_alloc()
616 rqstp->rq_server = serv; in svc_rqst_alloc()
617 rqstp->rq_pool = pool; in svc_rqst_alloc()
619 rqstp->rq_scratch_page = alloc_pages_node(node, GFP_KERNEL, 0); in svc_rqst_alloc()
620 if (!rqstp->rq_scratch_page) in svc_rqst_alloc()
623 rqstp->rq_argp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
624 if (!rqstp->rq_argp) in svc_rqst_alloc()
627 rqstp->rq_resp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
628 if (!rqstp->rq_resp) in svc_rqst_alloc()
631 if (!svc_init_buffer(rqstp, serv->sv_max_mesg, node)) in svc_rqst_alloc()
634 return rqstp; in svc_rqst_alloc()
636 svc_rqst_free(rqstp); in svc_rqst_alloc()
644 struct svc_rqst *rqstp; in svc_prepare_thread() local
646 rqstp = svc_rqst_alloc(serv, pool, node); in svc_prepare_thread()
647 if (!rqstp) in svc_prepare_thread()
653 list_add_rcu(&rqstp->rq_all, &pool->sp_all_threads); in svc_prepare_thread()
655 return rqstp; in svc_prepare_thread()
696 struct svc_rqst *rqstp; in choose_victim() local
702 rqstp = list_entry(pool->sp_all_threads.next, struct svc_rqst, rq_all); in choose_victim()
703 set_bit(RQ_VICTIM, &rqstp->rq_flags); in choose_victim()
704 list_del_rcu(&rqstp->rq_all); in choose_victim()
705 task = rqstp->rq_task; in choose_victim()
716 struct svc_rqst *rqstp; in svc_start_kthreads() local
727 rqstp = svc_prepare_thread(serv, chosen_pool, node); in svc_start_kthreads()
728 if (IS_ERR(rqstp)) in svc_start_kthreads()
729 return PTR_ERR(rqstp); in svc_start_kthreads()
732 task = kthread_create_on_node(serv->sv_ops->svo_function, rqstp, in svc_start_kthreads()
736 svc_exit_thread(rqstp); in svc_start_kthreads()
740 rqstp->rq_task = task; in svc_start_kthreads()
851 void svc_rqst_replace_page(struct svc_rqst *rqstp, struct page *page) in svc_rqst_replace_page() argument
853 if (*rqstp->rq_next_page) { in svc_rqst_replace_page()
854 if (!pagevec_space(&rqstp->rq_pvec)) in svc_rqst_replace_page()
855 __pagevec_release(&rqstp->rq_pvec); in svc_rqst_replace_page()
856 pagevec_add(&rqstp->rq_pvec, *rqstp->rq_next_page); in svc_rqst_replace_page()
860 *(rqstp->rq_next_page++) = page; in svc_rqst_replace_page()
869 svc_rqst_free(struct svc_rqst *rqstp) in svc_rqst_free() argument
871 svc_release_buffer(rqstp); in svc_rqst_free()
872 if (rqstp->rq_scratch_page) in svc_rqst_free()
873 put_page(rqstp->rq_scratch_page); in svc_rqst_free()
874 kfree(rqstp->rq_resp); in svc_rqst_free()
875 kfree(rqstp->rq_argp); in svc_rqst_free()
876 kfree(rqstp->rq_auth_data); in svc_rqst_free()
877 kfree_rcu(rqstp, rq_rcu_head); in svc_rqst_free()
882 svc_exit_thread(struct svc_rqst *rqstp) in svc_exit_thread() argument
884 struct svc_serv *serv = rqstp->rq_server; in svc_exit_thread()
885 struct svc_pool *pool = rqstp->rq_pool; in svc_exit_thread()
889 if (!test_and_set_bit(RQ_VICTIM, &rqstp->rq_flags)) in svc_exit_thread()
890 list_del_rcu(&rqstp->rq_all); in svc_exit_thread()
893 svc_rqst_free(rqstp); in svc_exit_thread()
1170 void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) in svc_printk() argument
1181 dprintk("svc: %s: %pV", svc_print_addr(rqstp, buf, sizeof(buf)), &vaf); in svc_printk()
1186 static __printf(2,3) void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) {} in svc_printk() argument
1190 svc_generic_init_request(struct svc_rqst *rqstp, in svc_generic_init_request() argument
1197 if (rqstp->rq_vers >= progp->pg_nvers ) in svc_generic_init_request()
1199 versp = progp->pg_vers[rqstp->rq_vers]; in svc_generic_init_request()
1214 if (versp->vs_need_cong_ctrl && rqstp->rq_xprt && in svc_generic_init_request()
1215 !test_bit(XPT_CONG_CTRL, &rqstp->rq_xprt->xpt_flags)) in svc_generic_init_request()
1218 if (rqstp->rq_proc >= versp->vs_nproc) in svc_generic_init_request()
1220 rqstp->rq_procinfo = procp = &versp->vs_proc[rqstp->rq_proc]; in svc_generic_init_request()
1225 memset(rqstp->rq_argp, 0, procp->pc_argsize); in svc_generic_init_request()
1226 memset(rqstp->rq_resp, 0, procp->pc_ressize); in svc_generic_init_request()
1229 versp->vs_count[rqstp->rq_proc]++; in svc_generic_init_request()
1246 svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) in svc_process_common() argument
1250 struct svc_serv *serv = rqstp->rq_server; in svc_process_common()
1264 set_bit(RQ_SPLICE_OK, &rqstp->rq_flags); in svc_process_common()
1266 set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags); in svc_process_common()
1267 clear_bit(RQ_DROPME, &rqstp->rq_flags); in svc_process_common()
1269 svc_putu32(resv, rqstp->rq_xid); in svc_process_common()
1284 rqstp->rq_prog = prog = svc_getnl(argv); /* program number */ in svc_process_common()
1285 rqstp->rq_vers = svc_getnl(argv); /* version number */ in svc_process_common()
1286 rqstp->rq_proc = svc_getnl(argv); /* procedure number */ in svc_process_common()
1297 auth_res = svc_authenticate(rqstp); in svc_process_common()
1300 auth_res = progp->pg_authenticate(rqstp); in svc_process_common()
1302 trace_svc_authenticate(rqstp, auth_res); in svc_process_common()
1324 rpc_stat = progp->pg_init_request(rqstp, progp, &process); in svc_process_common()
1336 procp = rqstp->rq_procinfo; in svc_process_common()
1343 trace_svc_process(rqstp, progp->pg_name); in svc_process_common()
1353 svc_reserve_auth(rqstp, procp->pc_xdrressize<<2); in svc_process_common()
1356 rc = process.dispatch(rqstp, statp); in svc_process_common()
1358 procp->pc_release(rqstp); in svc_process_common()
1361 if (rqstp->rq_auth_stat != rpc_auth_ok) in svc_process_common()
1372 if (svc_authorise(rqstp)) in svc_process_common()
1377 svc_authorise(rqstp); /* doesn't hurt to call this twice */ in svc_process_common()
1382 svc_authorise(rqstp); in svc_process_common()
1384 if (rqstp->rq_xprt && test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags)) in svc_process_common()
1385 svc_close_xprt(rqstp->rq_xprt); in svc_process_common()
1390 svc_printk(rqstp, "short len %zd, dropping request\n", in svc_process_common()
1404 be32_to_cpu(rqstp->rq_auth_stat)); in svc_process_common()
1407 xdr_ressize_check(rqstp, reply_statp); in svc_process_common()
1410 svc_putu32(resv, rqstp->rq_auth_stat); /* status */ in svc_process_common()
1420 svc_printk(rqstp, "unknown version (%d for prog %d, %s)\n", in svc_process_common()
1421 rqstp->rq_vers, rqstp->rq_prog, progp->pg_name); in svc_process_common()
1430 svc_printk(rqstp, "unknown procedure (%d)\n", rqstp->rq_proc); in svc_process_common()
1437 svc_printk(rqstp, "failed to decode args\n"); in svc_process_common()
1450 svc_process(struct svc_rqst *rqstp) in svc_process() argument
1452 struct kvec *argv = &rqstp->rq_arg.head[0]; in svc_process()
1453 struct kvec *resv = &rqstp->rq_res.head[0]; in svc_process()
1454 struct svc_serv *serv = rqstp->rq_server; in svc_process()
1460 svc_xprt_deferred_close(rqstp->rq_xprt); in svc_process()
1467 rqstp->rq_next_page = &rqstp->rq_respages[1]; in svc_process()
1468 resv->iov_base = page_address(rqstp->rq_respages[0]); in svc_process()
1470 rqstp->rq_res.pages = rqstp->rq_respages + 1; in svc_process()
1471 rqstp->rq_res.len = 0; in svc_process()
1472 rqstp->rq_res.page_base = 0; in svc_process()
1473 rqstp->rq_res.page_len = 0; in svc_process()
1474 rqstp->rq_res.buflen = PAGE_SIZE; in svc_process()
1475 rqstp->rq_res.tail[0].iov_base = NULL; in svc_process()
1476 rqstp->rq_res.tail[0].iov_len = 0; in svc_process()
1481 svc_printk(rqstp, "bad direction %d, dropping request\n", dir); in svc_process()
1487 if (likely(svc_process_common(rqstp, argv, resv))) in svc_process()
1488 return svc_send(rqstp); in svc_process()
1491 svc_drop(rqstp); in svc_process()
1503 struct svc_rqst *rqstp) in bc_svc_process() argument
1505 struct kvec *argv = &rqstp->rq_arg.head[0]; in bc_svc_process()
1506 struct kvec *resv = &rqstp->rq_res.head[0]; in bc_svc_process()
1514 rqstp->rq_xid = req->rq_xid; in bc_svc_process()
1515 rqstp->rq_prot = req->rq_xprt->prot; in bc_svc_process()
1516 rqstp->rq_server = serv; in bc_svc_process()
1517 rqstp->rq_bc_net = req->rq_xprt->xprt_net; in bc_svc_process()
1519 rqstp->rq_addrlen = sizeof(req->rq_xprt->addr); in bc_svc_process()
1520 memcpy(&rqstp->rq_addr, &req->rq_xprt->addr, rqstp->rq_addrlen); in bc_svc_process()
1521 memcpy(&rqstp->rq_arg, &req->rq_rcv_buf, sizeof(rqstp->rq_arg)); in bc_svc_process()
1522 memcpy(&rqstp->rq_res, &req->rq_snd_buf, sizeof(rqstp->rq_res)); in bc_svc_process()
1525 rqstp->rq_arg.len = req->rq_private_buf.len; in bc_svc_process()
1526 if (rqstp->rq_arg.len <= rqstp->rq_arg.head[0].iov_len) { in bc_svc_process()
1527 rqstp->rq_arg.head[0].iov_len = rqstp->rq_arg.len; in bc_svc_process()
1528 rqstp->rq_arg.page_len = 0; in bc_svc_process()
1529 } else if (rqstp->rq_arg.len <= rqstp->rq_arg.head[0].iov_len + in bc_svc_process()
1530 rqstp->rq_arg.page_len) in bc_svc_process()
1531 rqstp->rq_arg.page_len = rqstp->rq_arg.len - in bc_svc_process()
1532 rqstp->rq_arg.head[0].iov_len; in bc_svc_process()
1534 rqstp->rq_arg.len = rqstp->rq_arg.head[0].iov_len + in bc_svc_process()
1535 rqstp->rq_arg.page_len; in bc_svc_process()
1548 proc_error = svc_process_common(rqstp, argv, resv); in bc_svc_process()
1558 memcpy(&req->rq_snd_buf, &rqstp->rq_res, sizeof(req->rq_snd_buf)); in bc_svc_process()
1579 u32 svc_max_payload(const struct svc_rqst *rqstp) in svc_max_payload() argument
1581 u32 max = rqstp->rq_xprt->xpt_class->xcl_max_payload; in svc_max_payload()
1583 if (rqstp->rq_server->sv_max_payload < max) in svc_max_payload()
1584 max = rqstp->rq_server->sv_max_payload; in svc_max_payload()
1596 const char *svc_proc_name(const struct svc_rqst *rqstp) in svc_proc_name() argument
1598 if (rqstp && rqstp->rq_procinfo) in svc_proc_name()
1599 return rqstp->rq_procinfo->pc_name; in svc_proc_name()
1613 int svc_encode_result_payload(struct svc_rqst *rqstp, unsigned int offset, in svc_encode_result_payload() argument
1616 return rqstp->rq_xprt->xpt_ops->xpo_result_payload(rqstp, offset, in svc_encode_result_payload()
1628 unsigned int svc_fill_write_vector(struct svc_rqst *rqstp, in svc_fill_write_vector() argument
1633 struct kvec *vec = rqstp->rq_vec; in svc_fill_write_vector()
1656 WARN_ON_ONCE(i > ARRAY_SIZE(rqstp->rq_vec)); in svc_fill_write_vector()
1672 char *svc_fill_symlink_pathname(struct svc_rqst *rqstp, struct kvec *first, in svc_fill_symlink_pathname() argument