Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Dec 11, 2025

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit f9bd00dfbd67ce62ca6df6f55d6275b523cd0b39:

blkparse: Fix a potential coredump issue (2025-03-20 05:06:40 -0600)

are available in the Git repository at:

git://git.kernel.dk/blktrace.git master

for you to fetch changes up to 9b24b42ef59d2e8015957db3dd70ffedb7ebcfe8:

Update git tree references (2025-12-10 23:53:45 -0700)

----------------------------------------------------------------
Jens Axboe (1):
Update git tree references

Johannes Thumshirn (20):
blktrace: fix comment for struct blk_trace_setup:
blkparse: fix compiler warning
blktrace: add definitions for BLKTRACESETUP2
blktrace: change size of action to 64 bits
blktrace: add definitions for blk_io_trace2
blkparse: pass magic to get_magic
blkparse: read 'magic' first
blkparse: factor out reading of a singe blk_io_trace event
blkparse: skip unsupported protocol versions
blkparse: make get_pdulen() take the pdu_len
blkiomon: read 'magic' first
blktrace: pass magic to CHECK_MAGIC macro
blktrace: pass magic to verify_trace
blktrace: rename trace_to_cpu to bit_trace_to_cpu
blkparse: use blk_io_trace2 internally
blkparse: natively parse blk_io_trace2
blkparse: parse zone (un)plug actions
blkparse: add zoned commands to fill_rwbs()
blktrace: call BLKTRACESETUP2 ioctl per default to setup a trace
blktrace: support protocol version 8

 README                    |   6 +-
 act_mask.c                |   4 +-
 blkiomon.c                |  15 +-
 blkparse.c                | 446 +++++++++++++++++++++++++++++++---------------
 blkparse_fmt.c            |  83 +++++++--
 blkrawverify.c            |  14 +-
 blktrace.c                |  40 ++++-
 blktrace.h                |  64 +++++--
 blktrace_api.h            |  58 +++++-
 btreplay/doc/btreplay.tex |   2 +-
 10 files changed, 539 insertions(+), 193 deletions(-)

---

Diff of recent changes:

README +3 -3
index d7d1fbf..7999d21 100644
@@ -14,7 +14,7 @@ Requirements
 blktrace was integrated into the mainline kernel between 2.6.16 and 2.6.17-rc1.
 The target trace needs to run on a kernel at least that new.
 
-git://git.kernel.dk/blktrace.git
+git://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git
 
 If you don't have git, you can get hourly snapshots from:
 
@@ -24,12 +24,12 @@ The snapshots include the full git object database as well. kernel.org has
 excessively long mirror times, so if you have git installed, you can pull
 the master tree from:
 
-git://git.kernel.dk/blktrace.git
+git://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git
 
 For browsing the repo over http and viewing history etc, you can direct
 your browser to:
 
-http://git.kernel.dk/
+https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git
 
 A blktrace visualization tool, iowatcher, was added to blktrace in version
 1.1.0. It requires librsvg and either png2theora or ffmpeg to generate movies.
act_mask.c +2 -2
index 8f1b8d7..510c7e0 100644
@@ -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));
 }
