| From 265b79a298b202478d46f5e25393bc8e94d08d63 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Thu, 4 Jun 2020 00:13:30 -0700 |
| Subject: blktrace: fix endianness for blk_log_remap() |
| |
| From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> |
| |
| [ Upstream commit 5aec598c456fe3c1b71a1202cbb42bdc2a643277 ] |
| |
| 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 <chaitanya.kulkarni@wdc.com> |
| Signed-off-by: Jens Axboe <axboe@kernel.dk> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| kernel/trace/blktrace.c | 19 ++++--------------- |
| 1 file changed, 4 insertions(+), 15 deletions(-) |
| |
| diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c |
| index be97e0b4ae7dc..304a164f5e7e7 100644 |
| --- a/kernel/trace/blktrace.c |
| +++ b/kernel/trace/blktrace.c |
| @@ -1289,17 +1289,6 @@ static __u64 get_pdu_int(const struct trace_entry *ent, bool has_cg) |
| return be64_to_cpu(*val); |
| } |
| |
| -static void get_pdu_remap(const struct trace_entry *ent, |
| - struct blk_io_trace_remap *r, bool has_cg) |
| -{ |
| - const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg); |
| - __u64 sector_from = __r->sector_from; |
| - |
| - r->device_from = be32_to_cpu(__r->device_from); |
| - r->device_to = be32_to_cpu(__r->device_to); |
| - r->sector_from = be64_to_cpu(sector_from); |
| -} |
| - |
| typedef void (blk_log_action_t) (struct trace_iterator *iter, const char *act, |
| bool has_cg); |
| |
| @@ -1425,13 +1414,13 @@ static void blk_log_with_error(struct trace_seq *s, |
| |
| static void blk_log_remap(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) |
| { |
| - struct blk_io_trace_remap r = { .device_from = 0, }; |
| + const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg); |
| |
| - get_pdu_remap(ent, &r, has_cg); |
| trace_seq_printf(s, "%llu + %u <- (%d,%d) %llu\n", |
| t_sector(ent), t_sec(ent), |
| - MAJOR(r.device_from), MINOR(r.device_from), |
| - (unsigned long long)r.sector_from); |
| + MAJOR(be32_to_cpu(__r->device_from)), |
| + MINOR(be32_to_cpu(__r->device_from)), |
| + be64_to_cpu(__r->sector_from)); |
| } |
| |
| static void blk_log_plug(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) |
| -- |
| 2.25.1 |
| |