Commit fc4d24c9 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Thomas Gleixner

fs/buffer: Convert to hotplug state machine

Install the callbacks via the state machine.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarThomas 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.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent bc33b0ca
...@@ -3403,7 +3403,7 @@ void free_buffer_head(struct buffer_head *bh) ...@@ -3403,7 +3403,7 @@ void free_buffer_head(struct buffer_head *bh)
} }
EXPORT_SYMBOL(free_buffer_head); EXPORT_SYMBOL(free_buffer_head);
static void buffer_exit_cpu(int cpu) static int buffer_exit_cpu_dead(unsigned int cpu)
{ {
int i; int i;
struct bh_lru *b = &per_cpu(bh_lrus, cpu); struct bh_lru *b = &per_cpu(bh_lrus, cpu);
...@@ -3414,14 +3414,7 @@ static void buffer_exit_cpu(int cpu) ...@@ -3414,14 +3414,7 @@ static void buffer_exit_cpu(int cpu)
} }
this_cpu_add(bh_accounting.nr, per_cpu(bh_accounting, cpu).nr); this_cpu_add(bh_accounting.nr, per_cpu(bh_accounting, cpu).nr);
per_cpu(bh_accounting, cpu).nr = 0; per_cpu(bh_accounting, cpu).nr = 0;
} return 0;
static int buffer_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu)
{
if (action == CPU_DEAD || action == CPU_DEAD_FROZEN)
buffer_exit_cpu((unsigned long)hcpu);
return NOTIFY_OK;
} }
/** /**
...@@ -3471,6 +3464,7 @@ EXPORT_SYMBOL(bh_submit_read); ...@@ -3471,6 +3464,7 @@ EXPORT_SYMBOL(bh_submit_read);
void __init buffer_init(void) void __init buffer_init(void)
{ {
unsigned long nrpages; unsigned long nrpages;
int ret;
bh_cachep = kmem_cache_create("buffer_head", bh_cachep = kmem_cache_create("buffer_head",
sizeof(struct buffer_head), 0, sizeof(struct buffer_head), 0,
...@@ -3483,5 +3477,7 @@ void __init buffer_init(void) ...@@ -3483,5 +3477,7 @@ void __init buffer_init(void)
*/ */
nrpages = (nr_free_buffer_pages() * 10) / 100; nrpages = (nr_free_buffer_pages() * 10) / 100;
max_buffer_heads = nrpages * (PAGE_SIZE / sizeof(struct buffer_head)); max_buffer_heads = nrpages * (PAGE_SIZE / sizeof(struct buffer_head));
hotcpu_notifier(buffer_cpu_notify, 0); ret = cpuhp_setup_state_nocalls(CPUHP_FS_BUFF_DEAD, "fs/buffer:dead",
NULL, buffer_exit_cpu_dead);
WARN_ON(ret < 0);
} }
...@@ -30,6 +30,7 @@ enum cpuhp_state { ...@@ -30,6 +30,7 @@ enum cpuhp_state {
CPUHP_ACPI_CPUDRV_DEAD, CPUHP_ACPI_CPUDRV_DEAD,
CPUHP_S390_PFAULT_DEAD, CPUHP_S390_PFAULT_DEAD,
CPUHP_BLK_MQ_DEAD, CPUHP_BLK_MQ_DEAD,
CPUHP_FS_BUFF_DEAD,
CPUHP_WORKQUEUE_PREP, CPUHP_WORKQUEUE_PREP,
CPUHP_POWER_NUMA_PREPARE, CPUHP_POWER_NUMA_PREPARE,
CPUHP_HRTIMERS_PREPARE, CPUHP_HRTIMERS_PREPARE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment