From 62e26c5d96de7ea62131b1622e71fe39a51be03e Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 27 Mar 2018 12:45:07 -0700 Subject: [PATCH] scoutfs: scoutfs_bug_on to show bad append order Use scoutfs_bug_on() to freak out if we append items to a segment out of order. We don't really return errors from this path, we should, but for now at least share the keys that show the problem. Signed-off-by: Zach Brown --- kmod/src/seg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod/src/seg.c b/kmod/src/seg.c index 600c4560..fea5ea4f 100644 --- a/kmod/src/seg.c +++ b/kmod/src/seg.c @@ -27,6 +27,7 @@ #include "key.h" #include "counters.h" #include "triggers.h" +#include "msg.h" #include "scoutfs_trace.h" /* @@ -664,7 +665,9 @@ bool scoutfs_seg_append_item(struct super_block *sb, struct scoutfs_segment *seg off = le32_to_cpu(sblk->last_item_off); if (off) { item = off_ptr(seg, off); - BUG_ON(scoutfs_key_compare(key, &item->key) <= 0); + scoutfs_bug_on(sb, scoutfs_key_compare(key, &item->key) <= 0, + "key "SK_FMT" item->key "SK_FMT, + SK_ARG(key), SK_ARG(&item->key)); } nr_links = skip_next_nr(le32_to_cpu(sblk->nr_items));