diff options
Diffstat (limited to 'mm/backing-dev.c')
-rw-r--r-- | mm/backing-dev.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 841901a95595..a47065e084a4 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -5,6 +5,33 @@ | |||
5 | #include <linux/sched.h> | 5 | #include <linux/sched.h> |
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
7 | 7 | ||
8 | int bdi_init(struct backing_dev_info *bdi) | ||
9 | { | ||
10 | int i, j; | ||
11 | int err; | ||
12 | |||
13 | for (i = 0; i < NR_BDI_STAT_ITEMS; i++) { | ||
14 | err = percpu_counter_init_irq(&bdi->bdi_stat[i], 0); | ||
15 | if (err) { | ||
16 | for (j = 0; j < i; j++) | ||
17 | percpu_counter_destroy(&bdi->bdi_stat[i]); | ||
18 | break; | ||
19 | } | ||
20 | } | ||
21 | |||
22 | return err; | ||
23 | } | ||
24 | EXPORT_SYMBOL(bdi_init); | ||
25 | |||
26 | void bdi_destroy(struct backing_dev_info *bdi) | ||
27 | { | ||
28 | int i; | ||
29 | |||
30 | for (i = 0; i < NR_BDI_STAT_ITEMS; i++) | ||
31 | percpu_counter_destroy(&bdi->bdi_stat[i]); | ||
32 | } | ||
33 | EXPORT_SYMBOL(bdi_destroy); | ||
34 | |||
8 | static wait_queue_head_t congestion_wqh[2] = { | 35 | static wait_queue_head_t congestion_wqh[2] = { |
9 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]), | 36 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]), |
10 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) | 37 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) |