From 31e69430140538f5fee3e8dc89bd2971917820d1 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Sun, 28 Mar 2010 23:53:17 +0000 Subject: fop namespace cleanup. removed 'lock_notify', 'lock_fnotify', 'setdents', 'getdents' from 'fop' list, and removed 'stats' from mop list, as they are no more used in the codebase, and had made code bulky/buggy. Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 734 (keep only the working/usable code in build tree to focus more on development) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=734 --- xlators/cluster/afr/src/afr-dir-read.c | 100 ---------------------- xlators/cluster/afr/src/afr-dir-write.c | 141 -------------------------------- xlators/cluster/afr/src/afr.c | 2 - xlators/cluster/map/src/map.c | 17 ---- xlators/cluster/stripe/src/stripe.c | 131 ----------------------------- xlators/cluster/stripe/src/stripe.h | 1 - 6 files changed, 392 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c index 91b9850b39b..384e9c98d0c 100644 --- a/xlators/cluster/afr/src/afr-dir-read.c +++ b/xlators/cluster/afr/src/afr-dir-read.c @@ -719,50 +719,6 @@ afr_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, return 0; } -int32_t -afr_getdents_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int32_t op_ret, int32_t op_errno, - dir_entry_t *entry, int32_t count) -{ - afr_private_t * priv = NULL; - afr_local_t * local = NULL; - xlator_t ** children = NULL; - - int unwind = 1; - int last_tried = -1; - int this_try = -1; - - priv = this->private; - children = priv->children; - - local = frame->local; - - if (op_ret == -1) { - last_tried = local->cont.getdents.last_tried; - - if (all_tried (last_tried, priv->child_count)) { - goto out; - } - - this_try = ++local->cont.getdents.last_tried; - unwind = 0; - - STACK_WIND (frame, afr_getdents_cbk, - children[this_try], - children[this_try]->fops->getdents, - local->fd, local->cont.getdents.size, - local->cont.getdents.offset, local->cont.getdents.flag); - } - -out: - if (unwind) { - AFR_STACK_UNWIND (getdents, frame, op_ret, op_errno, - entry, count); - } - - return 0; -} - int32_t afr_releasedir (xlator_t *this, fd_t *fd) @@ -771,59 +727,3 @@ afr_releasedir (xlator_t *this, fd_t *fd) return 0; } - - -int32_t -afr_getdents (call_frame_t *frame, xlator_t *this, - fd_t *fd, size_t size, off_t offset, int32_t flag) -{ - afr_private_t * priv = NULL; - xlator_t ** children = NULL; - int call_child = 0; - afr_local_t *local = NULL; - - int32_t op_ret = -1; - int32_t op_errno = 0; - - VALIDATE_OR_GOTO (frame, out); - VALIDATE_OR_GOTO (this, out); - VALIDATE_OR_GOTO (this->private, out); - - priv = this->private; - children = priv->children; - - ALLOC_OR_GOTO (local, afr_local_t, out); - - call_child = afr_first_up_child (priv); - if (call_child == -1) { - op_errno = ENOTCONN; - gf_log (this->name, GF_LOG_DEBUG, - "no child is up."); - goto out; - } - - local->cont.getdents.last_tried = call_child; - - local->fd = fd_ref (fd); - - local->cont.getdents.size = size; - local->cont.getdents.offset = offset; - local->cont.getdents.flag = flag; - - frame->local = local; - - STACK_WIND (frame, afr_getdents_cbk, - children[call_child], children[call_child]->fops->getdents, - fd, size, offset, flag); - - op_ret = 0; -out: - if (op_ret == -1) { - AFR_STACK_UNWIND (getdents, frame, op_ret, op_errno, - NULL, 0); - } - - return 0; -} - - diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 14d3e28c451..9d7e74e7871 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -2007,144 +2007,3 @@ out: /* }}} */ -/* {{{ setdents */ - -int32_t -afr_setdents_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - afr_local_t * local = NULL; - afr_private_t * priv = NULL; - - int call_count = -1; - int child_index = (long) cookie; - - local = frame->local; - priv = this->private; - - LOCK (&frame->lock); - { - if (afr_fop_failed (op_ret, op_errno)) - afr_transaction_fop_failed (frame, this, child_index); - - if ((op_ret != -1) && (local->success_count == 0)) { - local->op_ret = op_ret; - local->success_count++; - } - - local->op_errno = op_errno; - } - UNLOCK (&frame->lock); - - call_count = afr_frame_return (frame); - - if (call_count == 0) { - local->transaction.resume (frame, this); - } - - return 0; -} - - -int32_t -afr_setdents_wind (call_frame_t *frame, xlator_t *this) -{ - afr_local_t *local = NULL; - afr_private_t *priv = NULL; - - int call_count = -1; - int i = 0; - - local = frame->local; - priv = this->private; - - call_count = afr_up_children_count (priv->child_count, local->child_up); - - if (call_count == 0) { - local->transaction.resume (frame, this); - return 0; - } - - local->call_count = call_count; - - for (i = 0; i < priv->child_count; i++) { - if (local->child_up[i]) { - STACK_WIND_COOKIE (frame, afr_setdents_wind_cbk, - (void *) (long) i, - priv->children[i], - priv->children[i]->fops->setdents, - local->fd, local->cont.setdents.flags, - local->cont.setdents.entries, - local->cont.setdents.count); - - if (!--call_count) - break; - } - } - - return 0; -} - - -int32_t -afr_setdents_done (call_frame_t *frame, xlator_t *this) -{ - afr_local_t * local = frame->local; - - AFR_STACK_UNWIND (setdents, frame, local->op_ret, local->op_errno); - - return 0; -} - - -int32_t -afr_setdents (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t flags, dir_entry_t *entries, int32_t count) -{ - afr_private_t * priv = NULL; - afr_local_t * local = NULL; - - int ret = -1; - - int op_ret = -1; - int op_errno = 0; - - VALIDATE_OR_GOTO (frame, out); - VALIDATE_OR_GOTO (this, out); - VALIDATE_OR_GOTO (this->private, out); - - priv = this->private; - - ALLOC_OR_GOTO (local, afr_local_t, out); - - ret = AFR_LOCAL_INIT (local, priv); - if (ret < 0) { - op_errno = -ret; - goto out; - } - - frame->local = local; - - local->fd = fd_ref (fd); - - local->cont.setdents.flags = flags; - local->cont.setdents.entries = entries; - local->cont.setdents.count = count; - - local->transaction.fop = afr_setdents_wind; - local->transaction.done = afr_setdents_done; - - local->transaction.basename = NULL; - - afr_transaction (frame, this, AFR_ENTRY_TRANSACTION); - - op_ret = 0; -out: - if (op_ret == -1) { - AFR_STACK_UNWIND (setdents, frame, op_ret, op_errno); - } - - return 0; -} - -/* }}} */ diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index b7fbbd09c50..18cff07663c 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -3033,7 +3033,6 @@ struct xlator_fops fops = { .opendir = afr_opendir, .readdir = afr_readdir, .readdirp = afr_readdirp, - .getdents = afr_getdents, /* dir write */ .create = afr_create, @@ -3044,7 +3043,6 @@ struct xlator_fops fops = { .link = afr_link, .symlink = afr_symlink, .rename = afr_rename, - .setdents = afr_setdents, }; diff --git a/xlators/cluster/map/src/map.c b/xlators/cluster/map/src/map.c index 17de0c0954f..09d22b5d690 100644 --- a/xlators/cluster/map/src/map.c +++ b/xlators/cluster/map/src/map.c @@ -905,23 +905,6 @@ map_checksum_cbk (call_frame_t *frame, } -int32_t -map_lock_notify_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - STACK_UNWIND (frame, op_ret, op_errno); - return 0; -} - - -int32_t -map_lock_fnotify_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - STACK_UNWIND (frame, op_ret, op_errno); - return 0; -} - /* Fops starts here */ int32_t diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index a7fad23da81..eb5a154d5ee 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -2558,50 +2558,6 @@ stripe_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, return 0; } -/** - * stripe_writedir - - */ -int32_t -stripe_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t flags, dir_entry_t *entries, int32_t count) -{ - stripe_local_t *local = NULL; - stripe_private_t *priv = NULL; - xlator_list_t *trav = NULL; - int32_t op_errno = 1; - - VALIDATE_OR_GOTO (frame, err); - VALIDATE_OR_GOTO (this, err); - VALIDATE_OR_GOTO (fd, err); - VALIDATE_OR_GOTO (fd->inode, err); - - priv = this->private; - trav = this->children; - - /* Initialization */ - local = CALLOC (1, sizeof (stripe_local_t)); - if (!local) { - op_errno = ENOMEM; - goto err; - } - local->op_ret = -1; - frame->local = local; - local->call_count = priv->child_count; - - while (trav) { - STACK_WIND (frame, stripe_common_cbk, trav->xlator, - trav->xlator->fops->setdents, fd, flags, entries, - count); - trav = trav->next; - } - - return 0; - err: - STACK_UNWIND (frame, -1, op_errno); - return 0; -} - - /** * stripe_flush - */ @@ -3273,91 +3229,6 @@ stripe_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, /* Management operations */ -/** - * stripe_stats_cbk - Add all the fields received from different clients. - * Once all the clients return, send stats to above layer. - * - */ -int32_t -stripe_stats_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct xlator_stats *stats) -{ - int32_t callcnt = 0; - stripe_local_t *local = NULL; - call_frame_t *prev = NULL; - - prev = cookie; - local = frame->local; - - LOCK(&frame->lock); - { - callcnt = --local->call_count; - - if (op_ret == -1) { - gf_log (this->name, GF_LOG_DEBUG, - "%s returned error %s", - prev->this->name, strerror (op_errno)); - local->op_ret = -1; - local->op_errno = op_errno; - } - if (op_ret == 0) { - if (local->op_ret == -2) { - /* This is to make sure this is the - first time */ - local->stats = *stats; - local->op_ret = 0; - } else { - local->stats.nr_files += stats->nr_files; - local->stats.free_disk += stats->free_disk; - local->stats.disk_usage += stats->disk_usage; - local->stats.nr_clients += stats->nr_clients; - } - } - } - UNLOCK (&frame->lock); - - if (!callcnt) { - STACK_UNWIND (frame, local->op_ret, local->op_errno, - &local->stats); - } - - return 0; -} - -/** - * stripe_stats - - */ -int32_t -stripe_stats (call_frame_t *frame, xlator_t *this, int32_t flags) -{ - stripe_local_t *local = NULL; - xlator_list_t *trav = NULL; - stripe_private_t *priv = NULL; - int32_t op_errno = 1; - - priv = this->private; - trav = this->children; - - local = CALLOC (1, sizeof (stripe_local_t)); - if (!local) { - op_errno = ENOMEM; - goto err; - } - frame->local = local; - local->op_ret = -2; /* to be used as a flag in _cbk */ - local->call_count = priv->child_count; - - while (trav) { - STACK_WIND (frame, stripe_stats_cbk, trav->xlator, - trav->xlator->mops->stats, flags); - trav = trav->next; - } - return 0; - err: - STACK_UNWIND (frame, -1, op_errno, NULL); - return 0; -} - int32_t stripe_release (xlator_t *this, fd_t *fd) { @@ -3674,12 +3545,10 @@ struct xlator_fops fops = { .setattr = stripe_setattr, .fsetattr = stripe_fsetattr, .lookup = stripe_lookup, - .setdents = stripe_setdents, .mknod = stripe_mknod, }; struct xlator_mops mops = { - .stats = stripe_stats, }; struct xlator_cbks cbks = { diff --git a/xlators/cluster/stripe/src/stripe.h b/xlators/cluster/stripe/src/stripe.h index 738727e9586..23ee4546d60 100644 --- a/xlators/cluster/stripe/src/stripe.h +++ b/xlators/cluster/stripe/src/stripe.h @@ -114,7 +114,6 @@ struct stripe_local { struct readv_replies *replies; struct statvfs statvfs_buf; dir_entry_t *entry; - struct xlator_stats stats; int8_t revalidate; int8_t failed; -- cgit