Whamcloud - gitweb
LU-6215 client: handle dirty page cleanup api changes 69/14669/5
authorJames Simmons <uja.ornl@yahoo.com>
Thu, 21 May 2015 15:26:54 +0000 (11:26 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 5 Jun 2015 01:47:52 +0000 (01:47 +0000)
In linux 4.0.0 the cancel_dirty_page function was replaced
by account_page_cleaned function. We handle this new case.

Change-Id: I956fa6b436bb2b01da0f9cbdfb2db707370e504e
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: http://review.whamcloud.com/14669
Tested-by: Jenkins
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Thomas Stibor <t.stibor@gsi.de>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/autoconf/lustre-core.m4
lustre/include/lustre_patchless_compat.h

index 4b65c12..daa9119 100644 (file)
@@ -1641,6 +1641,23 @@ direct_io_iter, [
 ]) # LC_DIRECTIO_USE_ITER
 
 #
+# LC_CANCEL_DIRTY_PAGE
+#
+# 4.0.0 kernel removed cancle_dirty_page
+#
+AC_DEFUN([LC_CANCEL_DIRTY_PAGE], [
+LB_CHECK_COMPILE([if cancel_dirty_page still exist],
+cancel_dirty_page, [
+       #include <linux/mm.h>
+],[
+       cancel_dirty_page(NULL, PAGE_SIZE);
+],[
+       AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
+               [cancel_dirty_page is still available])
+])
+]) # LC_CANCEL_DIRTY_PAGE
+
+#
 # LC_IOV_ITER_RW
 #
 # 4.1 kernel has iov_iter_rw
@@ -1793,6 +1810,9 @@ AC_DEFUN([LC_PROG_LINUX], [
        # 3.16
        LC_DIRECTIO_USE_ITER
 
+       # 4.0.0
+       LC_CANCEL_DIRTY_PAGE
+
        # 4.1.0
        LC_IOV_ITER_RW
 
index 3ef2b0b..c62e4d5 100644 (file)
 #define LUSTRE_PATCHLESS_COMPAT_H
 
 #include <linux/fs.h>
-
+#include <linux/mm.h>
 #ifndef HAVE_TRUNCATE_COMPLETE_PAGE
 #include <linux/list.h>
-#include <linux/mm.h>
 #include <linux/hash.h>
 
 #ifndef HAVE_DELETE_FROM_PAGE_CACHE /* 2.6.39 */
@@ -87,7 +86,12 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
 #else
                page->mapping->a_ops->invalidatepage(page, 0);
 #endif
+#ifdef HAVE_CANCEL_DIRTY_PAGE
        cancel_dirty_page(page, PAGE_SIZE);
+#else
+       if (TestClearPageDirty(page))
+               account_page_cleaned(page, mapping);
+#endif /* HAVE_CANCEL_DIRTY_PAGE */
        ClearPageMappedToDisk(page);
        ll_delete_from_page_cache(page);
 }