Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

SUNRPC: Relocate svc_free_res_pages()

Clean-up: There doesn't seem to be a reason why this function is
stuck in a header. One thing it prevents is the convenient addition
of tracing. Moving it to a source file also makes the rq_respages
clean-up logic easier to find.

Reviewed-by: Calum Mackay <calum.mackay@oracle.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

+21 -12
+1 -11
include/linux/sunrpc/svc.h
··· 309 309 return (struct sockaddr *) &rqst->rq_daddr; 310 310 } 311 311 312 - static inline void svc_free_res_pages(struct svc_rqst *rqstp) 313 - { 314 - while (rqstp->rq_next_page != rqstp->rq_respages) { 315 - struct page **pp = --rqstp->rq_next_page; 316 - if (*pp) { 317 - put_page(*pp); 318 - *pp = NULL; 319 - } 320 - } 321 - } 322 - 323 312 struct svc_deferred_req { 324 313 u32 prot; /* protocol (UDP or TCP) */ 325 314 struct svc_xprt *xprt; ··· 413 424 struct svc_pool *pool, int node); 414 425 bool svc_rqst_replace_page(struct svc_rqst *rqstp, 415 426 struct page *page); 427 + void svc_rqst_release_pages(struct svc_rqst *rqstp); 416 428 void svc_rqst_free(struct svc_rqst *); 417 429 void svc_exit_thread(struct svc_rqst *); 418 430 struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
+19
net/sunrpc/svc.c
··· 869 869 } 870 870 EXPORT_SYMBOL_GPL(svc_rqst_replace_page); 871 871 872 + /** 873 + * svc_rqst_release_pages - Release Reply buffer pages 874 + * @rqstp: RPC transaction context 875 + * 876 + * Release response pages that might still be in flight after 877 + * svc_send, and any spliced filesystem-owned pages. 878 + */ 879 + void svc_rqst_release_pages(struct svc_rqst *rqstp) 880 + { 881 + while (rqstp->rq_next_page != rqstp->rq_respages) { 882 + struct page **pp = --rqstp->rq_next_page; 883 + 884 + if (*pp) { 885 + put_page(*pp); 886 + *pp = NULL; 887 + } 888 + } 889 + } 890 + 872 891 /* 873 892 * Called from a server thread as it's exiting. Caller must hold the "service 874 893 * mutex" for the service.
+1 -1
net/sunrpc/svc_xprt.c
··· 542 542 rqstp->rq_deferred = NULL; 543 543 544 544 pagevec_release(&rqstp->rq_pvec); 545 - svc_free_res_pages(rqstp); 545 + svc_rqst_release_pages(rqstp); 546 546 rqstp->rq_res.page_len = 0; 547 547 rqstp->rq_res.page_base = 0; 548 548