Whamcloud - gitweb
b=17914
[fs/lustre-release.git] / lustre / obdclass / cl_page.c
index 6371a73..e88427b 100644 (file)
@@ -137,11 +137,14 @@ cl_page_at_trusted(const struct cl_page *page,
                    const struct lu_device_type *dtype)
 {
         const struct cl_page_slice *slice;
+
+#ifdef INVARIANT_CHECK
         struct cl_object_header *ch = cl_object_header(page->cp_obj);
 
+        if (!atomic_read(&page->cp_ref))
+                LASSERT_SPIN_LOCKED(&ch->coh_page_guard);
+#endif
         ENTRY;
-        LINVRNT(ergo(!atomic_read(&page->cp_ref),
-                spin_is_locked(&ch->coh_page_guard)));
 
         page = cl_page_top_trusted((struct cl_page *)page);
         do {
@@ -164,7 +167,7 @@ struct cl_page *cl_page_lookup(struct cl_object_header *hdr, pgoff_t index)
 {
         struct cl_page *page;
 
-        LASSERT(spin_is_locked(&hdr->coh_page_guard));
+        LASSERT_SPIN_LOCKED(&hdr->coh_page_guard);
 
         page = radix_tree_lookup(&hdr->coh_tree, index);
         if (page != NULL) {
@@ -1256,7 +1259,12 @@ void cl_page_completion(const struct lu_env *env,
                                (const struct lu_env *,
                                 const struct cl_page_slice *, int), ioret);
 
-        KLASSERT(!PageWriteback(cl_page_vmpage(env, pg)));
+        /* Don't assert the page writeback bit here because the lustre file
+         * may be as a backend of swap space. in this case, the page writeback
+         * is set by VM, and obvious we shouldn't clear it at all. Fortunately
+         * this type of pages are all TRANSIENT pages. */
+        KLASSERT(ergo(pg->cp_type == CPT_CACHEABLE,
+                      !PageWriteback(cl_page_vmpage(env, pg))));
         EXIT;
 }
 EXPORT_SYMBOL(cl_page_completion);