On 08/27/2018 04:09 PM, Shenghui Wang wrote:
Return BTREE_INSERT_STATUS_INSERT for insert, instead of
BTREE_INSERT_STATUS_FRONT_MERGE, in bch_btree_insert_key.
Signed-off-by: Shenghui Wang <shhuiw@xxxxxxxxxxx>
Hi Shenghui,
Could you please explain more on,
- What is the problem with current return value
- How your change fixes such problem
Thanks.
Coly Li
---
drivers/md/bcache/bset.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
index 8f07fa6e1739..6840a79923e9 100644
--- a/drivers/md/bcache/bset.c
+++ b/drivers/md/bcache/bset.c
@@ -897,8 +897,6 @@ unsigned int bch_btree_insert_key(struct btree_keys *b, struct bkey *k,
if (b->ops->insert_fixup(b, k, &iter, replace_key))
return status;
- status = BTREE_INSERT_STATUS_INSERT;
-
while (m != bset_bkey_last(i) &&
bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0)
prev = m, m = bkey_next(m);
@@ -919,6 +917,7 @@ unsigned int bch_btree_insert_key(struct btree_keys *b, struct bkey *k,
bch_bkey_try_merge(b, k, m))
goto copy;
+ status = BTREE_INSERT_STATUS_INSERT;
bch_bset_insert(b, m, k);
copy: bkey_copy(m, k);
merged: