Fix a bug in reading usage maps

This commit is contained in:
whydoubt
2004-08-28 23:00:25 +00:00
parent 01e7458954
commit c5e11e5445
3 changed files with 17 additions and 13 deletions

View File

@@ -269,16 +269,20 @@ int mdb_read_next_dpg(MdbTableDef *table)
MdbCatalogEntry *entry = table->entry;
MdbHandle *mdb = entry->mdb;
int next_pg;
int map_type;
#ifndef SLOW_READ
next_pg = mdb_map_find_next(mdb, table->usage_map,
table->map_sz, table->cur_phys_pg);
if (next_pg && mdb_read_pg(mdb, next_pg)) {
table->cur_phys_pg = next_pg;
return table->cur_phys_pg;
if (next_pg >= 0) {
if (mdb_read_pg(mdb, next_pg)) {
table->cur_phys_pg = next_pg;
return table->cur_phys_pg;
} else {
return 0;
}
}
fprintf(stderr, "Warning: defaulting to brute force read\n");
#endif
/* can't do a fast read, go back to the old way */
do {