Re: [PATCH] bcache: print number of keys in trace_bcache_journal_write

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

 



On 11/29/18 5:28 AM, Guoju Fang wrote:
> Sometimes flush journal may be very frequent, so it's useful to dump
> number of keys every time write journal.
> 
> Signed-off-by: Guoju Fang <fangguoju@xxxxxxxxx>

Hi Guoju,

This patch looks good to me. Will add it in my for-next.

Thanks.

Coly LI

> ---
>  drivers/md/bcache/journal.c   |  2 +-
>  include/trace/events/bcache.h | 27 ++++++++++++++++++++++++---
>  2 files changed, 25 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
> index 522c742..b2fd412 100644
> --- a/drivers/md/bcache/journal.c
> +++ b/drivers/md/bcache/journal.c
> @@ -663,7 +663,7 @@ static void journal_write_unlocked(struct closure *cl)
>  				 REQ_SYNC|REQ_META|REQ_PREFLUSH|REQ_FUA);
>  		bch_bio_map(bio, w->data);
>  
> -		trace_bcache_journal_write(bio);
> +		trace_bcache_journal_write(bio, w->data->keys);
>  		bio_list_add(&list, bio);
>  
>  		SET_PTR_OFFSET(k, i, PTR_OFFSET(k, i) + sectors);
> diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
> index 2cbd6e4..e4526f8 100644
> --- a/include/trace/events/bcache.h
> +++ b/include/trace/events/bcache.h
> @@ -221,9 +221,30 @@
>  	TP_ARGS(c)
>  );
>  
> -DEFINE_EVENT(bcache_bio, bcache_journal_write,
> -	TP_PROTO(struct bio *bio),
> -	TP_ARGS(bio)
> +TRACE_EVENT(bcache_journal_write,
> +	TP_PROTO(struct bio *bio, u32 keys),
> +	TP_ARGS(bio, keys),
> +
> +	TP_STRUCT__entry(
> +		__field(dev_t,		dev			)
> +		__field(sector_t,	sector			)
> +		__field(unsigned int,	nr_sector		)
> +		__array(char,		rwbs,	6		)
> +		__field(u32,		nr_keys			)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->dev		= bio_dev(bio);
> +		__entry->sector		= bio->bi_iter.bi_sector;
> +		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
> +		__entry->nr_keys	= keys;
> +		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
> +	),
> +
> +	TP_printk("%d,%d  %s %llu + %u keys %u",
> +		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
> +		  (unsigned long long)__entry->sector, __entry->nr_sector,
> +		  __entry->nr_keys)
>  );
>  
>  /* Btree */
> 




[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