diff options
author | Stephan von Krawczynski <skraw@ithnet.com> | 2009-09-14 05:59:55 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-09-15 05:36:12 -0700 |
commit | 8719f88fc85051b706c0fbf2904ace04435b2b05 (patch) | |
tree | 3bca2851b6c5aec18a80e38da88069f49cf362dd /xlators | |
parent | ece4e80b2d2326aa5fadc46c866947c9644622a7 (diff) |
2.0.6 patch for io-cache pattern-matched non-caching
Hello all,
here is a small feature patch. Its intention is to give the user more control
over the files performance/io-cache really caches. If the user knows exactly
which files should be cached and which shouldn't there is currently no way to
tell glusterfs _not_ to cache certain pattern. This patch allows you to
disable caching by setting the priority of a pattern to "0". If you do not
give any priority option it works just like before and caches everything.
Honestly I am not totally sure that disabling caching works the way we did it,
please comment.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 261 (support for disabling caching of certain files)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=261
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/performance/io-cache/src/io-cache.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index 99be457a54c..f73cdb1117d 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -643,9 +643,14 @@ ioc_get_priority (ioc_table_t *table, const char *path) uint32_t priority = 0; struct ioc_priority *curr = NULL; - list_for_each_entry (curr, &table->priority_list, list) { - if (is_match (path, curr->pattern)) - priority = curr->priority; + if (list_empty(&table->priority_list)) { + priority = 1; + } + else { + list_for_each_entry (curr, &table->priority_list, list) { + if (is_match (path, curr->pattern)) + priority = curr->priority; + } } return priority; @@ -671,7 +676,7 @@ ioc_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, ioc_table_t *table = NULL; ioc_inode_t *ioc_inode = NULL; inode_t *inode = NULL; - uint32_t weight = 0; + uint32_t weight = 0xffffffff; const char *path = NULL; local = frame->local; @@ -723,6 +728,13 @@ ioc_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, */ fd_ctx_set (fd, this, 1); } + + /* weight = 0, we disable caching on it */ + if (weight == 0) { + /* we allow a pattern-matched cache disable this way + */ + fd_ctx_set (fd, this, 1); + } } FREE (local); @@ -754,7 +766,7 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, ioc_local_t *local = NULL; ioc_table_t *table = NULL; ioc_inode_t *ioc_inode = NULL; - uint32_t weight = 0; + uint32_t weight = 0xffffffff; const char *path = NULL; local = frame->local; @@ -789,6 +801,12 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, fd_ctx_set (fd, this, 1); } + /* weight = 0, we disable caching on it */ + if (weight == 0) { + /* we allow a pattern-matched cache disable this way + */ + fd_ctx_set (fd, this, 1); + } } frame->local = NULL; |