# After 5.2 kernel page dirtied is not exported
#
AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED], [
-LB_CHECK_COMPILE([if 'account_page_dirtied' is exported],
-account_page_dirtied, [
- #include <linux/mm.h>
-],[
- account_page_dirtied(NULL, NULL);
-],[
- AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED, 1,
- [account_page_dirtied is available])
-])
+LB_CHECK_EXPORT([account_page_dirtied], [mm/page-writeback.c],
+ [AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_EXPORT, 1,
+ [account_page_dirtied is exported])])
]) # LC_ACCOUNT_PAGE_DIRTIED
#
#include <obd.h>
#include "llite_internal.h"
#include "vvp_internal.h"
+#include <linux/kallsyms.h>
/*****************************************************************************
*
if (rc != 0)
goto out_kmem;
+#ifndef HAVE_ACCOUNT_PAGE_DIRTIED_EXPORT
+ /*
+ * Kernel v5.2-5678-gac1c3e4 no longer exports account_page_dirtied
+ */
+ vvp_account_page_dirtied = (void *)
+ kallsyms_lookup_name("account_page_dirtied");
+ BUG_ON(!vvp_account_page_dirtied);
+#endif
+
return 0;
out_kmem:
int vvp_global_init(void);
void vvp_global_fini(void);
+#ifndef HAVE_ACCOUNT_PAGE_DIRTIED_EXPORT
+typedef unsigned int (*vvp_account_page_dirtied)(struct page *page,
+ struct address_space *mapping);
+#endif
+
extern const struct file_operations vvp_dump_pgcache_file_ops;
#endif /* VVP_INTERNAL_H */
/*
* Kernels 4.2 - 4.5 pass memcg argument to account_page_dirtied()
- * Kernel v5.2-5678-gac1c3e4 no longer exports account_page_dirtied
+ * Kernel v5.2-5678-gac1c3e4 no longer exports account_page_dirtied
*/
static inline void ll_account_page_dirtied(struct page *page,
struct address_space *mapping)
account_page_dirtied(page, mapping, memcg);
mem_cgroup_end_page_stat(memcg);
-#elif defined HAVE_ACCOUNT_PAGE_DIRTIED
- account_page_dirtied(page, mapping, memcg);
+#elif defined(HAVE_ACCOUNT_PAGE_DIRTIED_EXPORT)
+ account_page_dirtied(page, mapping);
#else
- typedef unsigned int (dirtied_t)(struct page *pg,
- struct address_space *as);
- const char *symbol = "account_page_dirtied";
- static dirtied_t *dirtied = NULL;
-
- if (!dirtied)
- dirtied = (dirtied_t *)symbol_get(symbol);
-
- if (dirtied)
- dirtied(page, mapping);
+ vvp_account_page_dirtied(page, mapping);
#endif
}