summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-10-15 01:57:58 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-15 09:26:37 -0700
commita159ebc5c0277797db7937c8489b26e1975dd265 (patch)
treecfda417190b3a3f82ee3d69061e45547d088e439 /xlators
parentd9d268b7983d06cfb6d2b6bea5aca0f4bd60dee7 (diff)
performance/io-cache: remove caching in lookup.
- caching file contents in io-cache during lookup is obsolete since quick-read does the same work. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 314 (Hang in quick-read) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=314
Diffstat (limited to 'xlators')
-rw-r--r--xlators/performance/io-cache/src/io-cache.c155
1 files changed, 0 insertions, 155 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index bc7451c2654..fc38ac81af9 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -182,20 +182,9 @@ ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct stat *stbuf, dict_t *dict)
{
ioc_inode_t *ioc_inode = NULL;
- ioc_local_t *local = frame->local;
ioc_table_t *table = this->private;
- ioc_page_t *page = NULL;
- data_t *content_data = NULL;
- char *src = NULL;
- char need_unref = 0;
uint8_t cache_still_valid = 0;
- uint32_t weight = 0;
uint64_t tmp_ioc_inode = 0;
- char *buf = NULL;
- char *tmp = NULL;
- int i;
- struct iobref *iobref = NULL;
- struct iobuf *iobuf = NULL;
if (op_ret != 0)
goto out;
@@ -223,123 +212,9 @@ ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
ioc_table_unlock (ioc_inode->table);
}
-
- if (local && stbuf->st_size &&
- local->need_xattr >= stbuf->st_size) {
- if (!ioc_inode) {
- weight = ioc_get_priority (table,
- local->file_loc.path);
- ioc_inode = ioc_inode_update (table,
- inode, weight);
- inode_ctx_put (inode, this,
- (uint64_t)(long)ioc_inode);
- }
-
- ioc_inode_lock (ioc_inode);
- {
- content_data = dict_get (dict, "glusterfs.content");
- page = ioc_page_get (ioc_inode, 0);
-
- if (content_data) {
- if (page) {
- iobref_unref (page->iobref);
- free (page->vector);
- page->vector = NULL;
-
- ioc_table_lock (table);
- {
- table->cache_used -=
- iobref_size (page->iobref);
- }
- ioc_table_unlock (table);
- } else {
- page = ioc_page_create (ioc_inode, 0);
- }
-
- src = data_to_ptr (content_data);
-
- iobuf = iobuf_get (this->ctx->iobuf_pool);
- page->iobref = iobref_new ();
- iobref_add (page->iobref, iobuf);
-
- memcpy (iobuf->ptr, src, stbuf->st_size);
-
- page->vector = CALLOC (1,
- sizeof (*page->vector));
- page->vector->iov_base = iobuf->ptr;
- page->vector->iov_len = stbuf->st_size;
- page->count = 1;
-
- page->waitq = NULL;
- page->size = stbuf->st_size;
- page->ready = 1;
-
- ioc_table_lock (table);
- {
- table->cache_used +=
- iobref_size (page->iobref);
- }
- ioc_table_unlock (table);
-
- } else {
- if (!(page && page->ready)) {
- gf_log (this->name, GF_LOG_DEBUG,
- "page not present");
-
- ioc_inode_unlock (ioc_inode);
- STACK_WIND (frame, ioc_lookup_cbk,
- FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->lookup,
- &local->file_loc,
- local->xattr_req);
- return 0;
- }
- buf = CALLOC (1, stbuf->st_size);
- tmp = buf;
-
- for (i = 0; i < page->count; i++) {
- memcpy (tmp, page->vector[i].iov_base,
- page->vector[i].iov_len);
- tmp += page->vector[i].iov_len;
- }
-
- gf_log (this->name, GF_LOG_TRACE,
- "serving file %s from cache",
- local->file_loc.path);
-
- if (!dict) {
- need_unref = 1;
- dict = dict_ref (
- get_new_dict ());
- }
- dict_set (dict, "glusterfs.content",
- data_from_dynptr (buf,
- stbuf->st_size));
- }
-
- ioc_inode->mtime = stbuf->st_mtime;
- gettimeofday (&ioc_inode->tv, NULL);
- }
- ioc_inode_unlock (ioc_inode);
-
- if (content_data &&
- ioc_need_prune (ioc_inode->table)) {
- ioc_prune (ioc_inode->table);
- }
- }
out:
STACK_UNWIND (frame, op_ret, op_errno, inode, stbuf, dict);
-
- if (need_unref) {
- dict_unref (dict);
- }
-
- if (iobref)
- iobref_unref (iobref);
- if (iobuf)
- iobuf_unref (iobuf);
-
return 0;
}
@@ -347,36 +222,6 @@ int32_t
ioc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
dict_t *xattr_req)
{
- uint64_t content_limit = 0;
- uint64_t tmp_ioc_inode = 0;
- ioc_inode_t *ioc_inode = NULL;
- ioc_page_t *page = NULL;
- ioc_local_t *local = NULL;
-
- if (GF_FILE_CONTENT_REQUESTED(xattr_req, &content_limit)) {
- local = CALLOC (1, sizeof (*local));
- local->need_xattr = content_limit;
- local->file_loc.path = loc->path;
- local->file_loc.inode = loc->inode;
- frame->local = local;
-
- inode_ctx_get (loc->inode, this, &tmp_ioc_inode);
- ioc_inode = (ioc_inode_t *)(long)tmp_ioc_inode;
-
- if (ioc_inode) {
- ioc_inode_lock (ioc_inode);
- {
- page = ioc_page_get (ioc_inode, 0);
- if ((content_limit <=
- ioc_inode->table->page_size) &&
- page && page->ready) {
- local->need_xattr = -1;
- }
- }
- ioc_inode_unlock (ioc_inode);
- }
- }
-
STACK_WIND (frame, ioc_lookup_cbk, FIRST_CHILD (this),
FIRST_CHILD (this)->fops->lookup, loc, xattr_req);