linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: xianrong_zhou@163.com
To: dm-devel@redhat.com
Cc: linux-kernel@vger.kernel.org, agk@redhat.com, snitzer@redhat.com,
	haizhou.song@transsion.com, xianrong.zhou@transsion.com,
	zhouxianrong <xianrong_zhou@163.com>,
	"yuanjiong . gao" <yuanjiong.gao@transsion.com>,
	"ruxian . feng" <ruxian.feng@transsion.com>
Subject: [PATCH] dm: shrink data blocks using bitmap for hash reading
Date: Sun, 15 Dec 2019 12:13:22 +0800	[thread overview]
Message-ID: <20191215041322.7874-1-xianrong_zhou@163.com> (raw)

From: zhouxianrong <xianrong_zhou@163.com>

If check_at_most_once enabled, just like verity work,
the prefetching work should check for data block bitmap
firstly before reading hash block as well.This can reduce
99.28% data blocks which need not to read hash blocks.

The reduced data blocks would be enlarged again by cluster
reading later.

Signed-off-by: zhouxianrong <xianrong_zhou@163.com>
Signed-off-by: yuanjiong.gao <yuanjiong.gao@transsion.com>
Signed-off-by: ruxian.feng <ruxian.feng@transsion.com>
---
 drivers/md/dm-verity-target.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index 4fb33e7562c5..fe4c15a0723c 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -581,6 +581,23 @@ static void verity_prefetch_io(struct work_struct *work)
 	struct dm_verity *v = pw->v;
 	int i;
 
+	if (v->validated_blocks) {
+		while (pw->n_blocks) {
+			if (unlikely(!test_bit(pw->block, v->validated_blocks)))
+				break;
+			pw->block++;
+			pw->n_blocks--;
+		}
+		while (pw->n_blocks) {
+			if (unlikely(!test_bit(pw->block + pw->n_blocks - 1,
+				v->validated_blocks)))
+				break;
+			pw->n_blocks--;
+		}
+		if (!pw->n_blocks)
+			return;
+	}
+
 	for (i = v->levels - 2; i >= 0; i--) {
 		sector_t hash_block_start;
 		sector_t hash_block_end;
-- 
2.17.2



                 reply	other threads:[~2019-12-15  4:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20191215041322.7874-1-xianrong_zhou@163.com \
    --to=xianrong_zhou@163.com \
    --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=xianrong.zhou@transsion.com \
    --cc=yuanjiong.gao@transsion.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).