提交 ddde2af7 编写于 作者: R Roman Gushchin 提交者: Dennis Zhou

md: initialize percpu refcounters using PERCU_REF_ALLOW_REINIT

Percpu reference counters should now be initialized with the
PERCPU_REF_ALLOW_REINIT in order to allow switching them to the
percpu mode from the atomic mode.
To make percpu_ref_switch_to_percpu() call in set_in_sync()
succeed,let's initialize percpu refcounters with the
PERCU_REF_ALLOW_REINIT flag.
Signed-off-by: NRoman Gushchin <guro@fb.com>
Acked-by: NTejun Heo <tj@kernel.org>
Signed-off-by: NDennis Zhou <dennis@kernel.org>
上级 21482896
...@@ -5249,7 +5249,8 @@ int mddev_init_writes_pending(struct mddev *mddev) ...@@ -5249,7 +5249,8 @@ int mddev_init_writes_pending(struct mddev *mddev)
{ {
if (mddev->writes_pending.percpu_count_ptr) if (mddev->writes_pending.percpu_count_ptr)
return 0; return 0;
if (percpu_ref_init(&mddev->writes_pending, no_op, 0, GFP_KERNEL) < 0) if (percpu_ref_init(&mddev->writes_pending, no_op,
PERCPU_REF_ALLOW_REINIT, GFP_KERNEL) < 0)
return -ENOMEM; return -ENOMEM;
/* We want to start with the refcount at zero */ /* We want to start with the refcount at zero */
percpu_ref_put(&mddev->writes_pending); percpu_ref_put(&mddev->writes_pending);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册