All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/4] blktrace: fix sparse warnings
@ 2020-06-04  7:13 Chaitanya Kulkarni
  2020-06-04  7:13 ` [PATCH V2 1/3] blktrace: use errno instead of bi_status Chaitanya Kulkarni
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2020-06-04  7:13 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, Chaitanya Kulkarni

Hi,

This is a small patch-series which fixes various sparse warnings.

Regards,
Chaitanya

* Changes from V1:-

1. Get rid of the first patch since Jan already posted similar
   patch.

Chaitanya Kulkarni (3):
  blktrace: use errno instead of bi_status
  blktrace: fix endianness in get_pdu_int()
  blktrace: fix endianness for blk_log_remap()

 kernel/trace/blktrace.c | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

-- 
2.22.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH V2 1/3] blktrace: use errno instead of bi_status
  2020-06-04  7:13 [PATCH V2 0/4] blktrace: fix sparse warnings Chaitanya Kulkarni
@ 2020-06-04  7:13 ` Chaitanya Kulkarni
  2020-06-04  7:13 ` [PATCH V2 2/3] blktrace: fix endianness in get_pdu_int() Chaitanya Kulkarni
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2020-06-04  7:13 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, Chaitanya Kulkarni

In blk_add_trace_spliti() blk_add_trace_bio_remap() use
blk_status_to_errno() to pass the error instead of pasing the bi_status.
This fixes the sparse warning.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 kernel/trace/blktrace.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index ea47f2084087..f6f4fe6ea5d8 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -995,8 +995,10 @@ static void blk_add_trace_split(void *ignore,
 
 		__blk_add_trace(bt, bio->bi_iter.bi_sector,
 				bio->bi_iter.bi_size, bio_op(bio), bio->bi_opf,
-				BLK_TA_SPLIT, bio->bi_status, sizeof(rpdu),
-				&rpdu, blk_trace_bio_get_cgid(q, bio));
+				BLK_TA_SPLIT,
+				blk_status_to_errno(bio->bi_status),
+				sizeof(rpdu), &rpdu,
+				blk_trace_bio_get_cgid(q, bio));
 	}
 	rcu_read_unlock();
 }
@@ -1033,7 +1035,8 @@ static void blk_add_trace_bio_remap(void *ignore,
 	r.sector_from = cpu_to_be64(from);
 
 	__blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size,
-			bio_op(bio), bio->bi_opf, BLK_TA_REMAP, bio->bi_status,
+			bio_op(bio), bio->bi_opf, BLK_TA_REMAP,
+			blk_status_to_errno(bio->bi_status),
 			sizeof(r), &r, blk_trace_bio_get_cgid(q, bio));
 	rcu_read_unlock();
 }
-- 
2.22.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH V2 2/3] blktrace: fix endianness in get_pdu_int()
  2020-06-04  7:13 [PATCH V2 0/4] blktrace: fix sparse warnings Chaitanya Kulkarni
  2020-06-04  7:13 ` [PATCH V2 1/3] blktrace: use errno instead of bi_status Chaitanya Kulkarni