blkiomon.c +12 -3
index f8b0c9d..9defa2c 100644
@@ -460,26 +460,35 @@ static int blkiomon_do_fifo(void)
 	bit = &t->bit;
 
 	while (up) {
+		__u32 magic;
+
+		if (fread(&magic, sizeof(magic), 1, ifp) != 1) {
+			if (!feof(ifp))
+				fprintf(stderr,
+					"blkiomon: could not read trace");
+			break;
+		}
 		if (fread(bit, sizeof(*bit), 1, ifp) != 1) {
 			if (!feof(ifp))
 				fprintf(stderr,
 					"blkiomon: could not read trace");
 			break;
 		}
+		bit->magic = magic;
 		if (ferror(ifp)) {
 			clearerr(ifp);
 			fprintf(stderr, "blkiomon: error while reading trace");
 			break;
 		}
 
-		if (data_is_native == -1 && check_data_endianness(bit->magic)) {
+		if (data_is_native == -1 && check_data_endianness(magic)) {
 			fprintf(stderr, "blkiomon: endianess problem\n");
 			break;
 		}
 
 		/* endianess */
-		trace_to_cpu(bit);
-		if (verify_trace(bit)) {
+		bit_trace_to_cpu(bit);
+		if (verify_trace(bit->magic)) {
 			fprintf(stderr, "blkiomon: bad trace\n");
 			break;
 		}
blkparse.c +305 -141

838 lines not on this page · raw message

blkparse_fmt.c +64 -19

149 lines not on this page · raw message

blkrawverify.c +7 -7
index ed5d258..8e863cb 100644
@@ -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;
 }
@@ -181,9 +181,9 @@ static int process(FILE **fp, char *devname, char *file, unsigned int cpu)
 		if (data_is_native == -1)
 			check_data_endianness(bit->magic);
 
-		trace_to_cpu(bit);
+		bit_trace_to_cpu(bit);
 
-		if (!CHECK_MAGIC(bit)) {
+		if (!CHECK_MAGIC(bit->magic)) {
 			INC_BAD("bad trace");
 			continue;
 		}
blktrace.c +36 -4
index 038b2cb..72562fd 100644
@@ -279,7 +279,7 @@ static int max_cpus;
 static int ncpus;
 static cpu_set_t *online_cpus;
 static int pagesize;
-static int act_mask = ~0U;
+static unsigned long long act_mask = ~0U;
 static int kill_running_trace;
 static int stop_watch;
 static int piped_output;
@@ -1067,6 +1067,36 @@ static void close_client_connections(void)
 	}
 }
 
+static int setup_buts2(void)
+{
+	struct list_head *p;
+	int ret = 0;
+
+	__list_for_each(p, &devpaths) {
+		struct blk_user_trace_setup2 buts2;
+		struct devpath *dpp = list_entry(p, struct devpath, head);
+
+		memset(&buts2, 0, sizeof(buts2));
+		buts2.buf_size = buf_size;
+		buts2.buf_nr = buf_nr;
+		buts2.act_mask = act_mask;
+
+		if (ioctl(dpp->fd, BLKTRACESETUP2, &buts2) >= 0) {
+			dpp->ncpus = max_cpus;
+			dpp->buts_name = strdup(buts2.name);
+			dpp->setup_done = 1;
+			if (dpp->stats)
+				free(dpp->stats);
+			dpp->stats = calloc(dpp->ncpus, sizeof(*dpp->stats));
+			memset(dpp->stats, 0, dpp->ncpus * sizeof(*dpp->stats));
+		} else {
+			ret++;
+		}
+	}
+
+	return ret;
+}
+
 static int setup_buts(void)
 {
 	struct list_head *p;
@@ -2684,9 +2714,11 @@ static int run_tracers(void)
 	if (net_mode == Net_client)
 		printf("blktrace: connecting to %s\n", hostname);
 
-	if (setup_buts()) {
-		done = 1;
-		return 1;
+	if (setup_buts2()) {
+		if (setup_buts()) {
+			done = 1;
+			return 1;
+		}
 	}
 
 	if (use_tracer_devpaths()) {
blktrace.h +54 -10

99 lines not on this page · raw message

blktrace_api.h +55 -3

106 lines not on this page · raw message

btreplay/doc/btreplay.tex +1 -1
index 8b0ecf7..98509bb 100644
@@ -46,7 +46,7 @@ Performance Group.
 
 To build these tools, one needs to
 place the source directory next to a valid
-\texttt{blktrace}\footnote{\texttt{git://git.kernel.dk/blktrace.git}}
+\texttt{blktrace}\footnote{\texttt{git://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git}}
 directory, as it includes \texttt{../blktrace} in the \texttt{Makefile}.