From c5a311781fc60c9a91483b737d3f59096949439e Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Wed, 29 Apr 2020 09:27:51 +1000 Subject: [PATCH] LU-10467 llite: clean up pcc_layout_wait() pcc_layout_wait() contains a pointless while loop (and an unnecessary blank line) and is a trivial function that is only called once. So move the code into __pcc_layout_invalidate(), remove the while loop, and generally tidy up. Test-Parameters: trivial Signed-off-by: Mr NeilBrown Change-Id: I4a7c721a562682906dec4996bfbdad03e26a01dd Reviewed-on: https://review.whamcloud.com/38403 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Yingjin Qian Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/llite/pcc.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index 70da52d..9b00644 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -2050,22 +2050,17 @@ int pcc_fault(struct vm_area_struct *vma, struct vm_fault *vmf, RETURN(rc); } -static void pcc_layout_wait(struct pcc_inode *pcci) -{ - - while (atomic_read(&pcci->pcci_active_ios) > 0) { - CDEBUG(D_CACHE, "Waiting for IO completion: %d\n", - atomic_read(&pcci->pcci_active_ios)); - wait_event_idle(pcci->pcci_waitq, - atomic_read(&pcci->pcci_active_ios) == 0); - } -} - static void __pcc_layout_invalidate(struct pcc_inode *pcci) { pcci->pcci_type = LU_PCC_NONE; pcc_layout_gen_set(pcci, CL_LAYOUT_GEN_NONE); - pcc_layout_wait(pcci); + if (atomic_read(&pcci->pcci_active_ios) == 0) + return; + + CDEBUG(D_CACHE, "Waiting for IO completion: %d\n", + atomic_read(&pcci->pcci_active_ios)); + wait_event_idle(pcci->pcci_waitq, + atomic_read(&pcci->pcci_active_ios) == 0); } void pcc_layout_invalidate(struct inode *inode) -- 1.8.3.1