From: Liu Hua <liusdu@126.com>
To: colyli@suse.de, kent.overstreet@gmail.com, linux-bcache@vger.kernel.org
Cc: sdu.liu@huawei.com, Liu Hua <liusdu@126.com>
Subject: [PATCH] bcache: insert bkeys without overlap when placeholder missed
Date: Tue, 22 Sep 2020 23:28:34 +0800 [thread overview]
Message-ID: <20200922152834.7418-1-liusdu@126.com> (raw)
Btree spliting and garbage collection process will drop
placeholders, which may cause cache miss collision. We can
insert nonoverlapping bkeys with write lock. It is helpful
for performance.
Signed-off-by: Liu Hua <liusdu@126.com>
---
drivers/md/bcache/extents.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c
index c809724e6571..cc8af08aee8d 100644
--- a/drivers/md/bcache/extents.c
+++ b/drivers/md/bcache/extents.c
@@ -329,6 +329,7 @@ static bool bch_extent_insert_fixup(struct btree_keys *b,
uint64_t old_offset;
unsigned int old_size, sectors_found = 0;
+ bool overlay = false;
BUG_ON(!KEY_OFFSET(insert));
BUG_ON(!KEY_SIZE(insert));
@@ -340,15 +341,18 @@ static bool bch_extent_insert_fixup(struct btree_keys *b,
break;
if (bkey_cmp(&START_KEY(k), insert) >= 0) {
- if (KEY_SIZE(k))
- break;
- else
+ if (!KEY_SIZE(k))
continue;
+ if (replace_key && overlay == false)
+ goto out;
+ break;
}
if (bkey_cmp(k, &START_KEY(insert)) <= 0)
continue;
+ overlay = true;
+
old_offset = KEY_START(k);
old_size = KEY_SIZE(k);
--
2.17.1
next reply other threads:[~2020-09-22 16:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 15:28 Liu Hua [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-09-22 15:47 [PATCH] bcache: insert bkeys without overlap when placeholder missed Liu Hua
2020-09-22 15:51 ` Coly Li
[not found] ` <847d3dad-e9be-b79f-da61-41466dc4d6ef@126.com>
2020-09-23 15:26 ` Coly Li
2020-09-24 11:51 ` Liu Hua
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=20200922152834.7418-1-liusdu@126.com \
--to=liusdu@126.com \
--cc=colyli@suse.de \
--cc=kent.overstreet@gmail.com \
--cc=linux-bcache@vger.kernel.org \
--cc=sdu.liu@huawei.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