aboutsummaryrefslogtreecommitdiffstats
path: root/libibex/block.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-10-12 21:40:55 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-10-12 21:40:55 +0800
commit1deca02b41aae9bf2632ea1420cc900fcf41531d (patch)
treee26816ec82c3990801aca2a35686d5df2ba00957 /libibex/block.c
parent6c337e9ea0623b48688c018973d35823dde21f60 (diff)
downloadgsoc2013-evolution-1deca02b41aae9bf2632ea1420cc900fcf41531d.tar
gsoc2013-evolution-1deca02b41aae9bf2632ea1420cc900fcf41531d.tar.gz
gsoc2013-evolution-1deca02b41aae9bf2632ea1420cc900fcf41531d.tar.bz2
gsoc2013-evolution-1deca02b41aae9bf2632ea1420cc900fcf41531d.tar.lz
gsoc2013-evolution-1deca02b41aae9bf2632ea1420cc900fcf41531d.tar.xz
gsoc2013-evolution-1deca02b41aae9bf2632ea1420cc900fcf41531d.tar.zst
gsoc2013-evolution-1deca02b41aae9bf2632ea1420cc900fcf41531d.zip
Added some stat stuff.
2000-10-12 Not Zed <NotZed@HelixCode.com> * index.h: Added some stat stuff. * wordindex.c (struct _wordcache): Changed files[] to be a pointer to an allocated block/or an individual item. (find): Fix for changes to struct. (find_name): " (sync_cache_entry): " (add): " (add_list): " (add_index_cache): Free the cache file array if it was created. (word_flush): And here. (word_close): And here too. (ibex_create_word_index): Double the size of the hashtables. (word_flush): Make sure we reset the wordcount to 0 if we remove the list items. DOH. (add_index_cache): Use a slightly more sohpisticated aging algorithm to remove expired nodes. 2000-10-10 Not Zed <NotZed@HelixCode.com> * hash.c (hash_find): (hash_remove): (hash_insert): Truncate key if it is too big to fit in a single block to MAX_KEYLEN bytes. svn path=/trunk/; revision=5882
Diffstat (limited to 'libibex/block.c')
-rw-r--r--libibex/block.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libibex/block.c b/libibex/block.c
index d971077dba..6f6cd60657 100644
--- a/libibex/block.c
+++ b/libibex/block.c
@@ -38,6 +38,7 @@
#define d(x)
/*#define DEBUG*/
+int block_log;
#ifdef IBEX_STATS
static void
@@ -202,6 +203,9 @@ ibex_block_dirty(struct _block *block)
static void
sync_block(struct _memcache *block_cache, struct _memblock *memblock)
{
+ if (block_log)
+ printf("writing block %d\n", memblock->block);
+
lseek(block_cache->fd, memblock->block, SEEK_SET);
if (write(block_cache->fd, &memblock->data, sizeof(memblock->data)) != -1) {
memblock->flags &= ~BLOCK_DIRTY;
@@ -324,6 +328,9 @@ ibex_block_read(struct _memcache *block_cache, blockid_t blockid)
add_miss(block_cache, blockid);
add_read(block_cache, blockid);
#endif
+ if (block_log)
+ printf("miss block %d\n", blockid);
+
d(printf("loading blockid from disk %d\n", blockid));
memblock = g_malloc(sizeof(*memblock));
memblock->block = blockid;
@@ -345,6 +352,8 @@ ibex_block_read(struct _memcache *block_cache, blockid_t blockid)
struct _memblock *rootblock = g_hash_table_lookup(block_cache->index, (void *)0);
struct _root *root = (struct _root *)&rootblock->data;
+ printf("Unsyncing root block\n");
+
g_assert(rootblock != NULL);
root->flags &= ~IBEX_ROOT_SYNCF;
sync_block(block_cache, rootblock);