Skip to content

Commit

Permalink
Fix trace req type
Browse files Browse the repository at this point in the history
  • Loading branch information
nicktehrany committed Nov 14, 2022
1 parent 68bec7d commit 72fff67
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions zns.trace/trace.bt
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ BEGIN {

k:nvme_setup_cmd / ((struct request *)arg1)->q->disk->disk_name == str($1) / {
$nvme_cmd = (struct nvme_command *)*(arg1+sizeof(struct request));
$cmd = (((struct request *)arg1)->cmd_flags & REQ_OP_MASK);
$opcode = (uint8)$nvme_cmd->rw.opcode;

$secnum = ((struct request *)arg1)->__sector;
// Bitwise And to get zone starting LBA with zone MASK
$zlbas = ($secnum & @ZONE_MASK);

// Trace Write and Append command counters and I/O sizes
if($opcode == nvme_cmd_write || $opcode == nvme_cmd_zone_append) {
if($cmd == REQ_OP_WRITE || $cmd == REQ_OP_ZONE_APPEND) {
// Store zone operation counter map under ZLBAS, operation 0x01 for write and append
@z_rw_ctr_map[$zlbas, nvme_cmd_write]++;

Expand All @@ -41,7 +42,7 @@ k:nvme_setup_cmd / ((struct request *)arg1)->q->disk->disk_name == str($1) / {
}

// Trace Read command counter and total I/O sizes
if($opcode == nvme_cmd_read) {
if($cmd == REQ_OP_READ) {
// Store zone operation counter map under ZLBAS, operation 0x01 for write and append
@z_rw_ctr_map[$zlbas, nvme_cmd_read]++;

Expand All @@ -54,9 +55,6 @@ k:nvme_setup_cmd / ((struct request *)arg1)->q->disk->disk_name == str($1) / {
}
}

// Trace ZONE RESETS
$cmd = (((struct request *)arg1)->cmd_flags & REQ_OP_MASK);

// If nvme device is in passthrough (e.g., qemu passthrough) Zone reset has flag REQ_OP_DRV_OUT
// therefore include more checks on nvme_zone_mgnt_action
if($cmd == REQ_OP_ZONE_RESET || (($cmd == REQ_OP_DRV_OUT && $opcode == nvme_cmd_zone_mgmt_send) && $nvme_cmd->zms.zsa == NVME_ZONE_RESET)) {
Expand Down

0 comments on commit 72fff67

Please sign in to comment.