dm btree: factor out need_insert() helper