Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 145997
b: refs/heads/master
c: 66de779
h: refs/heads/master
i:
  145995: dabc14a
v: v3
  • Loading branch information
Li Zefan authored and Ingo Molnar committed Apr 12, 2009
1 parent 9215e9a commit 3c41c31
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 9 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: b78825d608f30a47e3154ab6872a03f0de0c9d45
refs/heads/master: 66de7792c02693b49671afe58c771fde3b092fc7
88 changes: 80 additions & 8 deletions trunk/kernel/trace/blktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,16 @@ static inline const void *pdu_start(const struct trace_entry *ent)
return te_blk_io_trace(ent) + 1;
}

static inline u32 t_action(const struct trace_entry *ent)
{
return te_blk_io_trace(ent)->action;
}

static inline u32 t_bytes(const struct trace_entry *ent)
{
return te_blk_io_trace(ent)->bytes;
}

static inline u32 t_sec(const struct trace_entry *ent)
{
return te_blk_io_trace(ent)->bytes >> 9;
Expand Down Expand Up @@ -1031,25 +1041,87 @@ static int blk_log_action(struct trace_iterator *iter, const char *act)
MAJOR(t->device), MINOR(t->device), act, rwbs);
}

static int blk_log_dump_pdu(struct trace_seq *s, const struct trace_entry *ent)
{
const char *pdu_buf;
int pdu_len;
int i, end, ret;

pdu_buf = pdu_start(ent);
pdu_len = te_blk_io_trace(ent)->pdu_len;

if (!pdu_len)
return 1;

/* find the last zero that needs to be printed */
for (end = pdu_len - 1; end >= 0; end--)
if (pdu_buf[end])
break;
end++;

if (!trace_seq_putc(s, '('))
return 0;

for (i = 0; i < pdu_len; i++) {

ret = trace_seq_printf(s, "%s%02x",
i == 0 ? "" : " ", pdu_buf[i]);
if (!ret)
return ret;

/*
* stop when the rest is just zeroes and indicate so
* with a ".." appended
*/
if (i == end && end != pdu_len - 1)
return trace_seq_puts(s, " ..) ");
}

return trace_seq_puts(s, ") ");
}

static int blk_log_generic(struct trace_seq *s, const struct trace_entry *ent)
{
char cmd[TASK_COMM_LEN];

trace_find_cmdline(ent->pid, cmd);

if (t_sec(ent))
return trace_seq_printf(s, "%llu + %u [%s]\n",
t_sector(ent), t_sec(ent), cmd);
return trace_seq_printf(s, "[%s]\n", cmd);
if (t_action(ent) & BLK_TC_ACT(BLK_TC_PC)) {
int ret;

ret = trace_seq_printf(s, "%u ", t_bytes(ent));
if (!ret)
return 0;
ret = blk_log_dump_pdu(s, ent);
if (!ret)
return 0;
return trace_seq_printf(s, "[%s]\n", cmd);
} else {
if (t_sec(ent))
return trace_seq_printf(s, "%llu + %u [%s]\n",
t_sector(ent), t_sec(ent), cmd);
return trace_seq_printf(s, "[%s]\n", cmd);
}
}

static int blk_log_with_error(struct trace_seq *s,
const struct trace_entry *ent)
{
if (t_sec(ent))
return trace_seq_printf(s, "%llu + %u [%d]\n", t_sector(ent),
t_sec(ent), t_error(ent));
return trace_seq_printf(s, "%llu [%d]\n", t_sector(ent), t_error(ent));
if (t_action(ent) & BLK_TC_ACT(BLK_TC_PC)) {
int ret;

ret = blk_log_dump_pdu(s, ent);
if (ret)
return trace_seq_printf(s, "[%d]\n", t_error(ent));
return 0;
} else {
if (t_sec(ent))
return trace_seq_printf(s, "%llu + %u [%d]\n",
t_sector(ent),
t_sec(ent), t_error(ent));
return trace_seq_printf(s, "%llu [%d]\n",
t_sector(ent), t_error(ent));
}
}

static int blk_log_remap(struct trace_seq *s, const struct trace_entry *ent)
Expand Down

0 comments on commit 3c41c31

Please sign in to comment.