X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=bfile%2Fcfile.c;h=6f35a2e05352f324ab77b0894d9a4ba12670bb81;hb=75573f447b51a5d666a115fbf445af3d2717be48;hp=c1fd26f9561af6a585a146f3cd80e5d84df0172b;hpb=20956e941d49591da38aceb603792605521e0e60;p=idzebra-moved-to-github.git diff --git a/bfile/cfile.c b/bfile/cfile.c index c1fd26f..6f35a2e 100644 --- a/bfile/cfile.c +++ b/bfile/cfile.c @@ -1,10 +1,22 @@ /* - * Copyright (C) 1995, Index Data I/S + * Copyright (C) 1995-1998, Index Data * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: cfile.c,v $ - * Revision 1.16 1996-04-19 16:23:47 adam + * Revision 1.20 1998-08-07 15:07:13 adam + * Fixed but in cf_commit_flat. + * + * Revision 1.19 1997/02/12 20:37:17 adam + * Changed the messages logged. No real code changed. + * + * Revision 1.18 1996/10/29 13:56:15 adam + * Include of zebrautl.h instead of alexutil.h. + * + * Revision 1.17 1996/04/19 16:49:00 adam + * Minor changes. + * + * Revision 1.16 1996/04/19 16:23:47 adam * Serious bug fix in shadow implementation; function new_bucket might * set wrong bucket number on new bucket. * @@ -63,7 +75,7 @@ #include #include -#include +#include #include #include "cfile.h" @@ -115,7 +127,7 @@ CFile cf_open (MFile mf, MFile_area area, const char *fname, int hash_bytes; cf->rmf = mf; - logf (LOG_LOG, "cf_open %s %s", cf->rmf->name, wflag ? "rdwr" : "rd"); + logf (LOG_LOG, "cf: open %s %s", cf->rmf->name, wflag ? "rdwr" : "rd"); sprintf (path, "%s-b", fname); if (!(cf->block_mf = mf_open (area, path, block_size, wflag))) { @@ -183,11 +195,7 @@ CFile cf_open (MFile mf, MFile_area area, const char *fname, static int cf_hash (CFile cf, int no) { -#if 1 return (no>>3) % cf->head.hash_size; -#else - return (no/(HASH_BUCKET*2+2)) % cf->head.hash_size; -#endif } static void release_bucket (CFile cf, struct CFile_hash_bucket *p) @@ -323,7 +331,7 @@ static int cf_lookup_hash (CFile cf, int no) } if (hb) continue; -#if 1 +#if 0 /* extra check ... */ for (hb = cf->bucket_lru_back; hb; hb = hb->lru_next) { @@ -366,8 +374,8 @@ static void cf_moveto_flat (CFile cf) struct CFile_hash_bucket *p; int i, j; - logf (LOG_LOG, "Moving to flat shadow: %s", cf->rmf->name); - logf (LOG_LOG, "hits=%d miss=%d bucket_in_memory=%d total=%d", + logf (LOG_LOG, "cf: Moving to flat shadow: %s", cf->rmf->name); + logf (LOG_LOG, "cf: hits=%d miss=%d bucket_in_memory=%d total=%d", cf->no_hits, cf->no_miss, cf->bucket_in_memory, cf->head.next_bucket - cf->head.first_bucket); assert (cf->head.state == 1); @@ -439,7 +447,7 @@ static int cf_new_hash (CFile cf, int no) if (hb) continue; -#if 1 +#if 0 /* extra check ... */ for (hb = cf->bucket_lru_back; hb; hb = hb->lru_next) { @@ -528,18 +536,15 @@ int cf_write (CFile cf, int no, int offset, int num, const void *buf) int cf_close (CFile cf) { - logf (LOG_LOG, "hits=%d miss=%d bucket_in_memory=%d total=%d", + logf (LOG_DEBUG, "cf: hits=%d miss=%d bucket_in_memory=%d total=%d", cf->no_hits, cf->no_miss, cf->bucket_in_memory, cf->head.next_bucket - cf->head.first_bucket); flush_bucket (cf, -1); if (cf->dirty) { - logf (LOG_LOG, "cf_close %s, dirty", cf->rmf->name); mf_write (cf->hash_mf, 0, 0, sizeof(cf->head), &cf->head); write_head (cf); } - else - logf (LOG_LOG, "cf_close %s", cf->rmf->name); mf_close (cf->hash_mf); mf_close (cf->block_mf); xfree (cf->array);