All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: zhou_xianrong <zhou_xianrong@sohu.com>
Cc: dm-devel@redhat.com, linux-kernel@vger.kernel.org,
	agk@redhat.com, snitzer@redhat.com, wanbin.wang@transsion.com,
	haizhou.song@transsion.com,
	"xianrong.zhou" <xianrong.zhou@transsion.com>,
	"yuanjiong . gao" <yuanjiong.gao@transsion.com>,
	"ruxian . feng" <ruxian.feng@transsion.com>
Subject: Re: [PATCH] dm-verity:unnecessary data blocks that need not read hash blocks
Date: Mon, 6 Jan 2020 19:14:29 -0800	[thread overview]
Message-ID: <20200107031429.GA705@sol.localdomain> (raw)
In-Reply-To: <20200107024843.8660-1-zhou_xianrong@sohu.com>

On Tue, Jan 07, 2020 at 10:48:43AM +0800, zhou_xianrong wrote:

> Subject: [PATCH] dm-verity:unnecessary data blocks that need not read

Please use a proper commit subject.  It should begin with "dm verity: " and use
the imperative tense to describe the change, e.g.

	dm verity: don't prefetch hash blocks for already-verified data

Also this should have been "PATCH v2", not simply PATCH, since you already sent
out a previous version.

You also sent out multiple copies of this email for some reason, so I just chose
one arbitrarily to reply to...

> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index 4fb33e7..4127711 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -611,8 +611,27 @@ static void verity_prefetch_io(struct work_struct *work)
>  
>  static void verity_submit_prefetch(struct dm_verity *v, struct dm_verity_io *io)
>  {
> +	sector_t block = io->block;
> +	unsigned int n_blocks = io->n_blocks;
>  	struct dm_verity_prefetch_work *pw;
>  
> +	if (v->validated_blocks) {
> +		while (n_blocks) {
> +			if (unlikely(!test_bit(block, v->validated_blocks)))
> +				break;
> +			block++;
> +			n_blocks--;
> +		}
> +		while (n_blocks) {
> +			if (unlikely(!test_bit(block + n_blocks - 1,
> +				v->validated_blocks)))
> +				break;
> +			n_blocks--;
> +		}
> +		if (!n_blocks)
> +			return;
> +	}

This looks fine now, though it's a bit more verbose than necessary, and I don't
think unlikely() will make any difference here.  Consider simplifying it to:

	if (v->validated_blocks) {
		while (n_blocks && test_bit(block, v->validated_blocks)) {
			block++;
			n_blocks--;
		}
		while (n_blocks && test_bit(block + n_blocks - 1,
					    v->validated_blocks))
			n_blocks--;
		if (!n_blocks)
			return;
	}

       reply	other threads:[~2020-01-07  3:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200107024843.8660-1-zhou_xianrong@sohu.com>
2020-01-07  3:14 ` Eric Biggers [this message]
2019-12-16  2:02 Reply [PATCH] dm-verity: unnecessary data blocks that need not read hash blocks xianrong.zhou(周先荣)
2019-12-16 18:50 ` Eric Biggers
  -- strict thread matches above, loose matches on Subject: below --
2019-12-11  3:32 zhou xianrong
2019-12-14  6:58 ` Eric Biggers

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=20200107031429.GA705@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=haizhou.song@transsion.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ruxian.feng@transsion.com \
    --cc=snitzer@redhat.com \
    --cc=wanbin.wang@transsion.com \
    --cc=xianrong.zhou@transsion.com \
    --cc=yuanjiong.gao@transsion.com \
    --cc=zhou_xianrong@sohu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.