From: William Lee Irwin III <wli@holomorphy.com>

Remove page_has_buffers() from various functions, document the dependencies
on buffer_head.h from other files besides filemap.c, and s/this file/core VM/
in filemap.c



 mm/filemap.c    |    5 ++---
 mm/swap.c       |    2 +-
 mm/swap_state.c |    5 ++---
 mm/swapfile.c   |    5 ++---
 mm/vmscan.c     |    3 ++-
 5 files changed, 9 insertions(+), 11 deletions(-)

diff -puN mm/filemap.c~buffers-cleanup mm/filemap.c
--- 25/mm/filemap.c~buffers-cleanup	2003-04-15 00:11:32.000000000 -0700
+++ 25-akpm/mm/filemap.c	2003-04-15 00:11:32.000000000 -0700
@@ -31,12 +31,11 @@
  * This is needed for the following functions:
  *  - try_to_release_page
  *  - block_invalidatepage
- *  - page_has_buffers
  *  - generic_osync_inode
  *
- * FIXME: remove all knowledge of the buffer layer from this file
+ * FIXME: remove all knowledge of the buffer layer from the core VM
  */
-#include <linux/buffer_head.h>
+#include <linux/buffer_head.h> /* for generic_osync_inode */
 
 #include <asm/uaccess.h>
 #include <asm/mman.h>
diff -puN mm/swap.c~buffers-cleanup mm/swap.c
--- 25/mm/swap.c~buffers-cleanup	2003-04-15 00:11:32.000000000 -0700
+++ 25-akpm/mm/swap.c	2003-04-15 00:11:32.000000000 -0700
@@ -21,7 +21,7 @@
 #include <linux/pagevec.h>
 #include <linux/init.h>
 #include <linux/mm_inline.h>
-#include <linux/buffer_head.h>
+#include <linux/buffer_head.h>	/* for try_to_release_page() */
 #include <linux/percpu.h>
 
 /* How many pages do we try to swap or page in/out together? */
diff -puN mm/swapfile.c~buffers-cleanup mm/swapfile.c
--- 25/mm/swapfile.c~buffers-cleanup	2003-04-15 00:11:32.000000000 -0700
+++ 25-akpm/mm/swapfile.c	2003-04-15 00:11:32.000000000 -0700
@@ -15,7 +15,6 @@
 #include <linux/namei.h>
 #include <linux/shm.h>
 #include <linux/blkdev.h>
-#include <linux/buffer_head.h>
 #include <linux/writeback.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
@@ -300,7 +299,7 @@ int remove_exclusive_swap_page(struct pa
 	struct swap_info_struct * p;
 	swp_entry_t entry;
 
-	BUG_ON(page_has_buffers(page));
+	BUG_ON(PagePrivate(page));
 	BUG_ON(!PageLocked(page));
 
 	if (!PageSwapCache(page))
@@ -355,7 +354,7 @@ void free_swap_and_cache(swp_entry_t ent
 	if (page) {
 		int one_user;
 
-		BUG_ON(page_has_buffers(page));
+		BUG_ON(PagePrivate(page));
 		page_cache_get(page);
 		one_user = (page_count(page) == 2);
 		/* Only cache user (+us), or swap space full? Free it! */
diff -puN mm/swap_state.c~buffers-cleanup mm/swap_state.c
--- 25/mm/swap_state.c~buffers-cleanup	2003-04-15 00:11:32.000000000 -0700
+++ 25-akpm/mm/swap_state.c	2003-04-15 00:11:32.000000000 -0700
@@ -13,7 +13,6 @@
 #include <linux/init.h>
 #include <linux/pagemap.h>
 #include <linux/backing-dev.h>
-#include <linux/buffer_head.h>	/* block_sync_page() */
 
 #include <asm/pgtable.h>
 
@@ -187,7 +186,7 @@ void delete_from_swap_cache(struct page 
 
 	BUG_ON(!PageLocked(page));
 	BUG_ON(PageWriteback(page));
-	BUG_ON(page_has_buffers(page));
+	BUG_ON(PagePrivate(page));
   
 	entry.val = page->index;
 
@@ -236,7 +235,7 @@ int move_from_swap_cache(struct page *pa
 
 	BUG_ON(!PageLocked(page));
 	BUG_ON(PageWriteback(page));
-	BUG_ON(page_has_buffers(page));
+	BUG_ON(PagePrivate(page));
 
 	entry.val = page->index;
 
diff -puN mm/vmscan.c~buffers-cleanup mm/vmscan.c
--- 25/mm/vmscan.c~buffers-cleanup	2003-04-15 00:11:32.000000000 -0700
+++ 25-akpm/mm/vmscan.c	2003-04-15 00:11:32.000000000 -0700
@@ -22,7 +22,8 @@
 #include <linux/writeback.h>
 #include <linux/suspend.h>
 #include <linux/blkdev.h>
-#include <linux/buffer_head.h>		/* for try_to_release_page() */
+#include <linux/buffer_head.h>	/* for try_to_release_page(),
+					buffer_heads_over_limit */
 #include <linux/mm_inline.h>
 #include <linux/pagevec.h>
 #include <linux/backing-dev.h>

_