Re: [PATCH] bcache: fix wrong cache_misses statistics

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

 



On 2017/5/4 下午8:04, tang.junhui@xxxxxxxxxx wrote:
> From: "tang.junhui" <tang.junhui@xxxxxxxxxx>
> 
> Some missed IOs are not counted into cache_misses, this patch fix this
> issue.
> 
> Signed-off-by: tang.junhui <tang.junhui@xxxxxxxxxx>
> ---
>  drivers/md/bcache/request.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 76d2087..cf746b2 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -468,6 +468,7 @@ struct search {
>  	unsigned		recoverable:1;
>  	unsigned		write:1;
>  	unsigned		read_dirty_data:1;
> +	unsigned		cache_missed:1;
>  
>  	unsigned long		start_time;
>  
> @@ -653,6 +654,7 @@ static inline struct search *search_alloc(struct bio *bio,
>  
>  	s->orig_bio		= bio;
>  	s->cache_miss		= NULL;
> +	s->cache_missed		= 0;
>  	s->d			= d;
>  	s->recoverable		= 1;
>  	s->write		= op_is_write(bio_op(bio));
> @@ -764,7 +766,7 @@ static void cached_dev_read_done_bh(struct closure *cl)
>  	struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);
>  
>  	bch_mark_cache_accounting(s->iop.c, s->d,
> -				  !s->cache_miss, s->iop.bypass);
> +				  !s->cache_missed, s->iop.bypass);
>  	trace_bcache_read(s->orig_bio, !s->cache_miss, s->iop.bypass);
>  
>  	if (s->iop.error)
> @@ -783,6 +785,8 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s,
>  	struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);
>  	struct bio *miss, *cache_bio;
>  
> +	s->cache_missed = true;
> +


Hi Junhui,

Since here true is assigned to cache_missed, why not define
cache_missed:1 as bool type ?

Thanks.



>  	if (s->cache_miss || s->iop.bypass) {
>  		miss = bio_next_split(bio, sectors, GFP_NOIO, s->d->bio_split);
>  		ret = miss == bio ? MAP_DONE : MAP_CONTINUE;
> 


-- 
Coly Li
--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux