]> git.hungrycats.org Git - linux/commitdiff
[PATCH] misc pagecache cleanups / tweaks
authorChristoph Hellwig <hch@lst.de>
Sat, 10 Aug 2002 09:09:20 +0000 (02:09 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sat, 10 Aug 2002 09:09:20 +0000 (02:09 -0700)
- inline grab_cache_page() in pagemap.h, it's just a simple wrapper
  around find_or_create_page()
- rename (__)remove_inode_page to (__)remove_from_page_cache and
  move them from mm.h and swap.h to pagemap.h because they reverse
  add_to_page_cache and that's where they belong.

include/linux/mm.h
include/linux/pagemap.h
include/linux/swap.h
kernel/ksyms.c
mm/filemap.c
mm/swap_state.c
mm/vmscan.c

index 8cfa042a42fc14d5b51b64ac8dac6b7badb087ef..baafd9a57b25aa398f3c09f5a30bd3056d1fdbf0 100644 (file)
@@ -450,7 +450,6 @@ static inline int can_vma_merge(struct vm_area_struct * vma, unsigned long vm_fl
 
 struct zone_t;
 /* filemap.c */
-extern void remove_inode_page(struct page *);
 extern unsigned long page_unuse(struct page *);
 extern void truncate_inode_pages(struct address_space *, loff_t);
 
index 6c4ee12fb7ecdab25c33ef625cf3ff40b7faab0b..b559ccd68520fdd0027a6097a30b5d2aa80c58f2 100644 (file)
@@ -42,8 +42,14 @@ extern struct page * find_trylock_page(struct address_space *mapping,
 extern struct page * find_or_create_page(struct address_space *mapping,
                                unsigned long index, unsigned int gfp_mask);
 
-extern struct page * grab_cache_page(struct address_space *mapping,
-                               unsigned long index);
+/*
+ * Returns locked page at given index in given cache, creating it if needed.
+ */
+static inline struct page *grab_cache_page(struct address_space *mapping, unsigned long index)
+{
+       return find_or_create_page(mapping, index, mapping->gfp_mask);
+}
+
 extern struct page * grab_cache_page_nowait(struct address_space *mapping,
                                unsigned long index);
 extern struct page * read_cache_page(struct address_space *mapping,
@@ -52,6 +58,8 @@ extern struct page * read_cache_page(struct address_space *mapping,
 
 extern int add_to_page_cache(struct page *page,
                struct address_space *mapping, unsigned long index);
+extern void remove_from_page_cache(struct page *page);
+extern void __remove_from_page_cache(struct page *page);
 
 static inline void ___add_to_page_cache(struct page *page,
                struct address_space *mapping, unsigned long index)
index c355567500e067a3198afc8e311dbd1c75bc0e54..b3bae533a6a4291e5ebeb0ea9385b8607dc1b7ac 100644 (file)
@@ -133,7 +133,6 @@ extern unsigned long totalhigh_pages;
 extern unsigned int nr_free_pages(void);
 extern unsigned int nr_free_buffer_pages(void);
 extern unsigned int nr_free_pagecache_pages(void);
-extern void __remove_inode_page(struct page *);
 
 /* Incomplete types for prototype declarations: */
 struct task_struct;
index 006e1832a02e512ba4e3970d019a59b6b714c0c3..d1586120ad02858853db31f203bbd06eab2395fe 100644 (file)
@@ -268,7 +268,7 @@ EXPORT_SYMBOL(poll_freewait);
 EXPORT_SYMBOL(ROOT_DEV);
 EXPORT_SYMBOL(find_get_page);
 EXPORT_SYMBOL(find_lock_page);
-EXPORT_SYMBOL(grab_cache_page);
+EXPORT_SYMBOL(find_or_create_page);
 EXPORT_SYMBOL(grab_cache_page_nowait);
 EXPORT_SYMBOL(read_cache_page);
 EXPORT_SYMBOL(vfs_readlink);
index 2e84aab174124c6ee1bf5d88874aab865e5a817f..e308a02bf663ebf2dcd19e33a7f3a4bf6821fee0 100644 (file)
@@ -68,7 +68,7 @@ spinlock_t pagemap_lru_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
  * sure the page is locked and that nobody else uses it - or that usage
  * is safe.  The caller must hold a write_lock on the mapping's page_lock.
  */
-void __remove_inode_page(struct page *page)
+void __remove_from_page_cache(struct page *page)
 {
        struct address_space *mapping = page->mapping;
 
@@ -83,7 +83,7 @@ void __remove_inode_page(struct page *page)
        dec_page_state(nr_pagecache);
 }
 
-void remove_inode_page(struct page *page)
+void remove_from_page_cache(struct page *page)
 {
        struct address_space *mapping = page->mapping;
 
@@ -91,7 +91,7 @@ void remove_inode_page(struct page *page)
                PAGE_BUG(page);
 
        write_lock(&mapping->page_lock);
-       __remove_inode_page(page);
+       __remove_from_page_cache(page);
        write_unlock(&mapping->page_lock);
 }
 
@@ -143,7 +143,7 @@ void invalidate_inode_pages(struct inode * inode)
                        goto unlock;
 
                __lru_cache_del(page);
-               __remove_inode_page(page);
+               __remove_from_page_cache(page);
                unlock_page(page);
                page_cache_release(page);
                continue;
@@ -186,7 +186,7 @@ static void truncate_complete_page(struct page *page)
 
        ClearPageDirty(page);
        ClearPageUptodate(page);
-       remove_inode_page(page);
+       remove_from_page_cache(page);
        page_cache_release(page);
 }
 
@@ -808,15 +808,6 @@ repeat:
        return page;
 }
 
-/*
- * Returns locked page at given index in given cache, creating it if needed.
- */
-struct page *grab_cache_page(struct address_space *mapping, unsigned long index)
-{
-       return find_or_create_page(mapping, index, mapping->gfp_mask);
-}
-
-
 /*
  * Same as grab_cache_page, but do not wait if the page is unavailable.
  * This is intended for speculative data generators, where the data can
index a9856bced9190e4d0e99adb466cb356b1011de1b..62c3448c2b3407e14327c130ec1b77d4f023e610 100644 (file)
@@ -95,7 +95,7 @@ void __delete_from_swap_cache(struct page *page)
        BUG_ON(!PageSwapCache(page));
        BUG_ON(PageWriteback(page));
        ClearPageDirty(page);
-       __remove_inode_page(page);
+       __remove_from_page_cache(page);
        INC_CACHE_INFO(del_total);
 }
 
@@ -206,7 +206,7 @@ int move_to_swap_cache(struct page *page, swp_entry_t entry)
        err = radix_tree_reserve(&swapper_space.page_tree, entry.val, &pslot);
        if (!err) {
                /* Remove it from the page cache */
-               __remove_inode_page (page);
+               __remove_from_page_cache(page);
 
                /* Add it to the swap cache */
                *pslot = page;
index f6815bae9fab7f99039fd00363bc64db944fafc3..21ca8d248befbc1c01e228d3ef6eda1f5afb5780 100644 (file)
@@ -288,7 +288,7 @@ page_freeable:
 
                /* point of no return */
                if (likely(!PageSwapCache(page))) {
-                       __remove_inode_page(page);
+                       __remove_from_page_cache(page);
                        write_unlock(&mapping->page_lock);
                } else {
                        swp_entry_t swap;