[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250925150427.67394-5-johannes.thumshirn@wdc.com>
Date: Thu, 25 Sep 2025 17:04:09 +0200
From: Johannes Thumshirn <johannes.thumshirn@....com>
To: Jens Axboe <axboe@...nel.dk>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org,
linux-btrace@...r.kernel.org,
John Garry <john.g.garry@...cle.com>,
Hannes Reinecke <hare@...e.de>,
Damien Le Moal <dlemoal@...nel.org>,
Christoph Hellwig <hch@....de>,
Naohiro Aota <naohiro.aota@....com>,
Shinichiro Kawasaki <shinichiro.kawasaki@....com>,
Chaitanya Kulkarni <chaitanyak@...dia.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Johannes Thumshirn <johannes.thumshirn@....com>
Subject: [PATCH blktrace v2 04/22] blktrace: change size of action to 64 bits
In order to add the zoned commands to blktrace's actions, the storage size
needs to be increased to 64bits.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@....com>
---
act_mask.c | 4 ++--
blkparse.c | 2 +-
blkparse_fmt.c | 15 ++++++++-------
blkrawverify.c | 10 +++++-----
blktrace.h | 2 +-
5 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/act_mask.c b/act_mask.c
index 8f1b8d7..510c7e0 100644
--- a/act_mask.c
+++ b/act_mask.c
@@ -42,7 +42,7 @@ int find_mask_map(char *string)
return -1;
}
-int valid_act_opt(int x)
+unsigned long long valid_act_opt(unsigned long long x)
{
- return (1 <= x) && (x < (1 << BLK_TC_SHIFT));
+ return (1ull <= x) && (x < (1ull << BLK_TC_SHIFT));
}
diff --git a/blkparse.c b/blkparse.c
index 3f4d827..512a2d2 100644
--- a/blkparse.c
+++ b/blkparse.c
@@ -299,7 +299,7 @@ static int per_device_and_cpu_stats = 1;
static int track_ios;
static int ppi_hash_by_pid = 1;
static int verbose;
-static unsigned int act_mask = -1U;
+static unsigned long long act_mask = -1U;
static int stats_printed;
static int bin_output_msgs = 1;
int data_is_native = -1;
diff --git a/blkparse_fmt.c b/blkparse_fmt.c
index 9b83d1d..02c5a3c 100644
--- a/blkparse_fmt.c
+++ b/blkparse_fmt.c
@@ -8,6 +8,7 @@
#include <unistd.h>
#include <ctype.h>
#include <time.h>
+#include <stdbool.h>
#include "blktrace.h"
@@ -52,13 +53,13 @@ int add_format_spec(char *option)
static inline void fill_rwbs(char *rwbs, struct blk_io_trace *t)
{
- int w = t->action & BLK_TC_ACT(BLK_TC_WRITE);
- int a = t->action & BLK_TC_ACT(BLK_TC_AHEAD);
- int s = t->action & BLK_TC_ACT(BLK_TC_SYNC);
- int m = t->action & BLK_TC_ACT(BLK_TC_META);
- int d = t->action & BLK_TC_ACT(BLK_TC_DISCARD);
- int f = t->action & BLK_TC_ACT(BLK_TC_FLUSH);
- int u = t->action & BLK_TC_ACT(BLK_TC_FUA);
+ bool w = !!(t->action & BLK_TC_ACT(BLK_TC_WRITE));
+ bool a = !!(t->action & BLK_TC_ACT(BLK_TC_AHEAD));
+ bool s = !!(t->action & BLK_TC_ACT(BLK_TC_SYNC));
+ bool m = !!(t->action & BLK_TC_ACT(BLK_TC_META));
+ bool d = !!(t->action & BLK_TC_ACT(BLK_TC_DISCARD));
+ bool f = !!(t->action & BLK_TC_ACT(BLK_TC_FLUSH));
+ bool u = !!(t->action & BLK_TC_ACT(BLK_TC_FUA));
int i = 0;
if (f)
diff --git a/blkrawverify.c b/blkrawverify.c
index ed5d258..9c5d595 100644
--- a/blkrawverify.c
+++ b/blkrawverify.c
@@ -55,7 +55,7 @@ static struct trace_info traces[] = {
#define N_TRACES (sizeof(traces) / sizeof(struct trace_info))
struct act_info {
- __u32 val;
+ __u64 val;
char *string;
};
@@ -80,12 +80,12 @@ static struct act_info acts[] = {
};
#define N_ACTS (sizeof(acts) / sizeof(struct act_info))
-static char *act_to_str(__u32 action)
+static char *act_to_str(__u64 action)
{
static char buf[1024];
unsigned int i;
- unsigned int act = action & 0xffff;
- unsigned int trace = (action >> BLK_TC_SHIFT) & 0xffff;
+ unsigned long long act = action & 0xffffffff;
+ unsigned long long trace = (action >> BLK_TC_SHIFT) & 0xffffffff;
if (act < N_ACTS) {
sprintf(buf, "%s ", acts[act].string);
@@ -97,7 +97,7 @@ static char *act_to_str(__u32 action)
}
}
else
- sprintf(buf, "Invalid action=%08x", action);
+ sprintf(buf, "Invalid action=%016llx", action);
return buf;
}
diff --git a/blktrace.h b/blktrace.h
index 944fc08..74dfb48 100644
--- a/blktrace.h
+++ b/blktrace.h
@@ -144,7 +144,7 @@ extern void set_all_format_specs(char *);
extern int add_format_spec(char *);
extern void process_fmt(char *, struct per_cpu_info *, struct blk_io_trace *,
unsigned long long, int, unsigned char *);
-extern int valid_act_opt(int);
+extern unsigned long long valid_act_opt(unsigned long long);
extern int find_mask_map(char *);
extern char *find_process_name(pid_t);
--
2.51.0
Powered by blists - more mailing lists