diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2016-11-03 10:49:57 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-11-09 17:45:25 -0500 |
commit | fc4d24c9b47150245b3eb5bebc2ad4764c754ef4 (patch) | |
tree | 9637721c6c38597bad1ac2720df508b3ad30b4dd /fs/buffer.c | |
parent | bc33b0ca11e3df467777a4fa7639ba488c9d4911 (diff) |
fs/buffer: Convert to hotplug state machine
Install the callbacks via the state machine.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-fsdevel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20161103145021.28528-2-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index b205a629001d..1613656028d6 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -3403,7 +3403,7 @@ void free_buffer_head(struct buffer_head *bh) | |||
3403 | } | 3403 | } |
3404 | EXPORT_SYMBOL(free_buffer_head); | 3404 | EXPORT_SYMBOL(free_buffer_head); |
3405 | 3405 | ||
3406 | static void buffer_exit_cpu(int cpu) | 3406 | static int buffer_exit_cpu_dead(unsigned int cpu) |
3407 | { | 3407 | { |
3408 | int i; | 3408 | int i; |
3409 | struct bh_lru *b = &per_cpu(bh_lrus, cpu); | 3409 | struct bh_lru *b = &per_cpu(bh_lrus, cpu); |
@@ -3414,14 +3414,7 @@ static void buffer_exit_cpu(int cpu) | |||
3414 | } | 3414 | } |
3415 | this_cpu_add(bh_accounting.nr, per_cpu(bh_accounting, cpu).nr); | 3415 | this_cpu_add(bh_accounting.nr, per_cpu(bh_accounting, cpu).nr); |
3416 | per_cpu(bh_accounting, cpu).nr = 0; | 3416 | per_cpu(bh_accounting, cpu).nr = 0; |
3417 | } | 3417 | return 0; |
3418 | |||
3419 | static int buffer_cpu_notify(struct notifier_block *self, | ||
3420 | unsigned long action, void *hcpu) | ||
3421 | { | ||
3422 | if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) | ||
3423 | buffer_exit_cpu((unsigned long)hcpu); | ||
3424 | return NOTIFY_OK; | ||
3425 | } | 3418 | } |
3426 | 3419 | ||
3427 | /** | 3420 | /** |
@@ -3471,6 +3464,7 @@ EXPORT_SYMBOL(bh_submit_read); | |||
3471 | void __init buffer_init(void) | 3464 | void __init buffer_init(void) |
3472 | { | 3465 | { |
3473 | unsigned long nrpages; | 3466 | unsigned long nrpages; |
3467 | int ret; | ||
3474 | 3468 | ||
3475 | bh_cachep = kmem_cache_create("buffer_head", | 3469 | bh_cachep = kmem_cache_create("buffer_head", |
3476 | sizeof(struct buffer_head), 0, | 3470 | sizeof(struct buffer_head), 0, |
@@ -3483,5 +3477,7 @@ void __init buffer_init(void) | |||
3483 | */ | 3477 | */ |
3484 | nrpages = (nr_free_buffer_pages() * 10) / 100; | 3478 | nrpages = (nr_free_buffer_pages() * 10) / 100; |
3485 | max_buffer_heads = nrpages * (PAGE_SIZE / sizeof(struct buffer_head)); | 3479 | max_buffer_heads = nrpages * (PAGE_SIZE / sizeof(struct buffer_head)); |
3486 | hotcpu_notifier(buffer_cpu_notify, 0); | 3480 | ret = cpuhp_setup_state_nocalls(CPUHP_FS_BUFF_DEAD, "fs/buffer:dead", |
3481 | NULL, buffer_exit_cpu_dead); | ||
3482 | WARN_ON(ret < 0); | ||
3487 | } | 3483 | } |