Skip to content

Commit

Permalink
blktrace: make blk_tracer_enabled a bool flag
Browse files Browse the repository at this point in the history
It doesn't have to be a counter, and it can be a bool flag instead.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <49C2F5D3.8090104@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Li Zefan authored and Ingo Molnar committed Mar 21, 2009
1 parent 1a17662 commit 5006ea7
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions kernel/trace/blktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
static unsigned int blktrace_seq __read_mostly = 1;

static struct trace_array *blk_tr;
static int __read_mostly blk_tracer_enabled;
static bool blk_tracer_enabled __read_mostly;

/* Select an alternative, minimalistic output than the original one */
#define TRACE_BLK_OPT_CLASSIC 0x1
Expand Down Expand Up @@ -1111,9 +1111,7 @@ static int blk_tracer_init(struct trace_array *tr)
{
blk_tr = tr;
blk_tracer_start(tr);
mutex_lock(&blk_probe_mutex);
blk_tracer_enabled++;
mutex_unlock(&blk_probe_mutex);
blk_tracer_enabled = true;
return 0;
}

Expand All @@ -1131,11 +1129,7 @@ static void blk_tracer_reset(struct trace_array *tr)
if (!atomic_read(&blk_probes_ref))
return;

mutex_lock(&blk_probe_mutex);
blk_tracer_enabled--;
WARN_ON(blk_tracer_enabled < 0);
mutex_unlock(&blk_probe_mutex);

blk_tracer_enabled = false;
blk_tracer_stop(tr);
}

Expand Down

0 comments on commit 5006ea7

Please sign in to comment.