diff options
Diffstat (limited to 'xlators/performance/io-cache')
-rw-r--r-- | xlators/performance/io-cache/src/io-cache.c | 16 | ||||
-rw-r--r-- | xlators/performance/io-cache/src/ioc-inode.c | 12 |
2 files changed, 16 insertions, 12 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index 5c1f74db1..da3f4f15d 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -30,6 +30,8 @@ #include <assert.h> #include <sys/time.h> +extern int ioc_log2_page_size; + uint32_t ioc_get_priority (ioc_table_t *table, const char *path); @@ -1234,11 +1236,12 @@ out: int32_t init (xlator_t *this) { - ioc_table_t *table = NULL; - dict_t *options = this->options; - uint32_t index = 0; - char *cache_size_string = NULL; - int32_t ret = -1; + ioc_table_t *table = NULL; + dict_t *options = this->options; + uint32_t index = 0; + char *cache_size_string = NULL; + int32_t ret = -1; + glusterfs_ctx_t *ctx = NULL; if (!this->children || this->children->next) { gf_log (this->name, GF_LOG_ERROR, @@ -1320,6 +1323,9 @@ init (xlator_t *this) this->private = table; ret = 0; + ctx = this->ctx; + ioc_log2_page_size = gf_log2 (ctx->page_size); + out: if (ret == -1) { if (table != NULL) { diff --git a/xlators/performance/io-cache/src/ioc-inode.c b/xlators/performance/io-cache/src/ioc-inode.c index e647b3183..11da86312 100644 --- a/xlators/performance/io-cache/src/ioc-inode.c +++ b/xlators/performance/io-cache/src/ioc-inode.c @@ -24,18 +24,16 @@ #include "io-cache.h" +int ioc_log2_page_size; inline uint32_t ioc_hashfn (void *data, int len) { - uint32_t hash = 0; - while (len > 0) { - hash ^= *(uint32_t *)data; - data += sizeof (uint32_t); - len -= sizeof (uint32_t); - } + off_t offset; + + offset = *(off_t *) data; - return hash; + return (offset >> ioc_log2_page_size); } /* |