linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Fengfei Xi <xi.fengfei@h3c.com>
Cc: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org,
	kent.overstreet@gmail.com
Subject: Re: [PATCH] bcache: remove the redundant judgment on bi_size
Date: Sun, 29 Aug 2021 15:49:44 +0800	[thread overview]
Message-ID: <be10bf36-5a99-f441-767f-23e76a96aa73@suse.de> (raw)
In-Reply-To: <20210829044947.14703-1-xi.fengfei@h3c.com>

On 8/29/21 12:49 PM, Fengfei Xi wrote:
> The bi_size is unsigned int type data not less than 0,
> so we can directly add bi_size without extra judgment
>
> Signed-off-by: Fengfei Xi <xi.fengfei@h3c.com>

NACK. The check is necessary to avoid redundant and unnecessary memory 
write.

Coly Li

> ---
>   drivers/md/bcache/request.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 6d1de889b..2788eec3a 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -423,9 +423,7 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio)
>   	add_sequential(task);
>   	i->sequential = 0;
>   found:
> -	if (i->sequential + bio->bi_iter.bi_size > i->sequential)
> -		i->sequential	+= bio->bi_iter.bi_size;
> -
> +	i->sequential		+= bio->bi_iter.bi_size;
>   	i->last			 = bio_end_sector(bio);
>   	i->jiffies		 = jiffies + msecs_to_jiffies(5000);
>   	task->sequential_io	 = i->sequential;


  reply	other threads:[~2021-08-29  7:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-29  4:49 [PATCH] bcache: remove the redundant judgment on bi_size Fengfei Xi
2021-08-29  7:49 ` Coly Li [this message]
2021-08-30  6:23 Xifengfei
2021-08-30  6:29 Xifengfei
2021-08-31  1:35 ` Coly Li
2021-08-31  2:05 Xifengfei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be10bf36-5a99-f441-767f-23e76a96aa73@suse.de \
    --to=colyli@suse.de \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xi.fengfei@h3c.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).