@ 2020-06-04  7:13 ` Chaitanya Kulkarni
  2020-06-04  7:13 ` [PATCH V2 3/3] blktrace: fix endianness for blk_log_remap() Chaitanya Kulkarni
  2020-06-05  3:24 ` [PATCH V2 0/4] blktrace: fix sparse warnings Jens Axboe
  3 siblings, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2020-06-04  7:13 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, Chaitanya Kulkarni

In function get_pdu_len() replace variable type from __u64 to
__be64. This fixes sparse warning.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 kernel/trace/blktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index f6f4fe6ea5d8..70aebd95f9bf 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1256,7 +1256,7 @@ static inline __u16 t_error(const struct trace_entry *ent)
 
 static __u64 get_pdu_int(const struct trace_entry *ent, bool has_cg)
 {
-	const __u64 *val = pdu_start(ent, has_cg);
+	const __be64 *val = pdu_start(ent, has_cg);
 	return be64_to_cpu(*val);
 }
 
-- 
2.22.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH V2 3/3] blktrace: fix endianness for blk_log_remap()
  2020-06-04  7:13 [PATCH V2 0/4] blktrace: fix sparse warnings Chaitanya Kulkarni
  2020-06-04  7:13 ` [PATCH V2 1/3] blktrace: use errno instead of bi_status Chaitanya Kulkarni
  2020-06-04  7:13 ` [PATCH V2 2/3] blktrace: fix endianness in get_pdu_int() Chaitanya Kulkarni
@ 2020-06-04  7:13 ` Chaitanya Kulkarni
  2020-06-05  3:24 ` [PATCH V2 0/4] blktrace: fix sparse warnings Jens Axboe
  3 siblings, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2020-06-04  7:13 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, Chaitanya Kulkarni

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>
---
 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 70aebd95f9bf..19e37242d0f5 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1260,17 +1260,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);
 
@@ -1410,13 +1399,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.22.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 0/4] blktrace: fix sparse warnings
  2020-06-04  7:13 [PATCH V2 0/4] blktrace: fix sparse warnings Chaitanya Kulkarni
                   ` (2 preceding siblings ...)
  2020-06-04  7:13 ` [PATCH V2 3/3] blktrace: fix endianness for blk_log_remap() Chaitanya Kulkarni
@ 2020-06-05  3:24 ` Jens Axboe
  2020-06-05 15:00   ` Jan Kara
  3 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2020-06-05  3:24 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-block, Jan Kara

On 6/4/20 1:13 AM, Chaitanya Kulkarni wrote:
> Hi,
> 
> This is a small patch-series which fixes various sparse warnings.
> 
> Regards,
> Chaitanya
> 
> * Changes from V1:-
> 
> 1. Get rid of the first patch since Jan already posted similar
>    patch.

Applied 1-3 (there seems to be no number 4 anymore, regardless of subject
in this cover letter).

Jan, are you re-sending the final one?

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 0/4] blktrace: fix sparse warnings
  2020-06-05  3:24 ` [PATCH V2 0/4] blktrace: fix sparse warnings Jens Axboe
@ 2020-06-05 15:00   ` Jan Kara
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2020-06-05 15:00 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Chaitanya Kulkarni, linux-block, Jan Kara

On Thu 04-06-20 21:24:30, Jens Axboe wrote:
> On 6/4/20 1:13 AM, Chaitanya Kulkarni wrote:
> > Hi,
> > 
> > This is a small patch-series which fixes various sparse warnings.
> > 
> > Regards,
> > Chaitanya
> > 
> > * Changes from V1:-
> > 
> > 1. Get rid of the first patch since Jan already posted similar
> >    patch.
> 
> Applied 1-3 (there seems to be no number 4 anymore, regardless of subject
> in this cover letter).
> 
> Jan, are you re-sending the final one?

OK, I've sent you [1] my patch together with the Luis' one it depends on -
that one stands on its own and was already reviewed so I think its simplest
this way...

								Honza

[1] https://lore.kernel.org/linux-block/20200605145349.18454-1-jack@suse.cz

-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-05 15:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04  7:13 [PATCH V2 0/4] blktrace: fix sparse warnings Chaitanya Kulkarni
2020-06-04  7:13 ` [PATCH V2 1/3] blktrace: use errno instead of bi_status Chaitanya Kulkarni
2020-06-04  7:13 ` [PATCH V2 2/3] blktrace: fix endianness in get_pdu_int() Chaitanya Kulkarni
2020-06-04  7:13 ` [PATCH V2 3/3] blktrace: fix endianness for blk_log_remap() Chaitanya Kulkarni
2020-06-05  3:24 ` [PATCH V2 0/4] blktrace: fix sparse warnings Jens Axboe
2020-06-05 15:00   ` Jan Kara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.