aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-05-22 17:13:32 -0400
committerJens Axboe <axboe@fb.com>2015-06-02 10:33:34 -0400
commit66114cad64bf76a155fec1f0fff0de771cf909d5 (patch)
tree58d7b8646add87cb40973961757a1c3598f3ee4c /include
parent4610007142823307d930ac890d822633a05ce08c (diff)
writeback: separate out include/linux/backing-dev-defs.h
With the planned cgroup writeback support, backing-dev related declarations will be more widely used across block and cgroup; unfortunately, including backing-dev.h from include/linux/blkdev.h makes cyclic include dependency quite likely. This patch separates out backing-dev-defs.h which only has the essential definitions and updates blkdev.h to include it. c files which need access to more backing-dev details now include backing-dev.h directly. This takes backing-dev.h off the common include dependency chain making it a lot easier to use it across block and cgroup. v2: fs/fat build failure fixed. Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: Jan Kara <jack@suse.cz> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/backing-dev-defs.h106
-rw-r--r--include/linux/backing-dev.h102
-rw-r--r--include/linux/blkdev.h2
3 files changed, 108 insertions, 102 deletions
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
new file mode 100644
index 000000000000..aa18c4bd43c1
--- /dev/null
+++ b/include/linux/backing-dev-defs.h
@@ -0,0 +1,106 @@
1#ifndef __LINUX_BACKING_DEV_DEFS_H
2#define __LINUX_BACKING_DEV_DEFS_H
3
4#include <linux/list.h>
5#include <linux/spinlock.h>
6#include <linux/percpu_counter.h>
7#include <linux/flex_proportions.h>
8#include <linux/timer.h>
9#include <linux/workqueue.h>
10
11struct page;
12struct device;
13struct dentry;
14
15/*
16 * Bits in bdi_writeback.state
17 */
18enum wb_state {
19 WB_async_congested, /* The async (write) queue is getting full */
20 WB_sync_congested, /* The sync queue is getting full */
21 WB_registered, /* bdi_register() was done */
22 WB_writeback_running, /* Writeback is in progress */
23};
24
25typedef int (congested_fn)(void *, int);
26
27enum wb_stat_item {
28 WB_RECLAIMABLE,
29 WB_WRITEBACK,
30 WB_DIRTIED,
31 WB_WRITTEN,
32 NR_WB_STAT_ITEMS
33};
34
35#define WB_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
36
37struct bdi_writeback {
38 struct backing_dev_info *bdi; /* our parent bdi */
39
40 unsigned long state; /* Always use atomic bitops on this */
41 unsigned long last_old_flush; /* last old data flush */
42
43 struct list_head b_dirty; /* dirty inodes */
44 struct list_head b_io; /* parked for writeback */
45 struct list_head b_more_io; /* parked for more writeback */
46 struct list_head b_dirty_time; /* time stamps are dirty */
47 spinlock_t list_lock; /* protects the b_* lists */
48
49 struct percpu_counter stat[NR_WB_STAT_ITEMS];
50
51 unsigned long bw_time_stamp; /* last time write bw is updated */
52 unsigned long dirtied_stamp;
53 unsigned long written_stamp; /* pages written at bw_time_stamp */
54 unsigned long write_bandwidth; /* the estimated write bandwidth */
55 unsigned long avg_write_bandwidth; /* further smoothed write bw */
56
57 /*
58 * The base dirty throttle rate, re-calculated on every 200ms.
59 * All the bdi tasks' dirty rate will be curbed under it.
60 * @dirty_ratelimit tracks the estimated @balanced_dirty_ratelimit
61 * in small steps and is much more smooth/stable than the latter.
62 */
63 unsigned long dirty_ratelimit;
64 unsigned long balanced_dirty_ratelimit;
65
66 struct fprop_local_percpu completions;
67 int dirty_exceeded;
68
69 spinlock_t work_lock; /* protects work_list & dwork scheduling */
70 struct list_head work_list;
71 struct delayed_work dwork; /* work item used for writeback */
72};
73
74struct backing_dev_info {
75 struct list_head bdi_list;
76 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
77 unsigned int capabilities; /* Device capabilities */
78 congested_fn *congested_fn; /* Function pointer if device is md/dm */
79 void *congested_data; /* Pointer to aux data for congested func */
80
81 char *name;
82
83 unsigned int min_ratio;
84 unsigned int max_ratio, max_prop_frac;
85
86 struct bdi_writeback wb; /* default writeback info for this bdi */
87
88 struct device *dev;
89
90 struct timer_list laptop_mode_wb_timer;
91
92#ifdef CONFIG_DEBUG_FS
93 struct dentry *debug_dir;
94 struct dentry *debug_stats;
95#endif
96};
97
98enum {
99 BLK_RW_ASYNC = 0,
100 BLK_RW_SYNC = 1,
101};
102
103void clear_bdi_congested(struct backing_dev_info *bdi, int sync);
104void set_bdi_congested(struct backing_dev_info *bdi, int sync);
105
106#endif /* __LINUX_BACKING_DEV_DEFS_H */
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index d796f49ce87a..5e39f7a8efed 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -8,104 +8,11 @@
8#ifndef _LINUX_BACKING_DEV_H 8#ifndef _LINUX_BACKING_DEV_H
9#define _LINUX_BACKING_DEV_H 9#define _LINUX_BACKING_DEV_H
10 10
11#include <linux/percpu_counter.h>
12#include <linux/log2.h>
13#include <linux/flex_proportions.h>
14#include <linux/kernel.h> 11#include <linux/kernel.h>
15#include <linux/fs.h> 12#include <linux/fs.h>
16#include <linux/sched.h> 13#include <linux/sched.h>
17#include <linux/timer.h>
18#include <linux/writeback.h> 14#include <linux/writeback.h>
19#include <linux/atomic.h> 15#include <linux/backing-dev-defs.h>
20#include <linux/sysctl.h>
21#include <linux/workqueue.h>
22
23struct page;
24struct device;
25struct dentry;
26
27/*
28 * Bits in bdi_writeback.state
29 */
30enum wb_state {
31 WB_async_congested, /* The async (write) queue is getting full */
32 WB_sync_congested, /* The sync queue is getting full */
33 WB_registered, /* bdi_register() was done */
34 WB_writeback_running, /* Writeback is in progress */
35};
36
37typedef int (congested_fn)(void *, int);
38
39enum wb_stat_item {
40 WB_RECLAIMABLE,
41 WB_WRITEBACK,
42 WB_DIRTIED,
43 WB_WRITTEN,
44 NR_WB_STAT_ITEMS
45};
46
47#define WB_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
48
49struct bdi_writeback {
50 struct backing_dev_info *bdi; /* our parent bdi */
51
52 unsigned long state; /* Always use atomic bitops on this */
53 unsigned long last_old_flush; /* last old data flush */
54
55 struct list_head b_dirty; /* dirty inodes */
56 struct list_head b_io; /* parked for writeback */
57 struct list_head b_more_io; /* parked for more writeback */
58 struct list_head b_dirty_time; /* time stamps are dirty */
59 spinlock_t list_lock; /* protects the b_* lists */
60
61 struct percpu_counter stat[NR_WB_STAT_ITEMS];
62
63 unsigned long bw_time_stamp; /* last time write bw is updated */
64 unsigned long dirtied_stamp;
65 unsigned long written_stamp; /* pages written at bw_time_stamp */
66 unsigned long write_bandwidth; /* the estimated write bandwidth */
67 unsigned long avg_write_bandwidth; /* further smoothed write bw */
68
69 /*
70 * The base dirty throttle rate, re-calculated on every 200ms.
71 * All the bdi tasks' dirty rate will be curbed under it.
72 * @dirty_ratelimit tracks the estimated @balanced_dirty_ratelimit
73 * in small steps and is much more smooth/stable than the latter.
74 */
75 unsigned long dirty_ratelimit;
76 unsigned long balanced_dirty_ratelimit;
77
78 struct fprop_local_percpu completions;
79 int dirty_exceeded;
80
81 spinlock_t work_lock; /* protects work_list & dwork scheduling */
82 struct list_head work_list;
83 struct delayed_work dwork; /* work item used for writeback */
84};
85
86struct backing_dev_info {
87 struct list_head bdi_list;
88 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
89 unsigned int capabilities; /* Device capabilities */
90 congested_fn *congested_fn; /* Function pointer if device is md/dm */
91 void *congested_data; /* Pointer to aux data for congested func */
92
93 char *name;
94
95 unsigned int min_ratio;
96 unsigned int max_ratio, max_prop_frac;
97
98 struct bdi_writeback wb; /* default writeback info for this bdi */
99
100 struct device *dev;
101
102 struct timer_list laptop_mode_wb_timer;
103
104#ifdef CONFIG_DEBUG_FS
105 struct dentry *debug_dir;
106 struct dentry *debug_stats;
107#endif
108};
109 16
110struct backing_dev_info *inode_to_bdi(struct inode *inode); 17struct backing_dev_info *inode_to_bdi(struct inode *inode);
111 18
@@ -265,13 +172,6 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi)
265 (1 << WB_async_congested)); 172 (1 << WB_async_congested));
266} 173}
267 174
268enum {
269 BLK_RW_ASYNC = 0,
270 BLK_RW_SYNC = 1,
271};
272
273void clear_bdi_congested(struct backing_dev_info *bdi, int sync);
274void set_bdi_congested(struct backing_dev_info *bdi, int sync);
275long congestion_wait(int sync, long timeout); 175long congestion_wait(int sync, long timeout);
276long wait_iff_congested(struct zone *zone, int sync, long timeout); 176long wait_iff_congested(struct zone *zone, int sync, long timeout);
277int pdflush_proc_obsolete(struct ctl_table *table, int write, 177int pdflush_proc_obsolete(struct ctl_table *table, int write,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ccaa9aecd593..60d2726a6b62 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -12,7 +12,7 @@
12#include <linux/timer.h> 12#include <linux/timer.h>
13#include <linux/workqueue.h> 13#include <linux/workqueue.h>
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15#include <linux/backing-dev.h> 15#include <linux/backing-dev-defs.h>
16#include <linux/wait.h> 16#include <linux/wait.h>
17#include <linux/mempool.h> 17#include <linux/mempool.h>
18#include <linux/bio.h> 18#include <linux/bio.h>