Whamcloud - gitweb
LU-11838 llite: address_space ->page_tree renamed ->i_pages 73/34673/5
authorLi Dongyang <dongyangli@ddn.com>
Mon, 15 Apr 2019 04:15:40 +0000 (14:15 +1000)
committerOleg Drokin <green@whamcloud.com>
Sat, 25 May 2019 04:56:22 +0000 (04:56 +0000)
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>
lustre/autoconf/lustre-core.m4
lustre/include/lustre_compat.h
lustre/llite/llite_lib.c
lustre/mdc/mdc_request.c

index 3dffc2c..4245ba7 100644 (file)
@@ -3058,6 +3058,26 @@ bi_bdev, [
 ]) # 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
@@ -3302,6 +3322,9 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_PAGEVEC_INIT_ONE_PARAM
        LC_BI_BDEV
 
+       # 4.17
+       LC_I_PAGES
+
        # kernel patch to extend integrity interface
        LC_BIO_INTEGRITY_PREP_FN
 
index 4ea091a..1b74aa4 100644 (file)
@@ -791,4 +791,12 @@ static inline bool bdev_integrity_enabled(struct block_device *bdev, int rw)
 #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 */
index 2548dbd..11d6169 100644 (file)
@@ -2149,9 +2149,9 @@ void ll_delete_inode(struct inode *inode)
         */
        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, "
index 0db1628..bc5ac2f 100644 (file)
@@ -1112,14 +1112,14 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash,
        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,
@@ -1168,7 +1168,7 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash,
                        page = ERR_PTR(-EIO);
                }
        } else {
-               spin_unlock_irq(&mapping->tree_lock);
+               xa_unlock_irq(&mapping->i_pages);
                page = NULL;
        }
        return page;