Skip to content

Commit 5aec598

Browse files
ChaitanayaKulkarniaxboe
authored andcommitted
blktrace: fix endianness for blk_log_remap()
The function blk_log_remap() can be simplified by removing the call to get_pdu_remap() that copies the values into extra variable to print the data, which also fixes the endiannness warning reported by sparse. Signed-off-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 71df3fd commit 5aec598

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

kernel/trace/blktrace.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,17 +1260,6 @@ static __u64 get_pdu_int(const struct trace_entry *ent, bool has_cg)
12601260
return be64_to_cpu(*val);
12611261
}
12621262

1263-
static void get_pdu_remap(const struct trace_entry *ent,
1264-
struct blk_io_trace_remap *r, bool has_cg)
1265-
{
1266-
const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg);
1267-
__u64 sector_from = __r->sector_from;
1268-
1269-
r->device_from = be32_to_cpu(__r->device_from);
1270-
r->device_to = be32_to_cpu(__r->device_to);
1271-
r->sector_from = be64_to_cpu(sector_from);
1272-
}
1273-
12741263
typedef void (blk_log_action_t) (struct trace_iterator *iter, const char *act,
12751264
bool has_cg);
12761265

@@ -1410,13 +1399,13 @@ static void blk_log_with_error(struct trace_seq *s,
14101399

14111400
static void blk_log_remap(struct trace_seq *s, const struct trace_entry *ent, bool has_cg)
14121401
{
1413-
struct blk_io_trace_remap r = { .device_from = 0, };
1402+
const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg);
14141403

1415-
get_pdu_remap(ent, &r, has_cg);
14161404
trace_seq_printf(s, "%llu + %u <- (%d,%d) %llu\n",
14171405
t_sector(ent), t_sec(ent),
1418-
MAJOR(r.device_from), MINOR(r.device_from),
1419-
(unsigned long long)r.sector_from);
1406+
MAJOR(be32_to_cpu(__r->device_from)),
1407+
MINOR(be32_to_cpu(__r->device_from)),
1408+
be64_to_cpu(__r->sector_from));
14201409
}
14211410

14221411
static void blk_log_plug(struct trace_seq *s, const struct trace_entry *ent, bool has_cg)

0 commit comments

Comments
 (0)