Re: [RFC PATCH 08/39] blktrace: update blk_add_trace_rq()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021/02/25 16:04, Chaitanya Kulkarni wrote:
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>

No commit message.

> ---
>  kernel/trace/blktrace.c | 30 +++++++++++++++++++++---------
>  1 file changed, 21 insertions(+), 9 deletions(-)
> 
> diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
> index 1aef55fdefa9..280ad94f99b6 100644
> --- a/kernel/trace/blktrace.c
> +++ b/kernel/trace/blktrace.c
> @@ -1099,24 +1099,36 @@ blk_trace_request_get_cgid(struct request *rq)
>   *
>   **/
>  static void blk_add_trace_rq(struct request *rq, int error,
> -			     unsigned int nr_bytes, u32 what, u64 cgid)
> +			     unsigned int nr_bytes, u64 what, u64 cgid)
>  {
>  	struct blk_trace *bt;
> +	struct blk_trace_ext *bte;
>  
>  	rcu_read_lock();
>  	bt = rcu_dereference(rq->q->blk_trace);
> -	if (likely(!bt)) {
> +	bte = rcu_dereference(rq->q->blk_trace_ext);
> +	if (likely(!bt) && likely(!bte)) {
>  		rcu_read_unlock();
>  		return;
>  	}
>  
> -	if (blk_rq_is_passthrough(rq))
> -		what |= BLK_TC_ACT(BLK_TC_PC);
> -	else
> -		what |= BLK_TC_ACT(BLK_TC_FS);
> -
> -	__blk_add_trace(bt, blk_rq_trace_sector(rq), nr_bytes, req_op(rq),
> -			rq->cmd_flags, what, error, 0, NULL, cgid);
> +	if (bt) {
> +		if (blk_rq_is_passthrough(rq))
> +			what |= BLK_TC_ACT(BLK_TC_PC);
> +		else
> +			what |= BLK_TC_ACT(BLK_TC_FS);
> +		__blk_add_trace(bt, blk_rq_trace_sector(rq), nr_bytes,
> +				req_op(rq), rq->cmd_flags, (u32)what, error, 0,
> +				NULL, cgid);
> +	} else if (bte) {
> +		if (blk_rq_is_passthrough(rq))
> +			what |= BLK_TC_ACT_EXT(BLK_TC_PC);
> +		else
> +			what |= BLK_TC_ACT_EXT(BLK_TC_FS);
> +		__blk_add_trace_ext(bte, blk_rq_trace_sector(rq), nr_bytes,
> +				    req_op(rq), rq->cmd_flags, what, error, 0,
> +				    NULL, cgid, req_get_ioprio(rq));
> +	}

I fail to see why you cannot reuse __blk_add_trace() with the what argument
changed to a 64bit, exactly like you did for this blk_add_trace_rq() function.

>  	rcu_read_unlock();
>  }
>  
> 


-- 
Damien Le Moal
Western Digital Research




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux