[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250925150427.67394-12-johannes.thumshirn@wdc.com>
Date: Thu, 25 Sep 2025 17:04:16 +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 11/22] blkparse: make get_pdulen() take the pdu_len
Directly pass in the pdu_len into get_pdulen() and only care about the
byte swapping in get_pdulen().
This enables us to use the function for different versions of the
protocol.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@....com>
---
blkparse.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/blkparse.c b/blkparse.c
index 163da73..0402e81 100644
--- a/blkparse.c
+++ b/blkparse.c
@@ -2412,12 +2412,12 @@ static int read_data(int fd, void *buffer, int bytes, int block, int *fdblock)
return 0;
}
-static inline __u16 get_pdulen(struct blk_io_trace *bit)
+static inline __u16 get_pdulen(__u16 pdu_len)
{
if (data_is_native)
- return bit->pdu_len;
+ return pdu_len;
- return __bswap_16(bit->pdu_len);
+ return __bswap_16(pdu_len);
}
static inline __u32 get_magic(__u32 magic)
@@ -2439,7 +2439,7 @@ static int read_one_bit(int fd, struct blk_io_trace *bit, int block,
if (ret)
return ret;
- pdu_len = get_pdulen(bit);
+ pdu_len = get_pdulen(bit->pdu_len);
if (pdu_len) {
void *ptr = realloc(bit, sizeof(*bit) + pdu_len);
--
2.51.0
Powered by blists - more mailing lists