diff --git a/kmod/src/alloc.c b/kmod/src/alloc.c index 34ebb4b5..392558ef 100644 --- a/kmod/src/alloc.c +++ b/kmod/src/alloc.c @@ -252,6 +252,7 @@ static struct scoutfs_ext_ops alloc_ext_ops = { .next = alloc_ext_next, .insert = alloc_ext_insert, .remove = alloc_ext_remove, + .insert_overlap_warn = true, }; static bool invalid_extent(u64 start, u64 end, u64 first, u64 last) diff --git a/kmod/src/ext.c b/kmod/src/ext.c index fdb1198a..b41ba043 100644 --- a/kmod/src/ext.c +++ b/kmod/src/ext.c @@ -13,6 +13,7 @@ #include #include +#include "msg.h" #include "ext.h" #include "counters.h" #include "scoutfs_trace.h" @@ -191,6 +192,9 @@ int scoutfs_ext_insert(struct super_block *sb, struct scoutfs_ext_ops *ops, /* inserting extent must not overlap */ if (found.len && ext_overlap(&ins, found.start, found.len)) { + if (ops->insert_overlap_warn) + scoutfs_err(sb, "inserting extent %llu.%llu overlaps existing %llu.%llu", + start, len, found.start, found.len); ret = -EINVAL; goto out; } @@ -242,6 +246,8 @@ int scoutfs_ext_remove(struct super_block *sb, struct scoutfs_ext_ops *ops, /* removed extent must be entirely within found */ if (!scoutfs_ext_inside(start, len, &found)) { + scoutfs_err(sb, "error removing extent %llu.%llu, isn't inside existing %llu.%llu", + start, len, found.start, found.len); ret = -EINVAL; goto out; } diff --git a/kmod/src/ext.h b/kmod/src/ext.h index d826d21a..baf4e6d1 100644 --- a/kmod/src/ext.h +++ b/kmod/src/ext.h @@ -15,6 +15,8 @@ struct scoutfs_ext_ops { u64 start, u64 len, u64 map, u8 flags); int (*remove)(struct super_block *sb, void *arg, u64 start, u64 len, u64 map, u8 flags); + + bool insert_overlap_warn; }; bool scoutfs_ext_can_merge(struct scoutfs_extent *left,