[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251015105658.527262-12-johannes.thumshirn@wdc.com>
Date: Wed, 15 Oct 2025 12:56:49 +0200
From: Johannes Thumshirn <johannes.thumshirn@....com>
To: axboe@...nel.dk
Cc: chaitanyak@...dia.com,
dlemoal@...nel.org,
hare@...e.de,
hch@....de,
john.g.garry@...cle.com,
linux-block@...r.kernel.org,
linux-btrace@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org,
martin.petersen@...cle.com,
mathieu.desnoyers@...icios.com,
mhiramat@...nel.org,
naohiro.aota@....com,
rostedt@...dmis.org,
shinichiro.kawasaki@....com,
Johannes Thumshirn <johannes.thumshirn@....com>
Subject: [PATCH blktrace v3 11/20] 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