* Sebastian Hammer, Adam Dickmeiss
*
* $Log: bfile.c,v $
- * Revision 1.14 1995-12-01 11:37:21 adam
+ * Revision 1.15 1995-12-01 16:24:28 adam
+ * Commit files use separate meta file area.
+ *
+ * Revision 1.14 1995/12/01 11:37:21 adam
* Cached/commit files implemented as meta-files.
*
* Revision 1.13 1995/11/30 17:00:49 adam
*/
#include <stdio.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
#include <stdlib.h>
+#include <assert.h>
#include <alexutil.h>
#include <bfile.h>
void bf_cache (void)
{
if (!commit_area)
- commit_area = mf_init ("commit");
+ if (res_get (common_resource, "commit"))
+ commit_area = mf_init ("commit");
+ else
+ {
+ logf (LOG_FATAL, "Commit area must be defined if commit"
+ "is to be enabled");
+ exit (1);
+ }
}
int bf_close (BFile bf)
int first_time;
logf (LOG_LOG, "cf,mf_open %s", name);
- tmp->mf = mf_open (commit_area, name, block_size, 0);
- tmp->cf = cf_open (tmp->mf, name, block_size, wflag, &first_time);
+ tmp->mf = mf_open (0, name, block_size, 0);
+ tmp->cf = cf_open (tmp->mf, commit_area, name, block_size,
+ wflag, &first_time);
if (first_time)
{
CFile cf;
int first_time;
- if (!commit_area)
- commit_area = mf_init ("commit");
+ assert (commit_area);
if (!(inf = fopen ("cache", "r")))
{
logf (LOG_FATAL|LOG_ERRNO, "cannot open commit %s", "cache");
}
while (fscanf (inf, "%s %d", path, &block_size) == 2)
{
- mf = mf_open (commit_area, path, block_size, 1);
- cf = cf_open (mf, path, block_size, 0, &first_time);
+ mf = mf_open (0, path, block_size, 1);
+ cf = cf_open (mf, commit_area, path, block_size, 0, &first_time);
cf_commit (cf);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: cfile.c,v $
- * Revision 1.3 1995-12-01 11:37:22 adam
+ * Revision 1.4 1995-12-01 16:24:28 adam
+ * Commit files use separate meta file area.
+ *
+ * Revision 1.3 1995/12/01 11:37:22 adam
* Cached/commit files implemented as meta-files.
*
* Revision 1.2 1995/11/30 17:00:49 adam
}
-CFile cf_open (MFile mf, const char *fname, int block_size, int wflag,
- int *firstp)
+CFile cf_open (MFile mf, MFile_area area, const char *fname,
+ int block_size, int wflag, int *firstp)
{
char path[256];
int i;
cf->rmf = mf;
sprintf (path, "%s.b", fname);
- if (!(cf->block_mf = mf_open (0, path, block_size, wflag)))
+ if (!(cf->block_mf = mf_open (area, path, block_size, wflag)))
{
logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", path);
exit (1);
}
sprintf (path, "%s.h", fname);
- if (!(cf->hash_mf = mf_open (0, path, HASH_BSIZE, wflag)))
+ if (!(cf->hash_mf = mf_open (area, path, HASH_BSIZE, wflag)))
{
logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", path);
exit (1);
cf->parray[i] = NULL;
cf->bucket_lru_front = cf->bucket_lru_back = NULL;
cf->bucket_in_memory = 0;
- cf->max_bucket_in_memory = 200;
+ cf->max_bucket_in_memory = 400;
cf->dirty = 0;
cf->iobuf = xmalloc (cf->head.block_size);
memset (cf->iobuf, 0, cf->head.block_size);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: cfile.h,v $
- * Revision 1.2 1995-12-01 11:37:23 adam
+ * Revision 1.3 1995-12-01 16:24:29 adam
+ * Commit files use separate meta file area.
+ *
+ * Revision 1.2 1995/12/01 11:37:23 adam
* Cached/commit files implemented as meta-files.
*
* Revision 1.1 1995/11/30 08:33:12 adam
} *CFile;
int cf_close (CFile cf);
-CFile cf_open (MFile mf, const char *fname, int block_size, int wflag,
- int *firstp);
+CFile cf_open (MFile mf, MFile_area area, const char *fname, int block_size,
+ int wflag, int *firstp);
int cf_read (CFile cf, int no, int offset, int num, void *buf);
int cf_write (CFile cf, int no, int offset, int num, const void *buf);
void cf_commit (CFile cf);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: commit.c,v $
- * Revision 1.2 1995-12-01 11:37:24 adam
+ * Revision 1.3 1995-12-01 16:24:29 adam
+ * Commit files use separate meta file area.
+ *
+ * Revision 1.2 1995/12/01 11:37:24 adam
* Cached/commit files implemented as meta-files.
*
* Revision 1.1 1995/11/30 08:33:13 adam
void cf_commit (CFile cf)
{
- int i, r, bucket_no;
+ int i, bucket_no;
int hash_bytes;
struct CFile_ph_bucket *p;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: bfile.h,v $
- * Revision 1.9 1995-12-01 11:37:46 adam
+ * Revision 1.10 1995-12-01 16:24:33 adam
+ * Commit files use separate meta file area.
+ *
+ * Revision 1.9 1995/12/01 11:37:46 adam
* Cached/commit files implemented as meta-files.
*
* Revision 1.8 1995/11/30 08:33:29 adam
BFile bf_open (const char *name, int block_size, int wflag);
int bf_read (BFile bf, int no, int offset, int num, void *buf);
int bf_write (BFile bf, int no, int offset, int num, const void *buf);
-void bf_cache ();
-void bf_commit ();
+void bf_cache (void);
+void bf_commit (void);
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: main.c,v $
- * Revision 1.24 1995-11-30 17:01:38 adam
+ * Revision 1.25 1995-12-01 16:24:39 adam
+ * Commit files use separate meta file area.
+ *
+ * Revision 1.24 1995/11/30 17:01:38 adam
* New setting commitCache: points to commit directories/files.
* New command commit: commits at the end of a zebraidx run.
*
{
if (!common_resource)
{
+ const char *rval;
common_resource = res_open (configName ?
configName : FNAME_CONFIG);
if (!common_resource)
exit (1);
}
data1_tabpath = res_get (common_resource, "profilePath");
- bf_cache (res_get (common_resource, "commitCache"));
+ rval = res_get (common_resource, "commitEnable");
+ if (rval && atoi(rval))
+ bf_cache ();
}
if (!strcmp (arg, "update"))
cmd = 'u';
if (commit_at_end)
{
logf (LOG_LOG, "commiting");
- bf_commit (res_get (common_resource, "commitCache"));
+ bf_commit ();
}
exit (0);
}