Merge tag 'drm-misc-fixes-2021-05-20' of git://anongit.freedesktop.org/drm/drm-misc...
[linux-2.6-microblaze.git] / mm / truncate.c
index 4559442..95af244 100644 (file)
@@ -40,7 +40,6 @@ static inline void __clear_shadow_entry(struct address_space *mapping,
        if (xas_load(&xas) != entry)
                return;
        xas_store(&xas, NULL);
-       mapping->nrexceptional--;
 }
 
 static void clear_shadow_entry(struct address_space *mapping, pgoff_t index,
@@ -295,7 +294,7 @@ void truncate_inode_pages_range(struct address_space *mapping,
        pgoff_t         index;
        int             i;
 
-       if (mapping->nrpages == 0 && mapping->nrexceptional == 0)
+       if (mapping_empty(mapping))
                goto out;
 
        /* Offsets within partial pages */
@@ -440,9 +439,6 @@ EXPORT_SYMBOL(truncate_inode_pages);
  */
 void truncate_inode_pages_final(struct address_space *mapping)
 {
-       unsigned long nrexceptional;
-       unsigned long nrpages;
-
        /*
         * Page reclaim can not participate in regular inode lifetime
         * management (can't call iput()) and thus can race with the
@@ -452,16 +448,7 @@ void truncate_inode_pages_final(struct address_space *mapping)
         */
        mapping_set_exiting(mapping);
 
-       /*
-        * When reclaim installs eviction entries, it increases
-        * nrexceptional first, then decreases nrpages.  Make sure we see
-        * this in the right order or we might miss an entry.
-        */
-       nrpages = mapping->nrpages;
-       smp_rmb();
-       nrexceptional = mapping->nrexceptional;
-
-       if (nrpages || nrexceptional) {
+       if (!mapping_empty(mapping)) {
                /*
                 * As truncation uses a lockless tree lookup, cycle
                 * the tree lock to make sure any ongoing tree
@@ -633,7 +620,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
        int ret2 = 0;
        int did_range_unmap = 0;
 
-       if (mapping->nrpages == 0 && mapping->nrexceptional == 0)
+       if (mapping_empty(mapping))
                goto out;
 
        pagevec_init(&pvec);