kernel 4.17 renamed address_space renamed ->page_tree to ->i_pages,
and switched to xa_lock on the radix_tree_root.
Linux-commit:
b93b016313b3ba8003c3b8bb71f569af91f19fc7
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Change-Id: Iadbc5eda884dbe8ad0d694e0f88255bc496dea5b
Reviewed-on: https://review.whamcloud.com/34673
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
]) # LC_BI_BDEV
#
+# LC_I_PAGES
+#
+# kernel 4.17 commit b93b016313b3ba8003c3b8bb71f569af91f19fc7
+#
+AC_DEFUN([LC_I_PAGES], [
+LB_CHECK_COMPILE([if struct address_space has i_pages],
+i_pages, [
+ #include <linux/fs.h>
+],[
+ struct address_space mapping = {};
+ void *i_pages;
+
+ i_pages = &mapping.i_pages;
+],[
+ AC_DEFINE(HAVE_I_PAGES, 1,
+ [struct address_space has i_pages])
+])
+]) # LC_I_PAGES
+
+#
# LC_PROG_LINUX
#
# Lustre linux kernel checks
LC_PAGEVEC_INIT_ONE_PARAM
LC_BI_BDEV
+ # 4.17
+ LC_I_PAGES
+
# kernel patch to extend integrity interface
LC_BIO_INTEGRITY_PREP_FN
#define ll_pagevec_init(pvec, n) pagevec_init(pvec, n)
#endif
+#ifdef HAVE_I_PAGES
+#define page_tree i_pages
+#else
+#define i_pages tree_lock
+#define xa_lock_irq(lockp) spin_lock_irq(lockp)
+#define xa_unlock_irq(lockp) spin_unlock_irq(lockp)
+#endif
+
#endif /* _LUSTRE_COMPAT_H */
*/
nrpages = mapping->nrpages;
if (nrpages) {
- spin_lock_irq(&mapping->tree_lock);
+ xa_lock_irq(&mapping->i_pages);
nrpages = mapping->nrpages;
- spin_unlock_irq(&mapping->tree_lock);
+ xa_unlock_irq(&mapping->i_pages);
} /* Workaround end */
LASSERTF(nrpages == 0, "%s: inode="DFID"(%p) nrpages=%lu, "
struct page *page;
int found;
- spin_lock_irq(&mapping->tree_lock);
+ xa_lock_irq(&mapping->i_pages);
found = radix_tree_gang_lookup(&mapping->page_tree,
(void **)&page, offset, 1);
if (found > 0 && !radix_tree_exceptional_entry(page)) {
struct lu_dirpage *dp;
get_page(page);
- spin_unlock_irq(&mapping->tree_lock);
+ xa_unlock_irq(&mapping->i_pages);
/*
* In contrast to find_lock_page() we are sure that directory
* page cannot be truncated (while DLM lock is held) and,
page = ERR_PTR(-EIO);
}
} else {
- spin_unlock_irq(&mapping->tree_lock);
+ xa_unlock_irq(&mapping->i_pages);
page = NULL;
}
return page;