diff -ur ddumbfs-1.1.orig/src/ddfslib.c ddumbfs-1.1/src/ddfslib.c --- ddumbfs-1.1.orig/src/ddfslib.c 2013-01-12 07:13:30.000000000 +0800 +++ ddumbfs-1.1/src/ddfslib.c 2014-12-08 09:42:28.202953103 +0800 @@ -1479,6 +1479,10 @@ } + if(!ddfs->lock_index) { + madvise(ddfs->nodes, ddfs->c_node_block_count*ddfs->c_index_block_size, MADV_RANDOM); + } + long long int i; unsigned char c=0; for (i=0; ic_node_block_count; i++) diff -ur ddumbfs-1.1.orig/src/ddumbfs.c ddumbfs-1.1/src/ddumbfs.c --- ddumbfs-1.1.orig/src/ddumbfs.c 2013-01-12 07:13:30.000000000 +0800 +++ ddumbfs-1.1/src/ddumbfs.c 2014-12-16 13:01:43.530299723 +0800 @@ -354,8 +352,8 @@ void preload_node(long long int node_idx) { // make a read in nodes to load the page, usually just before to lock the mutex - char ch=*(ddfs->nodes+(node_idx*ddfs->c_node_size)); + volatile char ch=*(ddfs->nodes+(node_idx*ddfs->c_node_size)); (void)ch; } #define ddumb_get_fh(fi) ((struct ddumb_fh *)(uintptr_t)(fi)->fh) @@ -1479,8 +1480,8 @@ // update statistic ddumb_statistic.block_write_try_next_node+=res-1; // should use the number of try in ddfs_locate_hash - // save the used block list at regular interval - ddumbfs_save_usedblocks(16000); + // save the used block list at regular interval (approx 2GB) + ddumbfs_save_usedblocks(16000 * (131072 / ddfs->c_block_size)); // the hash is not found, search a free block in the BlockFile long long int baddr=ddfs_alloc_block(); @@ -1811,7 +1822,7 @@ if (res<0) return res; } - DDFS_LOG(LOG_NOTICE, "[%lu]++ ddumb_getattr %s size=%lld\n", thread_id(), path, (long long int)stbuf->st_size); + //DDFS_LOG(LOG_NOTICE, "[%lu]++ ddumb_getattr %s size=%lld\n", thread_id(), path, (long long int)stbuf->st_size); return 0; } @@ -2773,7 +2784,7 @@ // save_usedblocks ? pthread_mutex_lock_d(&ifile_mutex); - if (res==ETIMEDOUT) ddumbfs_save_usedblocks(1000); + if (res==ETIMEDOUT) ddumbfs_save_usedblocks(1000 * (131072 / ddfs->c_block_size)); else ddumbfs_save_usedblocks(0); pthread_mutex_unlock_d(&ifile_mutex);