summaryrefslogtreecommitdiffstats
path: root/xlators/performance/io-cache/src/io-cache.h
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-10-26 03:01:33 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-28 01:46:27 -0700
commit3809bb1bbd617dbde1d943dbcf6b0346329187b6 (patch)
treec326390674d9120a731d01345d842e0e803e739a /xlators/performance/io-cache/src/io-cache.h
parent78d281d6026ad1ebe8cc65c4396055902369ea89 (diff)
performance/io-cache: change data structure used to store page-cache.
- io-cache uses rbtree based hash tables to store page-cache instead of lists. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 335 (Io-cache optimization) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=335
Diffstat (limited to 'xlators/performance/io-cache/src/io-cache.h')
-rw-r--r--xlators/performance/io-cache/src/io-cache.h50
1 files changed, 28 insertions, 22 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.h b/xlators/performance/io-cache/src/io-cache.h
index 74a707147..49d3d000b 100644
--- a/xlators/performance/io-cache/src/io-cache.h
+++ b/xlators/performance/io-cache/src/io-cache.h
@@ -34,11 +34,14 @@
#include "xlator.h"
#include "common-utils.h"
#include "call-stub.h"
+#include "rbthash.h"
+#include "hashfn.h"
#include <sys/time.h>
#include <fnmatch.h>
#define IOC_PAGE_SIZE (1024 * 128) /* 128KB */
#define IOC_CACHE_SIZE (32 * 1024 * 1024)
+#define IOC_PAGE_TABLE_BUCKET_COUNT 4096
struct ioc_table;
struct ioc_local;
@@ -110,7 +113,6 @@ struct ioc_local {
*
*/
struct ioc_page {
- struct list_head pages;
struct list_head page_lru;
struct ioc_inode *inode; /* inode this page belongs to */
struct ioc_priority *priority;
@@ -125,28 +127,32 @@ struct ioc_page {
pthread_mutex_t page_lock;
};
+struct ioc_cache {
+ rbthash_table_t *page_table;
+ struct list_head page_lru;
+ time_t mtime; /*
+ * mtime of the server file when last
+ * cached
+ */
+ struct timeval tv; /*
+ * time-stamp at last re-validate
+ */
+};
+
struct ioc_inode {
- struct ioc_table *table;
- struct list_head pages; /* list of pages of this inode */
- struct list_head inode_list; /*
- * list of inodes, maintained by io-cache
- * translator
- */
- struct list_head inode_lru;
- struct list_head page_lru;
- struct ioc_waitq *waitq;
- pthread_mutex_t inode_lock;
- uint32_t weight; /*
- * weight of the inode, increases on each
- * read
- */
- time_t mtime; /*
- * mtime of the server file when last
- * cached
- */
- struct timeval tv; /*
- * time-stamp at last re-validate
- */
+ struct ioc_table *table;
+ struct ioc_cache cache;
+ struct list_head inode_list; /*
+ * list of inodes, maintained by
+ * io-cache translator
+ */
+ struct list_head inode_lru;
+ struct ioc_waitq *waitq;
+ pthread_mutex_t inode_lock;
+ uint32_t weight; /*
+ * weight of the inode, increases
+ * on each read
+ */
};
struct ioc_table {