diff mbox series

[RFC,13/39] blktrace: update blk_add_trace_bio()

Message ID 20210225070231.21136-14-chaitanya.kulkarni@wdc.com (mailing list archive)
State New, archived
Headers show
Series [RFC,01/39] blktrace_api: add new trace definitions | expand

Commit Message

Chaitanya Kulkarni Feb. 25, 2021, 7:02 a.m. UTC
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 kernel/trace/blktrace.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Comments

Damien Le Moal Feb. 26, 2021, 4:49 a.m. UTC | #1
On 2021/02/25 16:04, Chaitanya Kulkarni wrote:
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>

No commit message.

> ---
>  kernel/trace/blktrace.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
> index 07f71a052a0d..14658b2a3fc8 100644
> --- a/kernel/trace/blktrace.c
> +++ b/kernel/trace/blktrace.c
> @@ -1247,20 +1247,31 @@ static void blk_add_trace_rq_complete(void *ignore, struct request *rq,
>   *
>   **/
>  static void blk_add_trace_bio(struct request_queue *q, struct bio *bio,
> -			      u32 what, int error)
> +			      u64 what, int error)
>  {
>  	struct blk_trace *bt;
> +	struct blk_trace_ext *bte;
>  
>  	rcu_read_lock();
>  	bt = rcu_dereference(q->blk_trace);
> -	if (likely(!bt)) {
> +	bte = rcu_dereference(q->blk_trace_ext);
> +	if (likely(!bt) && likely(!bte)) {
>  		rcu_read_unlock();
>  		return;
>  	}
>  
> -	__blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size,
> -			bio_op(bio), bio->bi_opf, what, error, 0, NULL,
> -			blk_trace_bio_get_cgid(q, bio));
> +	if (bt) {
> +		__blk_add_trace(bt, bio->bi_iter.bi_sector,
> +				bio->bi_iter.bi_size, bio_op(bio),
> +				bio->bi_opf, (u32)what, error, 0, NULL,
> +				blk_trace_bio_get_cgid(q, bio));
> +	} else if (bte) {
> +		__blk_add_trace_ext(bte, bio->bi_iter.bi_sector,
> +				    bio->bi_iter.bi_size, bio_op(bio),
> +				    bio->bi_opf, what, error, 0, NULL,
> +				    blk_trace_bio_get_cgid(q, bio),
> +				    bio_prio(bio));
> +	}
>  	rcu_read_unlock();
>  }
>  
>
diff mbox series

Patch

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 07f71a052a0d..14658b2a3fc8 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1247,20 +1247,31 @@  static void blk_add_trace_rq_complete(void *ignore, struct request *rq,
  *
  **/
 static void blk_add_trace_bio(struct request_queue *q, struct bio *bio,
-			      u32 what, int error)
+			      u64 what, int error)
 {
 	struct blk_trace *bt;
+	struct blk_trace_ext *bte;
 
 	rcu_read_lock();
 	bt = rcu_dereference(q->blk_trace);
-	if (likely(!bt)) {
+	bte = rcu_dereference(q->blk_trace_ext);
+	if (likely(!bt) && likely(!bte)) {
 		rcu_read_unlock();
 		return;
 	}
 
-	__blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size,
-			bio_op(bio), bio->bi_opf, what, error, 0, NULL,
-			blk_trace_bio_get_cgid(q, bio));
+	if (bt) {
+		__blk_add_trace(bt, bio->bi_iter.bi_sector,
+				bio->bi_iter.bi_size, bio_op(bio),
+				bio->bi_opf, (u32)what, error, 0, NULL,
+				blk_trace_bio_get_cgid(q, bio));
+	} else if (bte) {
+		__blk_add_trace_ext(bte, bio->bi_iter.bi_sector,
+				    bio->bi_iter.bi_size, bio_op(bio),
+				    bio->bi_opf, what, error, 0, NULL,
+				    blk_trace_bio_get_cgid(q, bio),
+				    bio_prio(bio));
+	}
 	rcu_read_unlock();
 }