diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-07-01 19:29:05 -0700 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2013-11-10 21:56:36 -0800 |
commit | 0eacac22034ca21c73fe49e800d0b938b2047250 (patch) | |
tree | 5ff18b8b3296de48a5fa7e60aeedf2e2d2789a0a /drivers/md/bcache/btree.c | |
parent | d5cc66e95744065f96024add4bf7d7e019be54ac (diff) | |
download | op-kernel-dev-0eacac22034ca21c73fe49e800d0b938b2047250.zip op-kernel-dev-0eacac22034ca21c73fe49e800d0b938b2047250.tar.gz |
bcache: PRECEDING_KEY()
btree_insert_key() was open coding this, this is just refactoring.
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/btree.c')
-rw-r--r-- | drivers/md/bcache/btree.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 7dff73b..773b0e9 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -1844,19 +1844,14 @@ static bool btree_insert_key(struct btree *b, struct btree_op *op, if (!b->level) { struct btree_iter iter; - struct bkey search = KEY(KEY_INODE(k), KEY_START(k), 0); /* * bset_search() returns the first key that is strictly greater * than the search key - but for back merging, we want to find - * the first key that is greater than or equal to KEY_START(k) - - * unless KEY_START(k) is 0. + * the previous key. */ - if (KEY_OFFSET(&search)) - SET_KEY_OFFSET(&search, KEY_OFFSET(&search) - 1); - prev = NULL; - m = bch_btree_iter_init(b, &iter, &search); + m = bch_btree_iter_init(b, &iter, PRECEDING_KEY(&START_KEY(k))); if (fix_overlapping_extents(b, k, &iter, replace_key)) { op->insert_collision = true; |