Do not binary-search dirty_list, it is unsorted when MDB_WRITEMAP. Catch errors. In nested txns, put the page in mt_free_pgs after all since pages dirty in a parent txn would add complexities.