Skip to contentSkip to conversation

include buffer_head.h in actual users instead of fs.h (6/10)

PATCH In review Christoph Hellwig 2 participants 2 messages May 23, 2002

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 include buffer_head.h in actual users instead of fs.h (6/10)

Make the 7 file that need it in mm/ include buffer_head.h directly. Once again most files shouln't need it and want fixing.

mm/filemap.c +10 -0
@@ -20,6 +20,16 @@
 #include <linux/iobuf.h>
 #include <linux/hash.h>
 #include <linux/writeback.h>
+/*
+ * This is needed for the following functions:
+ *  - try_to_release_page
+ *  - block_flushpage
+ *  - page_has_buffers
+ *  - generic_osync_inode
+ *
+ * FIXME: remove all knowledge of the buffer layer from this file
+ */
+#include <linux/buffer_head.h>
 
 #include <asm/uaccess.h>
 #include <asm/mman.h>
mm/mempool.c +1 -0
@@ -12,6 +12,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/mempool.h>
+#include <linux/buffer_head.h>		/* for wakeup_bdflush() */
 
 static void add_element(mempool_t *pool, void *element)
 {
mm/page-writeback.c +3 -0
@@ -478,7 +478,10 @@
  *
  * For now, we treat swapper_space specially.  It doesn't use the normal
  * block a_ops.
+ *
+ * FIXME: this should move over to fs/buffer.c - buffer_heads have no business in mm/
  */
+#include <linux/buffer_head.h>
 int __set_page_dirty_buffers(struct page *page)
 {
 	struct address_space * const mapping = page->mapping;
mm/page_io.c +1 -0
@@ -15,6 +15,7 @@
 #include <linux/pagemap.h>
 #include <linux/swap.h>
 #include <linux/swapctl.h>
+#include <linux/buffer_head.h>		/* for brw_page() */
 
 #include <asm/pgtable.h>
 
mm/swap_state.c +1 -0
@@ -14,6 +14,7 @@
 #include <linux/init.h>
 #include <linux/pagemap.h>
 #include <linux/smp_lock.h>
+#include <linux/buffer_head.h>	/* for block_sync_page()/block_flushpage() */
 
 #include <asm/pgtable.h>
 
mm/swapfile.c +1 -1
@@ -16,7 +16,7 @@
 #include <linux/namei.h>
 #include <linux/shm.h>
 #include <linux/blkdev.h>
-#include <linux/compiler.h>
+#include <linux/buffer_head.h>		/* for block_flushpage() */
 
 #include <asm/pgtable.h>
 
mm/vmscan.c +1 -1
@@ -22,8 +22,8 @@
 #include <linux/highmem.h>
 #include <linux/file.h>
 #include <linux/writeback.h>
-#include <linux/compiler.h>
 #include <linux/suspend.h>
+#include <linux/buffer_head.h>		/* for try_to_release_page() */
 
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
#1 lore raw
Quoted 3 lines · Christoph Hellwig

Make the 7 file that need it in mm/ include buffer_head.h directly. Once again most files shouln't need it and want fixing.

Yup. In fact, some declarations need to be moved out of buffer_head.h.

mm/filemap.c Thu May 23 13:19:05 2002 line 25

Quoted 9 lines
mm/filemap.c Thu May 23 13:19:05 2002 renamed from mm/filemap.c Sun May 19 13:49:50 2002 +3 -0
@@ -20,6 +20,16 @@
 #include <linux/iobuf.h>
 #include <linux/hash.h>
 #include <linux/writeback.h>
+/*
+ * This is needed for the following functions:
+ *  - try_to_release_page

This isn't buffer-specific; should be in mm.h or similar.

mm/filemap.c Thu May 23 13:19:05 2002 line 26

Quoted 1 line
mm/filemap.c Thu May 23 13:19:05 2002 renamed from mm/filemap.c Sun May 19 13:49:50 2002 +1 -0
+ *  - block_flushpage

Should never be called - all callers should call call a_ops->flushpage() (and rename it to invalidatepage, for heavens sake)

mm/filemap.c Thu May 23 13:19:05 2002 line 27

Quoted 1 line
mm/filemap.c Thu May 23 13:19:05 2002 renamed from mm/filemap.c Sun May 19 13:49:50 2002 +1 -0
+ *  - page_has_buffers

well hopefully we can do something a little tidier than all the invalidate_foo2() functions. But that's in fact a happens-to-not-matter bug. Should be using PagePrivate() in invalidate_this_page2()

mm/filemap.c Thu May 23 13:19:05 2002 line 28

Quoted 1 line
mm/filemap.c Thu May 23 13:19:05 2002 renamed from mm/filemap.c Sun May 19 13:49:50 2002 +1 -0
+ *  - generic_osync_inode

Sigh. Needs to be pushed out to generic_file_write() callers, I suspect.

etc...

-