Commit e814e71b authored by Jens Axboe's avatar Jens Axboe

blk-mq: allow the hctx cpu hotplug notifier to return errors

Prepare this for the next patch which adds more smarts in the
plugging logic, so that we can save some memory.
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent da41a589
...@@ -18,14 +18,18 @@ static int blk_mq_main_cpu_notify(struct notifier_block *self, ...@@ -18,14 +18,18 @@ static int blk_mq_main_cpu_notify(struct notifier_block *self,
{ {
unsigned int cpu = (unsigned long) hcpu; unsigned int cpu = (unsigned long) hcpu;
struct blk_mq_cpu_notifier *notify; struct blk_mq_cpu_notifier *notify;
int ret = NOTIFY_OK;
raw_spin_lock(&blk_mq_cpu_notify_lock); raw_spin_lock(&blk_mq_cpu_notify_lock);
list_for_each_entry(notify, &blk_mq_cpu_notify_list, list) list_for_each_entry(notify, &blk_mq_cpu_notify_list, list) {
notify->notify(notify->data, action, cpu); ret = notify->notify(notify->data, action, cpu);
if (ret != NOTIFY_OK)
break;
}
raw_spin_unlock(&blk_mq_cpu_notify_lock); raw_spin_unlock(&blk_mq_cpu_notify_lock);
return NOTIFY_OK; return ret;
} }
void blk_mq_register_cpu_notifier(struct blk_mq_cpu_notifier *notifier) void blk_mq_register_cpu_notifier(struct blk_mq_cpu_notifier *notifier)
...@@ -45,7 +49,7 @@ void blk_mq_unregister_cpu_notifier(struct blk_mq_cpu_notifier *notifier) ...@@ -45,7 +49,7 @@ void blk_mq_unregister_cpu_notifier(struct blk_mq_cpu_notifier *notifier)
} }
void blk_mq_init_cpu_notifier(struct blk_mq_cpu_notifier *notifier, void blk_mq_init_cpu_notifier(struct blk_mq_cpu_notifier *notifier,
void (*fn)(void *, unsigned long, unsigned int), int (*fn)(void *, unsigned long, unsigned int),
void *data) void *data)
{ {
notifier->notify = fn; notifier->notify = fn;
......
...@@ -1196,7 +1196,7 @@ void blk_mq_free_single_hw_queue(struct blk_mq_hw_ctx *hctx, ...@@ -1196,7 +1196,7 @@ void blk_mq_free_single_hw_queue(struct blk_mq_hw_ctx *hctx,
} }
EXPORT_SYMBOL(blk_mq_free_single_hw_queue); EXPORT_SYMBOL(blk_mq_free_single_hw_queue);
static void blk_mq_hctx_notify(void *data, unsigned long action, static int blk_mq_hctx_notify(void *data, unsigned long action,
unsigned int cpu) unsigned int cpu)
{ {
struct blk_mq_hw_ctx *hctx = data; struct blk_mq_hw_ctx *hctx = data;
...@@ -1205,7 +1205,7 @@ static void blk_mq_hctx_notify(void *data, unsigned long action, ...@@ -1205,7 +1205,7 @@ static void blk_mq_hctx_notify(void *data, unsigned long action,
LIST_HEAD(tmp); LIST_HEAD(tmp);
if (action != CPU_DEAD && action != CPU_DEAD_FROZEN) if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)
return; return NOTIFY_OK;
/* /*
* Move ctx entries to new CPU, if this one is going away. * Move ctx entries to new CPU, if this one is going away.
...@@ -1220,7 +1220,7 @@ static void blk_mq_hctx_notify(void *data, unsigned long action, ...@@ -1220,7 +1220,7 @@ static void blk_mq_hctx_notify(void *data, unsigned long action,
spin_unlock(&ctx->lock); spin_unlock(&ctx->lock);
if (list_empty(&tmp)) if (list_empty(&tmp))
return; return NOTIFY_OK;
ctx = blk_mq_get_ctx(q); ctx = blk_mq_get_ctx(q);
spin_lock(&ctx->lock); spin_lock(&ctx->lock);
...@@ -1240,6 +1240,7 @@ static void blk_mq_hctx_notify(void *data, unsigned long action, ...@@ -1240,6 +1240,7 @@ static void blk_mq_hctx_notify(void *data, unsigned long action,
blk_mq_run_hw_queue(hctx, true); blk_mq_run_hw_queue(hctx, true);
blk_mq_put_ctx(ctx); blk_mq_put_ctx(ctx);
return NOTIFY_OK;
} }
static void blk_mq_free_rq_map(struct blk_mq_tag_set *set, static void blk_mq_free_rq_map(struct blk_mq_tag_set *set,
......
...@@ -39,7 +39,7 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr); ...@@ -39,7 +39,7 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr);
*/ */
struct blk_mq_cpu_notifier; struct blk_mq_cpu_notifier;
void blk_mq_init_cpu_notifier(struct blk_mq_cpu_notifier *notifier, void blk_mq_init_cpu_notifier(struct blk_mq_cpu_notifier *notifier,
void (*fn)(void *, unsigned long, unsigned int), int (*fn)(void *, unsigned long, unsigned int),
void *data); void *data);
void blk_mq_register_cpu_notifier(struct blk_mq_cpu_notifier *notifier); void blk_mq_register_cpu_notifier(struct blk_mq_cpu_notifier *notifier);
void blk_mq_unregister_cpu_notifier(struct blk_mq_cpu_notifier *notifier); void blk_mq_unregister_cpu_notifier(struct blk_mq_cpu_notifier *notifier);
......
...@@ -8,7 +8,7 @@ struct blk_mq_tags; ...@@ -8,7 +8,7 @@ struct blk_mq_tags;
struct blk_mq_cpu_notifier { struct blk_mq_cpu_notifier {
struct list_head list; struct list_head list;
void *data; void *data;
void (*notify)(void *data, unsigned long action, unsigned int cpu); int (*notify)(void *data, unsigned long action, unsigned int cpu);
}; };
struct blk_mq_ctxmap { struct blk_mq_ctxmap {
......
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