+ // lock allocation page
+
+ bt_spinwritelock (bt->mgr->latchmgr->lock, 0);
+
+ // store chain in second right
+ bt_putid(set->page->right, bt_getid(bt->mgr->latchmgr->alloc[1].right));
+ bt_putid(bt->mgr->latchmgr->alloc[1].right, set->page_no);
+ set->page->free = 1;
+
+ // unlock released page
+
+ bt_unlockpage (BtLockDelete, set->latch);
+ bt_unlockpage (BtLockWrite, set->latch);
+ bt_unpinlatch (set->latch);
+ bt_unpinpool (set->pool);
+
+ // unlock allocation page
+
+ bt_spinreleasewrite (bt->mgr->latchmgr->lock, 0);
+}
+
+// a fence key was deleted from a page
+// push new fence value upwards
+
+BTERR bt_fixfence (BtDb *bt, BtPageSet *set, uint lvl)
+{
+unsigned char leftkey[256], rightkey[256];
+uid page_no;