summaryrefslogtreecommitdiff
path: root/drivers/md/bcache/bset.h
diff options
context:
space:
mode:
authorNicholas Swenson <nks@daterainc.com>2013-11-12 07:36:25 +0400
committerKent Overstreet <kmo@daterainc.com>2014-01-09 01:05:14 +0400
commit3bdad1e40d11aad31f2322f21e943c31ef20d9da (patch)
tree2b268d6b0944b97338d3b7a190443551b565e562 /drivers/md/bcache/bset.h
parent0f49cf3d83fbf038534c9302095b66b07b9838c3 (diff)
downloadlinux-3bdad1e40d11aad31f2322f21e943c31ef20d9da.tar.xz
bcache: Add bch_bkey_equal_header()
Checks if two keys have equivalent header fields. (good enough for replacement or merging) Used in bch_bkey_try_merge, and replacing a key in the btree. Signed-off-by: Nicholas Swenson <nks@daterainc.com> Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/bset.h')
-rw-r--r--drivers/md/bcache/bset.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/md/bcache/bset.h b/drivers/md/bcache/bset.h
index 487373057c09..003260f4ddf6 100644
--- a/drivers/md/bcache/bset.h
+++ b/drivers/md/bcache/bset.h
@@ -448,6 +448,14 @@ static inline void bch_bkey_to_text(struct btree_keys *b, char *buf,
return b->ops->key_to_text(buf, size, k);
}
+static inline bool bch_bkey_equal_header(const struct bkey *l,
+ const struct bkey *r)
+{
+ return (KEY_DIRTY(l) == KEY_DIRTY(r) &&
+ KEY_PTRS(l) == KEY_PTRS(r) &&
+ KEY_CSUM(l) == KEY_CSUM(l));
+}
+
/* Keylists */
struct keylist {