aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/dax.c29
-rw-r--r--include/linux/dax.h1
-rw-r--r--mm/truncate.c9
3 files changed, 3 insertions, 36 deletions
diff --git a/fs/dax.c b/fs/dax.c
index 66d79067eedf..38deebb8c86e 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -461,35 +461,6 @@ int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index)
461} 461}
462 462
463/* 463/*
464 * Invalidate exceptional DAX entry if easily possible. This handles DAX
465 * entries for invalidate_inode_pages() so we evict the entry only if we can
466 * do so without blocking.
467 */
468int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index)
469{
470 int ret = 0;
471 void *entry, **slot;
472 struct radix_tree_root *page_tree = &mapping->page_tree;
473
474 spin_lock_irq(&mapping->tree_lock);
475 entry = __radix_tree_lookup(page_tree, index, NULL, &slot);
476 if (!entry || !radix_tree_exceptional_entry(entry) ||
477 slot_locked(mapping, slot))
478 goto out;
479 if (radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_DIRTY) ||
480 radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_TOWRITE))
481 goto out;
482 radix_tree_delete(page_tree, index);
483 mapping->nrexceptional--;
484 ret = 1;
485out:
486 spin_unlock_irq(&mapping->tree_lock);
487 if (ret)
488 dax_wake_mapping_entry_waiter(mapping, index, entry, true);
489 return ret;
490}
491
492/*
493 * Invalidate exceptional DAX entry if it is clean. 464 * Invalidate exceptional DAX entry if it is clean.
494 */ 465 */
495int dax_invalidate_mapping_entry_sync(struct address_space *mapping, 466int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
diff --git a/include/linux/dax.h b/include/linux/dax.h
index d3158e74a59e..d1236d16ef00 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -63,7 +63,6 @@ ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
63int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size, 63int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size,
64 const struct iomap_ops *ops); 64 const struct iomap_ops *ops);
65int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index); 65int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
66int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index);
67int dax_invalidate_mapping_entry_sync(struct address_space *mapping, 66int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
68 pgoff_t index); 67 pgoff_t index);
69void dax_wake_mapping_entry_waiter(struct address_space *mapping, 68void dax_wake_mapping_entry_waiter(struct address_space *mapping,
diff --git a/mm/truncate.c b/mm/truncate.c
index 83a059e8cd1d..706cff171a15 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -67,17 +67,14 @@ static void truncate_exceptional_entry(struct address_space *mapping,
67 67
68/* 68/*
69 * Invalidate exceptional entry if easily possible. This handles exceptional 69 * Invalidate exceptional entry if easily possible. This handles exceptional
70 * entries for invalidate_inode_pages() so for DAX it evicts only unlocked and 70 * entries for invalidate_inode_pages().
71 * clean entries.
72 */ 71 */
73static int invalidate_exceptional_entry(struct address_space *mapping, 72static int invalidate_exceptional_entry(struct address_space *mapping,
74 pgoff_t index, void *entry) 73 pgoff_t index, void *entry)
75{ 74{
76 /* Handled by shmem itself */ 75 /* Handled by shmem itself, or for DAX we do nothing. */
77 if (shmem_mapping(mapping)) 76 if (shmem_mapping(mapping) || dax_mapping(mapping))
78 return 1; 77 return 1;
79 if (dax_mapping(mapping))
80 return dax_invalidate_mapping_entry(mapping, index);
81 clear_shadow_entry(mapping, index, entry); 78 clear_shadow_entry(mapping, index, entry);
82 return 1; 79 return 1;
83} 80}