Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97418
b: refs/heads/master
c: 6456591
h: refs/heads/master
v: v3
  • Loading branch information
Jens Axboe committed May 28, 2008
1 parent cf8d7f9 commit 16bd8e0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4722dc52a891ab6cb2d637ddb87233e0ce277827
refs/heads/master: 64565911cdb57c2f512a9715b985b5617402cc67
15 changes: 12 additions & 3 deletions trunk/block/blktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,16 @@ void __trace_note_message(struct blk_trace *bt, const char *fmt, ...)
{
int n;
va_list args;
static char bt_msg_buf[BLK_TN_MAX_MSG];
char *buf;

preempt_disable();
buf = per_cpu_ptr(bt->msg_data, smp_processor_id());
va_start(args, fmt);
n = vscnprintf(bt_msg_buf, BLK_TN_MAX_MSG, fmt, args);
n = vscnprintf(buf, BLK_TN_MAX_MSG, fmt, args);
va_end(args);

trace_note(bt, 0, BLK_TN_MESSAGE, bt_msg_buf, n);
trace_note(bt, 0, BLK_TN_MESSAGE, buf, n);
preempt_enable();
}
EXPORT_SYMBOL_GPL(__trace_note_message);

Expand Down Expand Up @@ -246,6 +249,7 @@ static void blk_trace_cleanup(struct blk_trace *bt)
debugfs_remove(bt->dropped_file);
blk_remove_tree(bt->dir);
free_percpu(bt->sequence);
free_percpu(bt->msg_data);
kfree(bt);
}

Expand Down Expand Up @@ -360,6 +364,10 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
if (!bt->sequence)
goto err;

bt->msg_data = __alloc_percpu(BLK_TN_MAX_MSG);
if (!bt->msg_data)
goto err;

ret = -ENOENT;
dir = blk_create_tree(buts->name);
if (!dir)
Expand Down Expand Up @@ -406,6 +414,7 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
if (bt->dropped_file)
debugfs_remove(bt->dropped_file);
free_percpu(bt->sequence);
free_percpu(bt->msg_data);
if (bt->rchan)
relay_close(bt->rchan);
kfree(bt);
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/linux/blktrace_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ struct blk_trace {
int trace_state;
struct rchan *rchan;
unsigned long *sequence;
unsigned char *msg_data;
u16 act_mask;
u64 start_lba;
u64 end_lba;
Expand Down Expand Up @@ -172,7 +173,7 @@ extern void __trace_note_message(struct blk_trace *, const char *fmt, ...);
if (unlikely(bt)) \
__trace_note_message(bt, fmt, ##__VA_ARGS__); \
} while (0)
#define BLK_TN_MAX_MSG 1024
#define BLK_TN_MAX_MSG 128

/**
* blk_add_trace_rq - Add a trace for a request oriented action
Expand Down

0 comments on commit 16bd8e0

Please sign in to comment.