瀏覽代碼

writeback: fix problem with !CONFIG_BLOCK compilation

When CONFIG_BLOCK isn't enabled:

mm/page-writeback.c: In function 'laptop_mode_timer_fn':
mm/page-writeback.c:708: error: dereferencing pointer to incomplete type
mm/page-writeback.c:709: error: dereferencing pointer to incomplete type

Fix this by essentially eliminating the laptop sync handlers when
CONFIG_BLOCK isn't set, as most are only used from the block layer code.
The exception is laptop_sync_completion() which is used from sys_sync(),
make that an empty declaration in that case.

Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe 15 年之前
父節點
當前提交
c2c4986edd
共有 3 個文件被更改,包括 7 次插入0 次删除
  1. 1 0
      fs/super.c
  2. 4 0
      include/linux/writeback.h
  3. 2 0
      mm/page-writeback.c

+ 1 - 0
fs/super.c

@@ -37,6 +37,7 @@
 #include <linux/kobject.h>
 #include <linux/kobject.h>
 #include <linux/mutex.h>
 #include <linux/mutex.h>
 #include <linux/file.h>
 #include <linux/file.h>
+#include <linux/backing-dev.h>
 #include <asm/uaccess.h>
 #include <asm/uaccess.h>
 #include "internal.h"
 #include "internal.h"
 
 

+ 4 - 0
include/linux/writeback.h

@@ -106,10 +106,14 @@ static inline void inode_sync_wait(struct inode *inode)
 /*
 /*
  * mm/page-writeback.c
  * mm/page-writeback.c
  */
  */
+#ifdef CONFIG_BLOCK
 void laptop_io_completion(struct backing_dev_info *info);
 void laptop_io_completion(struct backing_dev_info *info);
 void laptop_sync_completion(void);
 void laptop_sync_completion(void);
 void laptop_mode_sync(struct work_struct *work);
 void laptop_mode_sync(struct work_struct *work);
 void laptop_mode_timer_fn(unsigned long data);
 void laptop_mode_timer_fn(unsigned long data);
+#else
+static inline void laptop_sync_completion(void) { }
+#endif
 void throttle_vm_writeout(gfp_t gfp_mask);
 void throttle_vm_writeout(gfp_t gfp_mask);
 
 
 /* These are exported to sysctl. */
 /* These are exported to sysctl. */

+ 2 - 0
mm/page-writeback.c

@@ -694,6 +694,7 @@ int dirty_writeback_centisecs_handler(ctl_table *table, int write,
 	return 0;
 	return 0;
 }
 }
 
 
+#ifdef CONFIG_BLOCK
 void laptop_mode_timer_fn(unsigned long data)
 void laptop_mode_timer_fn(unsigned long data)
 {
 {
 	struct request_queue *q = (struct request_queue *)data;
 	struct request_queue *q = (struct request_queue *)data;
@@ -735,6 +736,7 @@ void laptop_sync_completion(void)
 
 
 	rcu_read_unlock();
 	rcu_read_unlock();
 }
 }
+#endif
 
 
 /*
 /*
  * If ratelimit_pages is too high then we can get into dirty-data overload
  * If ratelimit_pages is too high then we can get into dirty-data overload