From 106f0e848a6ae3a04ee9d1c1752badf60767d039 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 10 Jul 2009 13:39:10 +0000 Subject: cleanup 'ctx' from inode and fd Removing unused 'dict_t *ctx' from both inode and fd structures. Signed-off-by: Anand V. Avati BUG: 128 (cleanup unwanted ctx dictionary in 'inode' and 'fd' structures.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=128 --- libglusterfs/src/fd.c | 42 ------------------------------------------ libglusterfs/src/fd.h | 1 - libglusterfs/src/inode.c | 26 -------------------------- libglusterfs/src/inode.h | 1 - 4 files changed, 70 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index a5a63ebaadd..8f7616929c2 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -382,7 +382,6 @@ _fd_unref (fd_t *fd) static void fd_destroy (fd_t *fd) { - data_pair_t *pair = NULL; xlator_t *xl = NULL; int i = 0; @@ -399,26 +398,6 @@ fd_destroy (fd_t *fd) goto out; if (S_ISDIR (fd->inode->st_mode)) { - for (pair = fd->ctx->members_list; pair; pair = pair->next) { - /* notify all xlators which have a context */ - xl = xlator_search_by_name (fd->inode->table->xl, - pair->key); - - if (!xl) { - gf_log ("fd", GF_LOG_CRITICAL, - "fd(%p)->ctx has invalid key(%s)", - fd, pair->key); - continue; - } - if (xl->cbks->releasedir) { - xl->cbks->releasedir (xl, fd); - } else { - gf_log ("fd", GF_LOG_CRITICAL, - "xlator(%s) in fd(%p) no RELEASE cbk", - xl->name, fd); - } - - } for (i = 0; i < fd->inode->table->xl->ctx->xl_count; i++) { if (fd->_ctx[i].key) { xl = (xlator_t *)(long)fd->_ctx[i].key; @@ -427,25 +406,6 @@ fd_destroy (fd_t *fd) } } } else { - for (pair = fd->ctx->members_list; pair; pair = pair->next) { - /* notify all xlators which have a context */ - xl = xlator_search_by_name (fd->inode->table->xl, - pair->key); - - if (!xl) { - gf_log ("fd", GF_LOG_CRITICAL, - "fd(%p)->ctx has invalid key(%s)", - fd, pair->key); - continue; - } - if (xl->cbks->release) { - xl->cbks->release (xl, fd); - } else { - gf_log ("fd", GF_LOG_CRITICAL, - "xlator(%s) in fd(%p) no RELEASE cbk", - xl->name, fd); - } - } for (i = 0; i < fd->inode->table->xl->ctx->xl_count; i++) { if (fd->_ctx[i].key) { xl = (xlator_t *)(long)fd->_ctx[i].key; @@ -460,7 +420,6 @@ fd_destroy (fd_t *fd) FREE (fd->_ctx); inode_unref (fd->inode); fd->inode = (inode_t *)0xaaaaaaaa; - dict_destroy (fd->ctx); FREE (fd); out: @@ -525,7 +484,6 @@ fd_create (inode_t *inode, pid_t pid) fd->_ctx = CALLOC (1, (sizeof (struct _fd_ctx) * inode->table->xl->ctx->xl_count)); - fd->ctx = get_new_dict (); fd->inode = inode_ref (inode); fd->pid = pid; INIT_LIST_HEAD (&fd->inode_list); diff --git a/libglusterfs/src/fd.h b/libglusterfs/src/fd.h index 298b1b34765..1770658e820 100644 --- a/libglusterfs/src/fd.h +++ b/libglusterfs/src/fd.h @@ -48,7 +48,6 @@ struct _fd { int32_t refcount; struct list_head inode_list; struct _inode *inode; - struct _dict *ctx; gf_lock_t lock; /* used ONLY for manipulating 'struct _fd_ctx' array (_ctx).*/ struct _fd_ctx *_ctx; diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index b0c9abd980c..5b41cd7b5d3 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -235,32 +235,8 @@ static void __inode_destroy (inode_t *inode) { int index = 0; - data_pair_t *pair = NULL; xlator_t *xl = NULL; - if (!inode->ctx) { - goto noctx; - } - for (pair = inode->ctx->members_list; pair; pair = pair->next) { - /* notify all xlators which have a context */ - xl = xlator_search_by_name (inode->table->xl, pair->key); - - if (!xl) { - gf_log (inode->table->name, GF_LOG_DEBUG, - "inode(%"PRId64")->ctx has invalid key(%s)", - inode->ino, pair->key); - continue; - } - - if (xl->cbks->forget) - xl->cbks->forget (xl, inode); - else - gf_log (inode->table->name, GF_LOG_DEBUG, - "xlator(%s) in inode(%"PRId64") no FORGET fop", - xl->name, inode->ino); - } - dict_destroy (inode->ctx); - if (!inode->_ctx) goto noctx; @@ -450,8 +426,6 @@ __inode_create (inode_table_t *table) newi->_ctx = CALLOC (1, (sizeof (struct _inode_ctx) * table->xl->ctx->xl_count)); - newi->ctx = get_new_dict (); - return newi; } diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h index 8800b9767b5..e71c6d899f5 100644 --- a/libglusterfs/src/inode.h +++ b/libglusterfs/src/inode.h @@ -83,7 +83,6 @@ struct _inode { uint64_t generation; uint32_t ref; /* reference count on this inode */ ino_t ino; /* inode number in the storage (persistent) */ - dict_t *ctx; /* per xlator private */ mode_t st_mode; /* what kind of file */ struct list_head fd_list; /* list of open files on this inode */ struct list_head dentry_list; /* list of directory entries for this inode */ -- cgit