Skip to content

Commit

Permalink
Ticket #47312 - replace PR_GetFileInfo with PR_GetFileInfo64
Browse files Browse the repository at this point in the history
https://fedorahosted.org/389/ticket/47312
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: Since we are returning a PRUint64 for the db file size, we
have to use PRUint64 everywhere - on a 32-bit system, we can have 64-bit
sized files.  We also have to use the NSPR printf format macro to print
the 64-bit values.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
  • Loading branch information
richm committed Apr 3, 2013
1 parent 17d0158 commit 9d5dedd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ldap/servers/slapd/back-ldbm/dblayer.c
Expand Up @@ -1919,7 +1919,7 @@ check_and_set_import_cache(struct ldbminfo *li)
return 0;
}

size_t
PRUint64
dblayer_get_id2entry_size(ldbm_instance *inst)
{
struct ldbminfo *li = NULL;
Expand Down
2 changes: 1 addition & 1 deletion ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
Expand Up @@ -180,7 +180,7 @@ int dblayer_db_uses_mpool(DB_ENV *db_env);
int dblayer_db_uses_logging(DB_ENV *db_env);
int dblayer_bt_compare(DB *db, const DBT *dbt1, const DBT *dbt2);
int dblayer_remove_env(struct ldbminfo *li);
size_t dblayer_get_id2entry_size(ldbm_instance *inst);
PRUint64 dblayer_get_id2entry_size(ldbm_instance *inst);

int ldbm_back_get_info(Slapi_Backend *be, int cmd, void **info);
int ldbm_back_set_info(Slapi_Backend *be, int cmd, void *info);
Expand Down
28 changes: 14 additions & 14 deletions ldap/servers/slapd/back-ldbm/start.c
Expand Up @@ -154,38 +154,38 @@ ldbm_back_start( Slapi_PBlock *pb )
int zone_pages, db_pages, entry_pages, import_pages;
Object *inst_obj;
ldbm_instance *inst;
size_t cache_size;
size_t db_size;
size_t total_cache_size = 0;
size_t memsize = pages * pagesize;
size_t extra = 0; /* e.g., dncache size */
PRUint64 cache_size;
PRUint64 db_size;
PRUint64 total_cache_size = 0;
PRUint64 memsize = pages * pagesize;
PRUint64 extra = 0; /* e.g., dncache size */

for (inst_obj = objset_first_obj(li->li_instance_set); inst_obj;
inst_obj = objset_next_obj(li->li_instance_set, inst_obj)) {
inst = (ldbm_instance *)object_get_data(inst_obj);
cache_size = cache_get_max_size(&(inst->inst_cache));
cache_size = (PRUint64)cache_get_max_size(&(inst->inst_cache));
db_size = dblayer_get_id2entry_size(inst);
if (cache_size < db_size) {
LDAPDebug(LDAP_DEBUG_ANY,
"WARNING: %s: entry cache size %luB is "
"less than db size %luB; "
"WARNING: %s: entry cache size %" NSPRIu64 "B is "
"less than db size %" NSPRIu64 "B; "
"We recommend to increase the entry cache size "
"nsslapd-cachememsize.\n",
inst->inst_name, cache_size, db_size);
} else {
LDAPDebug(LDAP_DEBUG_BACKLDBM,
"%s: entry cache size: %luB; db size: %luB\n",
"%s: entry cache size: %" NSPRIu64 "B; db size: %" NSPRIu64 "B\n",
inst->inst_name, cache_size, db_size);
}
total_cache_size += cache_size;
/* estimated overhead: dncache size * 2 */
extra += cache_get_max_size(&(inst->inst_dncache)) * 2;
extra += (PRUint64)cache_get_max_size(&(inst->inst_dncache)) * 2;
}
LDAPDebug(LDAP_DEBUG_BACKLDBM,
"Total entry cache size: %luB; "
"dbcache size: %luB; "
"available memory size: %luB\n",
total_cache_size, li->li_dbcachesize, memsize - extra);
"Total entry cache size: %" NSPRIu64 "B; "
"dbcache size: %" NSPRIu64 "B; "
"available memory size: %" NSPRIu64 "B\n",
total_cache_size, (PRUint32)li->li_dbcachesize, memsize - extra);
/* autosizing dbCache and entryCache */
if (li->li_cache_autosize > 0) {
zone_pages = (li->li_cache_autosize * pages) / 100;
Expand Down

0 comments on commit 9d5dedd

Please sign in to comment.