diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/bcache/bset.c | 8 | ||||
-rw-r--r-- | drivers/md/bcache/bset.h | 8 | ||||
-rw-r--r-- | drivers/md/bcache/extents.c | 3 |
3 files changed, 11 insertions, 8 deletions
diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c index 7f8a7bd21503..f990403c4f1c 100644 --- a/drivers/md/bcache/bset.c +++ b/drivers/md/bcache/bset.c | |||
@@ -788,12 +788,8 @@ bool bch_bkey_try_merge(struct btree_keys *b, struct bkey *l, struct bkey *r) | |||
788 | * Assumes left and right are in order | 788 | * Assumes left and right are in order |
789 | * Left and right must be exactly aligned | 789 | * Left and right must be exactly aligned |
790 | */ | 790 | */ |
791 | if (KEY_U64s(l) != KEY_U64s(r) || | 791 | if (!bch_bkey_equal_header(l, r) || |
792 | KEY_DELETED(l) != KEY_DELETED(r) || | 792 | bkey_cmp(l, &START_KEY(r))) |
793 | KEY_CACHED(l) != KEY_CACHED(r) || | ||
794 | KEY_VERSION(l) != KEY_VERSION(r) || | ||
795 | KEY_CSUM(l) != KEY_CSUM(r) || | ||
796 | bkey_cmp(l, &START_KEY(r))) | ||
797 | return false; | 793 | return false; |
798 | 794 | ||
799 | return b->ops->key_merge(b, l, r); | 795 | return b->ops->key_merge(b, l, r); |
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, | |||
448 | return b->ops->key_to_text(buf, size, k); | 448 | return b->ops->key_to_text(buf, size, k); |
449 | } | 449 | } |
450 | 450 | ||
451 | static inline bool bch_bkey_equal_header(const struct bkey *l, | ||
452 | const struct bkey *r) | ||
453 | { | ||
454 | return (KEY_DIRTY(l) == KEY_DIRTY(r) && | ||
455 | KEY_PTRS(l) == KEY_PTRS(r) && | ||
456 | KEY_CSUM(l) == KEY_CSUM(l)); | ||
457 | } | ||
458 | |||
451 | /* Keylists */ | 459 | /* Keylists */ |
452 | 460 | ||
453 | struct keylist { | 461 | struct keylist { |
diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c index 7d73d8625522..c3ead586dc27 100644 --- a/drivers/md/bcache/extents.c +++ b/drivers/md/bcache/extents.c | |||
@@ -372,8 +372,7 @@ static bool bch_extent_insert_fixup(struct btree_keys *b, | |||
372 | if (KEY_START(k) > KEY_START(insert) + sectors_found) | 372 | if (KEY_START(k) > KEY_START(insert) + sectors_found) |
373 | goto check_failed; | 373 | goto check_failed; |
374 | 374 | ||
375 | if (KEY_PTRS(k) != KEY_PTRS(replace_key) || | 375 | if (!bch_bkey_equal_header(k, replace_key)) |
376 | KEY_DIRTY(k) != KEY_DIRTY(replace_key)) | ||
377 | goto check_failed; | 376 | goto check_failed; |
378 | 377 | ||
379 | /* skip past gen */ | 378 | /* skip past gen */ |