+ /* Need to hold a hash lock to expand DB: transactions rely on it. */
+ if (!(tdb->flags & TDB_NOLOCK)
+ && !tdb->allrecord_lock.count && !tdb_has_hash_locks(tdb)) {
+ return tdb_logerr(tdb, TDB_ERR_LOCK, TDB_LOG_ERROR,
+ "tdb_expand: must hold lock during expand");
+ }
+
+ /* always make room for at least 100 more records, and at
+ least 25% more space. */
+ if (size * TDB_EXTENSION_FACTOR > tdb->map_size / 4)
+ wanted = size * TDB_EXTENSION_FACTOR;
+ else
+ wanted = tdb->map_size / 4;
+ wanted = adjust_size(0, wanted);
+