summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-09-05 18:43:19 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2016-09-08 19:07:20 -0800
commitfbd8713814bbfe2f97ea47ab6622dcc877f24c94 (patch)
treedcbea3b9e5e4c66f971e9d56c087422c25252d72
parentad3a86bc483abc4dd39c75ebca30f76ee560b054 (diff)
bcache: fix extent_sort_ptrs()
-rw-r--r--drivers/md/bcache/extents.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c
index 0beda6a36f55..0422fb27f1d7 100644
--- a/drivers/md/bcache/extents.c
+++ b/drivers/md/bcache/extents.c
@@ -1843,8 +1843,11 @@ static void __extent_sort_ptrs(struct cache_member_rcu *mi,
extent_for_each_ptr_crc(src, src_ptr, src_crc) {
extent_for_each_ptr_crc(dst, dst_ptr, dst_crc)
if (PTR_TIER(mi, src_ptr) < PTR_TIER(mi, dst_ptr))
- break;
+ goto found;
+ dst_ptr = &extent_entry_last(dst)->ptr;
+ dst_crc = NULL;
+found:
/* found insert position: */
/*
@@ -1896,12 +1899,14 @@ static void extent_sort_ptrs(struct cache_set *c, struct bkey_s_extent e)
*/
mi = cache_member_info_get(c);
- extent_for_each_ptr_crc(e, ptr, crc)
+ extent_for_each_ptr_crc(e, ptr, crc) {
if (prev &&
PTR_TIER(mi, ptr) < PTR_TIER(mi, prev)) {
__extent_sort_ptrs(mi, e);
break;
}
+ prev = ptr;
+ }
cache_member_info_put();
}