Whamcloud - gitweb
LU-6854 llite: Do not set writeback for sync write pages
[fs/lustre-release.git] / lustre / llite / vvp_page.c
index 356b373..47d4863 100644 (file)
@@ -209,11 +209,15 @@ static int vvp_page_prep_write(const struct lu_env *env,
                                struct cl_io *unused)
 {
        struct page *vmpage = cl2vm_page(slice);
+       struct cl_page *pg = slice->cpl_page;
 
        LASSERT(PageLocked(vmpage));
        LASSERT(!PageDirty(vmpage));
 
-       set_page_writeback(vmpage);
+       /* ll_writepage path is not a sync write, so need to set page writeback
+        * flag */
+       if (pg->cp_sync_io == NULL)
+               set_page_writeback(vmpage);
 
        return 0;
 }
@@ -284,19 +288,21 @@ static void vvp_page_completion_write(const struct lu_env *env,
        struct page     *vmpage = vpg->vpg_page;
        ENTRY;
 
-       LASSERT(ergo(pg->cp_sync_io != NULL, PageLocked(vmpage)));
-       LASSERT(PageWriteback(vmpage));
-
        CL_PAGE_HEADER(D_PAGE, env, pg, "completing WRITE with %d\n", ioret);
 
-       /*
-        * Only mark the page error only when it's an async write because
-        * applications won't wait for IO to finish.
-        */
-       if (pg->cp_sync_io == NULL)
+       if (pg->cp_sync_io != NULL) {
+               LASSERT(PageLocked(vmpage));
+               LASSERT(!PageWriteback(vmpage));
+       } else {
+               LASSERT(PageWriteback(vmpage));
+               /*
+                * Only mark the page error only when it's an async write
+                * because applications won't wait for IO to finish.
+                */
                vvp_vmpage_error(vvp_object_inode(pg->cp_obj), vmpage, ioret);
 
-       end_page_writeback(vmpage);
+               end_page_writeback(vmpage);
+       }
        EXIT;
 }