Whamcloud - gitweb
- landing of b_hd_cleanup_merge to HEAD.
[fs/lustre-release.git] / lustre / llite / rw26.c
index b9193e8..07b0d45 100644 (file)
 
 static int ll_writepage_26(struct page *page, struct writeback_control *wbc)
 {
-        struct inode *inode = page->mapping->host;
-        struct obd_export *exp;
-        struct ll_async_page *llap;
-        int rc;
-        ENTRY;
-
-        LASSERT(!PageDirty(page));
-        LASSERT(PageLocked(page));
-
-        exp = ll_i2obdexp(inode);
-        if (exp == NULL)
-                GOTO(out, rc = -EINVAL);
+        return ll_writepage(page);
+}
 
-        llap = llap_from_page(page);
-        if (IS_ERR(llap))
-                GOTO(out, rc = PTR_ERR(llap));
+/* It is safe to not check anything in invalidatepage/releasepage below
+   because they are run with page locked and all our io is happening with
+   locked page too */
+static int ll_invalidatepage(struct page *page, unsigned long offset)
+{
+        if (PagePrivate(page))
+                ll_removepage(page);
+        return 1;
+}
 
-        page_cache_get(page);
-        if (llap->llap_write_queued) {
-                LL_CDEBUG_PAGE(D_PAGE, page, "marking urgent\n");
-                rc = obd_set_async_flags(exp, ll_i2info(inode)->lli_smd, NULL,
-                                         llap->llap_cookie,
-                                         ASYNC_READY | ASYNC_URGENT);
-        } else {
-                llap->llap_write_queued = 1;
-                rc = obd_queue_async_io(exp, ll_i2info(inode)->lli_smd, NULL,
-                                        llap->llap_cookie, OBD_BRW_WRITE, 0, 0,
-                                        0, ASYNC_READY | ASYNC_URGENT);
-                if (rc == 0)
-                        LL_CDEBUG_PAGE(D_PAGE, page, "mmap write queued\n");
-                else
-                        llap->llap_write_queued = 0;
-        }
-        if (rc)
-                page_cache_release(page);
-out:
-        if (rc)
-                unlock_page(page);
-        RETURN(rc);
+static int ll_releasepage(struct page *page, int gfp_mask)
+{
+        if (PagePrivate(page))
+                ll_removepage(page);
+        return 1;
 }
 
 struct address_space_operations ll_aops = {
@@ -104,6 +83,7 @@ struct address_space_operations ll_aops = {
         .sync_page      = NULL,
         .prepare_write  = ll_prepare_write,
         .commit_write   = ll_commit_write,
-        .removepage     = ll_removepage,
+        .invalidatepage = ll_invalidatepage,
+        .releasepage    = ll_releasepage,
         .bmap           = NULL
 };