Whamcloud - gitweb
LU-10467 llite: clean up pcc_layout_wait() 03/38403/3
authorMr NeilBrown <neilb@suse.de>
Tue, 28 Apr 2020 23:27:51 +0000 (09:27 +1000)
committerOleg Drokin <green@whamcloud.com>
Thu, 14 May 2020 05:39:17 +0000 (05:39 +0000)
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 <neilb@suse.de>
Change-Id: I4a7c721a562682906dec4996bfbdad03e26a01dd
Reviewed-on: https://review.whamcloud.com/38403
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/pcc.c

index 70da52d..9b00644 100644 (file)
@@ -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)