summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-04-12 00:54:31 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-04-12 00:54:31 -0700
commitfbf7adfafae19dd118facbbfe011510ba6aa8315 (patch)
treef3c91443c31fcf344095716b3885696c507828f8 /include/linux
parentda47ca23dfeb76d99add903af69726ffcb2d999d (diff)
[PATCH] rmap 3 arches + mapping_mapped
From: Hugh Dickins <hugh@veritas.com> Some arches refer to page->mapping for their dcache flushing: use page_mapping(page) for safety, to avoid confusion on anon pages, which will store a different pointer there - though in most cases flush_dcache_page is being applied to pagecache pages. arm has a useful mapping_mapped macro: move that to generic, and add mapping_writably_mapped, to avoid explicit list_empty checks on i_mmap and i_mmap_shared in several places. Very tempted to add page_mapped(page) tests, perhaps along with the mapping_writably_mapped tests in do_generic_mapping_read and do_shmem_file_read, to cut down on wasted flush_dcache effort; but the serialization is not obvious, too unsafe to do in a hurry.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fs.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c7f0052b4abd..3d7c320d675e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -374,6 +374,26 @@ struct block_device {
int mapping_tagged(struct address_space *mapping, int tag);
/*
+ * Might pages of this file be mapped into userspace?
+ */
+static inline int mapping_mapped(struct address_space *mapping)
+{
+ return !list_empty(&mapping->i_mmap) ||
+ !list_empty(&mapping->i_mmap_shared);
+}
+
+/*
+ * Might pages of this file have been modified in userspace?
+ * Note that i_mmap_shared holds all the VM_SHARED vmas: do_mmap_pgoff
+ * marks vma as VM_SHARED if it is shared, and the file was opened for
+ * writing i.e. vma may be mprotected writable even if now readonly.
+ */
+static inline int mapping_writably_mapped(struct address_space *mapping)
+{
+ return !list_empty(&mapping->i_mmap_shared);
+}
+
+/*
* Use sequence counter to get consistent i_size on 32-bit processors.
*/
#if BITS_PER_LONG==32 && defined(CONFIG_SMP)