aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2020-05-06 15:39:33 +0200
committerJens Axboe <axboe@kernel.dk>2020-05-20 07:37:56 -0600
commitf442a044c0c2752d6fa916dd1e0366ba83eef998 (patch)
tree37b2a9ed34c7ff0d9e9dcca45c3e0b7e2036d7ca
parent2d6a688904d809ff65ef5582b1caab3776aa6e74 (diff)
downloadblktrace-f442a044c0c2752d6fa916dd1e0366ba83eef998.tar.gz
iowatcher: Handle cgroup information
Since Linux kernel commit 35fe6d763229 "block: use standard blktrace API to output cgroup info for debug notes" the kernel can pass __BLK_TA_CGROUP flag in the action field of generated events. Teach iowatcher to ignore this information. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--iowatcher/blkparse.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/iowatcher/blkparse.c b/iowatcher/blkparse.c
index 982de94..6203854 100644
--- a/iowatcher/blkparse.c
+++ b/iowatcher/blkparse.c
@@ -51,7 +51,7 @@ extern int plot_io_action;
extern int io_per_process;
#define BLK_DATADIR(a) (((a) >> BLK_TC_SHIFT) & (BLK_TC_READ | BLK_TC_WRITE))
-#define BLK_TA_MASK ((1 << BLK_TC_SHIFT) - 1)
+#define BLK_TA_MASK (((1 << BLK_TC_SHIFT) - 1) & ~__BLK_TA_CGROUP)
struct pending_io {
/* sector offset of this IO */
@@ -260,18 +260,23 @@ static void handle_notify(struct trace *trace)
{
struct blk_io_trace *io = trace->io;
void *payload = (char *)io + sizeof(*io);
+ int pdu_len = io->pdu_len;
u32 two32[2];
- if (io->action == BLK_TN_PROCESS) {
+ if (io->action & __BLK_TN_CGROUP) {
+ payload += sizeof(struct blk_io_cgroup_payload);
+ pdu_len -= sizeof(struct blk_io_cgroup_payload);
+ }
+ if ((io->action & ~__BLK_TN_CGROUP) == BLK_TN_PROCESS) {
if (io_per_process)
process_hash_insert(io->pid, payload);
return;
}
- if (io->action != BLK_TN_TIMESTAMP)
+ if ((io->action & ~__BLK_TN_CGROUP) != BLK_TN_TIMESTAMP)
return;
- if (io->pdu_len != sizeof(two32))
+ if (pdu_len != sizeof(two32))
return;
memcpy(two32, payload, sizeof(two32));
@@ -309,11 +314,16 @@ static int is_io_event(struct blk_io_trace *test)
char *message;
if (!(test->action & BLK_TC_ACT(BLK_TC_NOTIFY)))
return 1;
- if (test->action == BLK_TN_MESSAGE) {
+ if ((test->action & ~__BLK_TN_CGROUP) == BLK_TN_MESSAGE) {
int len = test->pdu_len;
+
+ message = (char *)(test + 1);
+ if (test->action & __BLK_TN_CGROUP) {
+ len -= sizeof(struct blk_io_cgroup_payload);
+ message += sizeof(struct blk_io_cgroup_payload);
+ }
if (len < 3)
return 0;
- message = (char *)(test + 1);
if (strncmp(message, "fio ", 4) == 0) {
return 1;
}
@@ -372,13 +382,17 @@ static int parse_fio_bank_message(struct trace *trace, u64 *bank_ret, u64 *offse
if (!(test->action & BLK_TC_ACT(BLK_TC_NOTIFY)))
return -1;
- if (test->action != BLK_TN_MESSAGE)
+ if ((test->action & ~__BLK_TN_CGROUP) != BLK_TN_MESSAGE)
return -1;
+ message = (char *)(test + 1);
+ if (test->action & __BLK_TN_CGROUP) {
+ len -= sizeof(struct blk_io_cgroup_payload);
+ message += sizeof(struct blk_io_cgroup_payload);
+ }
/* the message is fio rw bank offset num_banks */
if (len < 3)
return -1;
- message = (char *)(test + 1);
if (strncmp(message, "fio r ", 6) != 0)
return -1;