goto err;
}
- if (atomic_add_return(1, &blk_probes_ref) == 1)
+ if (atomic_inc_return(&blk_probes_ref) == 1)
blk_register_tracepoints();
return 0;
static void blk_tracer_start(struct trace_array *tr)
{
- if (atomic_add_return(1, &blk_probes_ref) == 1)
- blk_register_tracepoints();
trace_flags &= ~TRACE_ITER_CONTEXT_INFO;
}
static void blk_tracer_stop(struct trace_array *tr)
{
trace_flags |= TRACE_ITER_CONTEXT_INFO;
- if (atomic_dec_and_test(&blk_probes_ref))
- blk_unregister_tracepoints();
}
static void blk_tracer_reset(struct trace_array *tr)
{
- if (!atomic_read(&blk_probes_ref))
- return;
-
blk_tracer_enabled = false;
blk_tracer_stop(tr);
}
if (bt == NULL)
return -EINVAL;
+ if (atomic_dec_and_test(&blk_probes_ref))
+ blk_unregister_tracepoints();
+
kfree(bt);
return 0;
}
return -EBUSY;
}
+ if (atomic_inc_return(&blk_probes_ref) == 1)
+ blk_register_tracepoints();
+
return 0;
}