From 519b9c35c4deb0e7347ae58a2c5d5383d6b85b57 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 16 Jan 2017 14:03:33 -0800 Subject: [PATCH] Correcly wrap when finding compaction entries Compaction looks for the next entry at a given level to compact. It only tested for not finding a next entry when it needs to wrap the key and start over in the level, it missed the case where the next entry is at a greater level. Signed-off-by: Zach Brown --- kmod/src/manifest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmod/src/manifest.c b/kmod/src/manifest.c index 2f586466..b67c1f9b 100644 --- a/kmod/src/manifest.c +++ b/kmod/src/manifest.c @@ -714,7 +714,7 @@ int scoutfs_manifest_next_compact(struct super_block *sb, void *data) skey.level = level; skey.seq = 0; ment = scoutfs_treap_lookup_next(mani->treap, &skey); - if (ment == NULL && scoutfs_kvec_length(skey.key)) { + if (ment == NULL || ment->level != level) { /* XXX ugh, these kvecs are the worst */ scoutfs_kvec_init(skey.key, skey.key[0].iov_base, 0);