]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dax: account DAX entries as nrpages
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 5 May 2021 01:32:51 +0000 (18:32 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 5 May 2021 18:27:19 +0000 (11:27 -0700)
Simplify mapping_needs_writeback() by accounting DAX entries as pages
instead of exceptional entries.

Link: https://lkml.kernel.org/r/20201026151849.24232-4-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Tested-by: Vishal Verma <vishal.l.verma@intel.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/dax.c
mm/filemap.c

index 999f3f22aea3f114a7f21dd83cd47af64492e0d6..69216241392f23106e823f8d9d583a9710f4d17f 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -525,7 +525,7 @@ retry:
                dax_disassociate_entry(entry, mapping, false);
                xas_store(xas, NULL);   /* undo the PMD join */
                dax_wake_entry(xas, entry, true);
-               mapping->nrexceptional--;
+               mapping->nrpages -= PG_PMD_NR;
                entry = NULL;
                xas_set(xas, index);
        }
@@ -541,7 +541,7 @@ retry:
                dax_lock_entry(xas, entry);
                if (xas_error(xas))
                        goto out_unlock;
-               mapping->nrexceptional++;
+               mapping->nrpages += 1UL << order;
        }
 
 out_unlock:
@@ -661,7 +661,7 @@ static int __dax_invalidate_entry(struct address_space *mapping,
                goto out;
        dax_disassociate_entry(entry, mapping, trunc);
        xas_store(&xas, NULL);
-       mapping->nrexceptional--;
+       mapping->nrpages -= 1UL << dax_entry_order(entry);
        ret = 1;
 out:
        put_unlocked_entry(&xas, entry);
index d08ff1504e6499c9f7b20cf23627595191a19a64..ecc5f8a4c4884f8384c0a254015941b45ad4170a 100644 (file)
@@ -618,9 +618,6 @@ EXPORT_SYMBOL(filemap_fdatawait_keep_errors);
 /* Returns true if writeback might be needed or already in progress. */
 static bool mapping_needs_writeback(struct address_space *mapping)
 {
-       if (dax_mapping(mapping))
-               return mapping->nrexceptional;
-
        return mapping->nrpages;
 }