Commit c2c4986eddaa7dc3d036cb2bfa5c8c5f1f2492a0

Authored by Jens Axboe
1 parent b403a98e26

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>

Showing 3 changed files with 7 additions and 0 deletions Side-by-side Diff

... ... @@ -37,6 +37,7 @@
37 37 #include <linux/kobject.h>
38 38 #include <linux/mutex.h>
39 39 #include <linux/file.h>
  40 +#include <linux/backing-dev.h>
40 41 #include <asm/uaccess.h>
41 42 #include "internal.h"
42 43  
include/linux/writeback.h
... ... @@ -106,10 +106,14 @@
106 106 /*
107 107 * mm/page-writeback.c
108 108 */
  109 +#ifdef CONFIG_BLOCK
109 110 void laptop_io_completion(struct backing_dev_info *info);
110 111 void laptop_sync_completion(void);
111 112 void laptop_mode_sync(struct work_struct *work);
112 113 void laptop_mode_timer_fn(unsigned long data);
  114 +#else
  115 +static inline void laptop_sync_completion(void) { }
  116 +#endif
113 117 void throttle_vm_writeout(gfp_t gfp_mask);
114 118  
115 119 /* These are exported to sysctl. */
... ... @@ -694,6 +694,7 @@
694 694 return 0;
695 695 }
696 696  
  697 +#ifdef CONFIG_BLOCK
697 698 void laptop_mode_timer_fn(unsigned long data)
698 699 {
699 700 struct request_queue *q = (struct request_queue *)data;
... ... @@ -735,6 +736,7 @@
735 736  
736 737 rcu_read_unlock();
737 738 }
  739 +#endif
738 740  
739 741 /*
740 742 * If ratelimit_pages is too high then we can get into dirty-data overload