]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] put_page() consolidation
authorAndrew Morton <akpm@zip.com.au>
Fri, 30 Aug 2002 08:49:13 +0000 (01:49 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Fri, 30 Aug 2002 08:49:13 +0000 (01:49 -0700)
Clean up put_page() and page_cache_release().  It's pretty simple now:

#define page_cache_get(page)           get_page(page)
#define page_cache_release(page)       put_page(page)

include/linux/mm.h
include/linux/pagemap.h

index b31b3e3a5fc80a4e97d75d2e194fcc7b7fc62cfb..cdfaea4e330793f4dfb821cd24d4e9b9539848db 100644 (file)
@@ -181,6 +181,12 @@ struct page {
 #endif /* CONFIG_HIGMEM || WANT_PAGE_VIRTUAL */
 };
 
+/*
+ * FIXME: take this include out, include page-flags.h in
+ * files which need it (119 of them)
+ */
+#include <linux/page-flags.h>
+
 /*
  * Methods to modify the page usage count.
  *
@@ -202,14 +208,16 @@ struct page {
        })
 #define page_count(p)          atomic_read(&(p)->count)
 #define set_page_count(p,v)    atomic_set(&(p)->count, v)
+
 extern void FASTCALL(__page_cache_release(struct page *));
-#define put_page(p)                                                    \
-       do {                                                            \
-               if (!PageReserved(p) && put_page_testzero(p))           \
-                       __page_cache_release(p);                        \
-       } while (0)
 void FASTCALL(__free_pages_ok(struct page *page, unsigned int order));
 
+static inline void put_page(struct page *page)
+{
+       if (!PageReserved(page) && put_page_testzero(page))
+               __page_cache_release(page);
+}
+
 /*
  * Multiple processes may "see" the same page. E.g. for untouched
  * mappings of /dev/null, all processes see the same page full of
@@ -259,12 +267,6 @@ void FASTCALL(__free_pages_ok(struct page *page, unsigned int order));
  *   to swap space and (later) to be read back into memory.
  */
 
-/*
- * FIXME: take this include out, include page-flags.h in
- * files which need it (119 of them)
- */
-#include <linux/page-flags.h>
-
 /*
  * The zone field is never updated after free_area_init_core()
  * sets it, so none of the operations on it need to be atomic.
index ff10783f8632c3779828b12b0683bae12a7ed57d..7a41a4184a27e5aec90fc0f9b50b9405e8f36c37 100644 (file)
 #define PAGE_CACHE_MASK                PAGE_MASK
 #define PAGE_CACHE_ALIGN(addr) (((addr)+PAGE_CACHE_SIZE-1)&PAGE_CACHE_MASK)
 
-#define page_cache_get(x)      get_page(x)
-
-static inline void page_cache_release(struct page *page)
-{
-       if (!PageReserved(page) && put_page_testzero(page))
-               __page_cache_release(page);
-}
+#define page_cache_get(page)           get_page(page)
+#define page_cache_release(page)       put_page(page)
 
 static inline struct page *page_cache_alloc(struct address_space *x)
 {