From bcc52fdccc92c45f657d637eaf8403decc6d9877 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 21 May 2015 11:26:54 -0400 Subject: [PATCH] LU-6215 client: handle dirty page cleanup api changes 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 Reviewed-on: http://review.whamcloud.com/14669 Tested-by: Jenkins Reviewed-by: Dmitry Eremin Reviewed-by: Thomas Stibor Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++++++ lustre/include/lustre_patchless_compat.h | 8 ++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 4b65c12..daa9119 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 +],[ + 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 diff --git a/lustre/include/lustre_patchless_compat.h b/lustre/include/lustre_patchless_compat.h index 3ef2b0b..c62e4d5 100644 --- a/lustre/include/lustre_patchless_compat.h +++ b/lustre/include/lustre_patchless_compat.h @@ -38,10 +38,9 @@ #define LUSTRE_PATCHLESS_COMPAT_H #include - +#include #ifndef HAVE_TRUNCATE_COMPLETE_PAGE #include -#include #include #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); } -- 1.8.3.1