summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-05-22 08:00:08 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-05-22 08:00:08 -0700
commite74193ade30270984a8f49b3604cff69c045ea4e (patch)
tree43756051fa1815d37977c7febfb72bd56548c0d5 /include
parent7379e3022d236e2aff1b654d8ecb6cd4fc19246e (diff)
[PATCH] revert recent swapcache handling changes
Go back to the 2.6.5 concepts, with rmap additions. In particular: - Implement Andrea's flavour of page_mapping(). This function opaquely does the right thing for pagecache pages, anon pages and for swapcache pages. The critical thing here is that page_mapping() returns &swapper_space for swapcache pages without actually requiring the storage at page->mapping. This frees page->mapping for the anonmm/anonvma metadata. - Andrea and Hugh placed the pagecache index of swapcache pages into page->private rather than page->index. So add new page_index() function which hides this. - Make swapper_space.set_page_dirty() again point at __set_page_dirty_buffers(). If we don't do that, a bare set_page_dirty() will fall through to __set_page_dirty_buffers(), which is silly. This way, __set_page_dirty_buffers() can continue to use page->mapping. It should never go near anon or swapcache pages. - Give swapper_space a ->set_page_dirty address_space_operation method, so that set_page_dirty() will not fall through to __set_page_dirty_buffers() for swapcache pages. That function is not set up to handle them. The main effect of these changes is that swapcache pages are treated more similarly to pagecache pages. And we are again tagging swapcache pages as dirty in their radix tree, which is a requirement if we later wish to implement swapcache writearound based on tagged radix-tree walks.
Diffstat (limited to 'include')
-rw-r--r--include/linux/mm.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 78e2f8581d41..56ccfb5ec82a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -415,9 +415,27 @@ void page_address_init(void);
* address_space which maps the page from disk; whereas "page_mapped"
* refers to user virtual address space into which the page is mapped.
*/
+extern struct address_space swapper_space;
static inline struct address_space *page_mapping(struct page *page)
{
- return PageAnon(page)? NULL: page->mapping;
+ struct address_space *mapping = NULL;
+
+ if (unlikely(PageSwapCache(page)))
+ mapping = &swapper_space;
+ else if (likely(!PageAnon(page)))
+ mapping = page->mapping;
+ return mapping;
+}
+
+/*
+ * Return the pagecache index of the passed page. Regular pagecache pages
+ * use ->index whereas swapcache pages use ->private
+ */
+static inline pgoff_t page_index(struct page *page)
+{
+ if (unlikely(PageSwapCache(page)))
+ return page->private;
+ return page->index;
}
/*