NULL, /* Volume dirpath */
1, /* bdb logfile autoremove */
64 * 1024, /* bdb cachesize (64 MB) */
- -1, /* not used ... */
- -1,
- "",
- -1,
- -1,
- -1
+ DEFAULT_MAXLOCKS, /* maxlocks */
+ DEFAULT_MAXLOCKOBJS, /* maxlockobjs */
+ 0, /* flush_interval */
+ 0, /* flush_frequency */
+ 1000, /* txn_frequency */
+ 0, /* usock_file */
+ -1, /* fd_table_size */
+ -1, /* idle_timeout */
+ -1 /* max_vols */
};
-static char dbpath[PATH_MAX]; /* Path to the dbd database */
+static char dbpath[MAXPATHLEN+1]; /* Path to the dbd database */
/*
Provide some logging
cnid_t db_cnid, ad_cnid;
struct adouble ad;
+ /* Force checkout every X items */
+ static int cnidcount = 0;
+ cnidcount++;
+ if (cnidcount > 10000) {
+ cnidcount = 0;
+ if (dbif_txn_checkpoint(dbd, 0, 0, 0) < 0) {
+ dbd_log(LOGSTD, "Error checkpointing!");
+ return 0;
+ }
+ }
+
/* Get CNID from ad-file if volume is using AFPVOL_CACHE */
ad_cnid = 0;
- if ( (volinfo->v_flags & AFPVOL_CACHE) && ADFILE_OK) {
- ad_init(&ad, volinfo->v_adouble, volinfo->v_ad_options);
+ if ( (myvolinfo->v_flags & AFPVOL_CACHE) && ADFILE_OK) {
+ ad_init(&ad, myvolinfo->v_adouble, myvolinfo->v_ad_options);
if (ad_open_metadata( name, adflags, O_RDWR, &ad) != 0) {
if (dbd_flags & DBD_FLAGS_CLEANUP)
dbd_log(LOGSTD, "Ghost CNID: %u. This is fatal! Dumping rebuild db:\n", rebuild_cnid);
dbif_dump(dbd_rebuild, 0);
dbd_log(LOGSTD, "Send this dump and a `dbd -d ...` dump to the Netatalk Dev team!");
- dbif_txn_close(dbd, ret);
- dbif_idwalk(dbd, NULL, 1); /* Close cursor */
- dbif_idwalk(dbd_rebuild, NULL, 1); /* Close cursor */
goto cleanup;
}
- }
+ } /* while ((dbif_idwalk(dbd, &dbd_cnid, 0)) == 1) */
cleanup:
dbif_idwalk(dbd, NULL, 1); /* Close cursor */
const char *tmpdb_path = NULL;
/* Set cachesize for in-memory rebuild db */
- db_param.cachesize = 128 * 1024 * 1024; /* 128 MB */
+ db_param.cachesize = 128 * 1024; /* 128 MB */
+ db_param.maxlocks = DEFAULT_MAXLOCKS;
+ db_param.maxlockobjs = DEFAULT_MAXLOCKOBJS;
+ db_param.txn_frequency = 1000; /* close txn every 1000 objects */
+ db_param.logfile_autoremove = 1;
/* Make it accessible for all funcs */
dbd = dbd_ref;