summaryrefslogtreecommitdiffstats
path: root/mm/backing-dev.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2007-10-16 23:25:47 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 08:42:45 -0700
commitb2e8fb6efa209c82203c79b491b5bc952d44aa57 (patch)
treee4c82e3f2c70a188ced7126435bf153f5f6c4a1c /mm/backing-dev.c
parente0bf68ddec4f4f90e5871404be4f1854c17f3120 (diff)
downloadop-kernel-dev-b2e8fb6efa209c82203c79b491b5bc952d44aa57.zip
op-kernel-dev-b2e8fb6efa209c82203c79b491b5bc952d44aa57.tar.gz
mm: scalable bdi statistics counters
Provide scalable per backing_dev_info statistics counters. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/backing-dev.c')
-rw-r--r--mm/backing-dev.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 841901a..a47065e 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -5,6 +5,33 @@
#include <linux/sched.h>
#include <linux/module.h>
+int bdi_init(struct backing_dev_info *bdi)
+{
+ int i, j;
+ int err;
+
+ for (i = 0; i < NR_BDI_STAT_ITEMS; i++) {
+ err = percpu_counter_init_irq(&bdi->bdi_stat[i], 0);
+ if (err) {
+ for (j = 0; j < i; j++)
+ percpu_counter_destroy(&bdi->bdi_stat[i]);
+ break;
+ }
+ }
+
+ return err;
+}
+EXPORT_SYMBOL(bdi_init);
+
+void bdi_destroy(struct backing_dev_info *bdi)
+{
+ int i;
+
+ for (i = 0; i < NR_BDI_STAT_ITEMS; i++)
+ percpu_counter_destroy(&bdi->bdi_stat[i]);
+}
+EXPORT_SYMBOL(bdi_destroy);
+
static wait_queue_head_t congestion_wqh[2] = {
__WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
__WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
OpenPOWER on IntegriCloud