diff options
author | Poornima G <pgurusid@redhat.com> | 2016-12-06 14:43:10 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2017-01-09 10:37:02 -0800 |
commit | a988741713752c2ec04a0680224d8fa4d42dc203 (patch) | |
tree | b0cfd626c7cf8b5475e7cc533333dd17a47dc988 | |
parent | cc55be619830bc64544a1044f05367b8be9421bc (diff) |
dht: At places needed use STACK_WIND_COOKIE
Issue:
frame has a void * cookie pointer.
In case of STACK_WIND_COOKIE frame->cookie is assigned
to what is sent by the caller.
In case of STACK_WIND frame->cookie is assigned to point
point to the frame itself.
For ease of coding, at many places, the cookie in the cbk
is used to get the pointer to the next xl. This is
inconsistent when STACK_WIND_TAIL comes into picture.
Eg: dht_setxattr () {
for (i = 0 ; i < conf->subvolume_cnt ; i++) {
STACK_WIND (..dht_checking_pathinfo_cbk,
conf->subvolumes[i] ..);
}
dht_checking_pathinfo_cbk (...void *cookie...) {
prev = cookie;
...
for (i = 0; i < conf->subvolume_cnt; i++) {
if (conf->subvolumes[i] == prev->this) {
...
}
}
}
Consider the below graph:
dht (parent)
readdir-ahead => Doesn't define setxattr and uses STACK_WIND_TAIL
protocol-client
With this graph, when dht_checking_pathinfo_cbk is called,
cookie will have frame pointing to protocol-client.
i.e. prev->this will be protocol-client. But dht was expecting
it to be readdir-ahead as it has stored in conf->subvolumes[i]
Solution:
Hence, as a thumb rule, if cbk is using cookie, then we explicitly
call STACK_WIND_COOKIE.
Change-Id: I83aea1e24c809c5a91a0db7283e908e125471bd4
BUG: 1401812
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/16039
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r-- | libglusterfs/src/stack.h | 2 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 560 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-diskusage.c | 26 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-inode-read.c | 83 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-inode-write.c | 152 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-linkfile.c | 31 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-rename.c | 174 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-selfheal.c | 51 | ||||
-rw-r--r-- | xlators/cluster/dht/src/nufa.c | 57 | ||||
-rw-r--r-- | xlators/cluster/dht/src/switch.c | 73 | ||||
-rw-r--r-- | xlators/cluster/dht/src/tier-common.c | 111 |
11 files changed, 665 insertions, 655 deletions
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h index 8a7a42a171d..b74989697da 100644 --- a/libglusterfs/src/stack.h +++ b/libglusterfs/src/stack.h @@ -332,7 +332,7 @@ STACK_RESET (call_stack_t *stack) "winding from %s to %s", \ frame->root, old_THIS->name, \ THIS->name); \ - if (obj->ctx->measure_latency) \ + if (obj->ctx->measure_latency) \ gf_latency_begin (_new, fn); \ fn (_new, obj, params); \ THIS = old_THIS; \ diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index af3b7a24838..a56f095c672 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -588,7 +588,7 @@ dht_discover_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; dht_layout_t *layout = NULL; int ret = -1; int is_dir = 0; @@ -621,7 +621,7 @@ dht_discover_cbk (call_frame_t *frame, void *cookie, xlator_t *this, DHT_MSG_GFID_MISMATCH, "%s: gfid different on %s, gfid local = %s" "gfid other = %s", - local->loc.path, prev->this->name, + local->loc.path, prev->name, gfid_local, gfid_node); } @@ -633,19 +633,19 @@ dht_discover_cbk (call_frame_t *frame, void *cookie, xlator_t *this, else mkdir/chmod/chown and fix */ - ret = dht_layout_merge (this, layout, prev->this, + ret = dht_layout_merge (this, layout, prev, op_ret, op_errno, xattr); if (ret) gf_msg (this->name, GF_LOG_WARNING, 0, DHT_MSG_LAYOUT_MERGE_FAILED, "%s: failed to merge layouts for subvol %s", - local->loc.path, prev->this->name); + local->loc.path, prev->name); if (op_ret == -1) { local->op_errno = op_errno; gf_msg_debug (this->name, op_errno, "lookup of %s on %s returned error", - local->loc.path, prev->this->name); + local->loc.path, prev->name); goto unlock; } @@ -661,7 +661,7 @@ dht_discover_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!is_linkfile) { /* real file */ - local->cached_subvol = prev->this; + local->cached_subvol = prev; attempt_unwind = 1; } else { goto unlock; @@ -679,9 +679,9 @@ dht_discover_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->inode == NULL) local->inode = inode_ref (inode); - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev); dht_iatt_merge (this, &local->postparent, postparent, - prev->this); + prev); } unlock: UNLOCK (&frame->lock); @@ -765,10 +765,10 @@ dht_discover (call_frame_t *frame, xlator_t *this, loc_t *loc) local->main_frame = frame; for (i = 0; i < call_cnt; i++) { - STACK_WIND (discover_frame, dht_discover_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (discover_frame, dht_discover_cbk, + conf->subvolumes[i], conf->subvolumes[i], + conf->subvolumes[i]->fops->lookup, + &local->loc, local->xattr_req); } return 0; @@ -789,7 +789,7 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; dht_layout_t *layout = NULL; int ret = -1; int is_dir = 0; @@ -822,7 +822,7 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, DHT_MSG_GFID_MISMATCH, "%s: gfid different on %s." " gfid local = %s, gfid subvol = %s", - local->loc.path, prev->this->name, + local->loc.path, prev->name, gfid_local, gfid_node); } @@ -833,14 +833,14 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, else mkdir/chmod/chown and fix */ - ret = dht_layout_merge (this, layout, prev->this, - op_ret, op_errno, xattr); + ret = dht_layout_merge (this, layout, prev, op_ret, op_errno, + xattr); if (op_ret == -1) { local->op_errno = op_errno; gf_msg_debug (this->name, op_errno, "lookup of %s on %s returned error", - local->loc.path, prev->this->name); + local->loc.path, prev->name); goto unlock; } @@ -852,7 +852,7 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "lookup of %s on %s returned non" "dir 0%o" "calling lookup_everywhere", - local->loc.path, prev->this->name, + local->loc.path, prev->name, stbuf->ia_type); local->need_selfheal = 1; @@ -869,9 +869,8 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->inode == NULL) local->inode = inode_ref (inode); - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); - dht_iatt_merge (this, &local->postparent, postparent, - prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev); + dht_iatt_merge (this, &local->postparent, postparent, prev); } unlock: UNLOCK (&frame->lock); @@ -956,7 +955,7 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; dht_layout_t *layout = NULL; dht_conf_t *conf = NULL; int ret = -1; @@ -1008,7 +1007,7 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, DHT_MSG_REVALIDATE_CBK_INFO, "Revalidate: subvolume %s for %s " "(gfid = %s) returned -1", - prev->this->name, local->loc.path, + prev->name, local->loc.path, gfid); } if (op_errno == ESTALE) { @@ -1088,7 +1087,7 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } ret = dht_layout_dir_mismatch (this, layout, - prev->this, &local->loc, + prev, &local->loc, xattr); if (ret != 0) { gf_msg (this->name, GF_LOG_INFO, 0, @@ -1111,9 +1110,9 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dht_dir_has_layout (xattr, conf->xattr_name) >= 0) || conf->subvolume_cnt == 1) { - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev); dht_iatt_merge (this, &local->postparent, postparent, - prev->this); + prev); } else { /* copy the gfid anyway */ gf_uuid_copy (local->stbuf.ia_gfid, stbuf->ia_gfid); @@ -1139,9 +1138,9 @@ unlock: local->op_ret = -1; } else { - STACK_WIND (frame, dht_lookup_linkfile_cbk, - subvol, subvol->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_linkfile_cbk, + subvol, subvol, subvol->fops->lookup, + &local->loc, local->xattr_req); return 0; } } @@ -1836,7 +1835,7 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int is_linkfile = 0; int is_dir = 0; xlator_t *subvol = NULL; @@ -1859,7 +1858,7 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this, conf = this->private; prev = cookie; - subvol = prev->this; + subvol = prev; gf_msg_debug (this->name, 0, "returned with op_ret %d and op_errno %d (%s) " @@ -1884,7 +1883,7 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this, DHT_MSG_GFID_MISMATCH, "%s: gfid differs on subvolume %s," " gfid local = %s, gfid node = %s", - loc->path, prev->this->name, gfid, + loc->path, prev->name, gfid, uuid_utoa(buf->ia_gfid)); } @@ -2065,10 +2064,10 @@ dht_lookup_everywhere (call_frame_t *frame, xlator_t *this, loc_t *loc) "winding lookup call to %d subvols", call_cnt); for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_lookup_everywhere_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->lookup, - loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_everywhere_cbk, + conf->subvolumes[i], conf->subvolumes[i], + conf->subvolumes[i]->fops->lookup, + loc, local->xattr_req); } return 0; @@ -2085,7 +2084,7 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie, inode_t *inode, struct iatt *stbuf, dict_t *xattr, struct iatt *postparent) { - call_frame_t *prev = NULL; + xlator_t *prev = NULL; dht_local_t *local = NULL; xlator_t *subvol = NULL; loc_t *loc = NULL; @@ -2100,7 +2099,7 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie, GF_VALIDATE_OR_GOTO ("dht", cookie, unwind); prev = cookie; - subvol = prev->this; + subvol = prev; conf = this->private; local = frame->local; loc = &local->loc; @@ -2155,12 +2154,12 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie, stbuf->ia_prot.sticky = 1; } - ret = dht_layout_preset (this, prev->this, inode); + ret = dht_layout_preset (this, prev, inode); if (ret < 0) { gf_msg (this->name, GF_LOG_INFO, 0, DHT_MSG_LAYOUT_PRESET_FAILED, "Failed to set layout for subvolume %s," - "gfid = %s", prev->this->name, gfid); + "gfid = %s", prev->name, gfid); op_ret = -1; op_errno = EINVAL; } @@ -2227,10 +2226,10 @@ dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc) } for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_lookup_dir_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_dir_cbk, + conf->subvolumes[i], conf->subvolumes[i], + conf->subvolumes[i]->fops->lookup, + &local->loc, local->xattr_req); } return 0; unwind: @@ -2253,7 +2252,7 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dht_conf_t *conf = NULL; dht_local_t *local = NULL; loc_t *loc = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = 0; dht_layout_t *parent_layout = NULL; uint32_t vol_commit_hash = 0; @@ -2291,7 +2290,7 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (ENTRY_MISSING (op_ret, op_errno)) { gf_msg_debug (this->name, 0, "Entry %s missing on subvol %s", - loc->path, prev->this->name); + loc->path, prev->name); /* lookup-optimize supercedes lookup-unhashed settings, * - so if it is set, do not process search_unhashed @@ -2358,7 +2357,7 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg_debug (this->name, op_errno, "Lookup of %s for subvolume" " %s failed", loc->path, - prev->this->name); + prev->name); goto out; } @@ -2368,12 +2367,12 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!is_linkfile) { /* non-directory and not a linkfile */ - ret = dht_layout_preset (this, prev->this, inode); + ret = dht_layout_preset (this, prev, inode); if (ret < 0) { gf_msg (this->name, GF_LOG_INFO, 0, DHT_MSG_LAYOUT_PRESET_FAILED, "could not set pre-set layout for subvolume %s", - prev->this->name); + prev->name); op_ret = -1; op_errno = EINVAL; goto out; @@ -2399,9 +2398,9 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "Calling lookup on linkto target %s for path %s", subvol->name, loc->path); - STACK_WIND (frame, dht_lookup_linkfile_cbk, - subvol, subvol->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_linkfile_cbk, subvol, + subvol, subvol->fops->lookup, + &local->loc, local->xattr_req); return 0; @@ -2588,10 +2587,11 @@ dht_lookup (call_frame_t *frame, xlator_t *this, if (IA_ISDIR (local->inode->ia_type)) { local->call_cnt = call_cnt = conf->subvolume_cnt; for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_revalidate_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->lookup, - loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_revalidate_cbk, + conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->lookup, + loc, local->xattr_req); } return 0; } @@ -2619,9 +2619,9 @@ dht_lookup (call_frame_t *frame, xlator_t *this, "revalidate lookup for %s at %s", loc->path, subvol->name); - STACK_WIND (frame, dht_revalidate_cbk, - subvol, subvol->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_revalidate_cbk, subvol, + subvol, subvol->fops->lookup, + &local->loc, local->xattr_req); } } else { @@ -2682,10 +2682,11 @@ dht_lookup (call_frame_t *frame, xlator_t *this, " on all nodes."); for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_lookup_dir_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_dir_cbk, + conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->lookup, + &local->loc, local->xattr_req); } return 0; } @@ -2693,9 +2694,9 @@ dht_lookup (call_frame_t *frame, xlator_t *this, gf_msg_debug (this->name, 0, "Calling fresh lookup for %s on" " %s", loc->path, hashed_subvol->name); - STACK_WIND (frame, dht_lookup_cbk, - hashed_subvol, hashed_subvol->fops->lookup, - loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_cbk, hashed_subvol, + hashed_subvol, hashed_subvol->fops->lookup, + loc, local->xattr_req); } return 0; @@ -2713,7 +2714,7 @@ dht_unlink_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postparent, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; local = frame->local; prev = cookie; @@ -2726,7 +2727,7 @@ dht_unlink_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg_debug (this->name, op_errno, "Unlink link: subvolume %s" " returned -1", - prev->this->name); + prev->name); goto unlock; } @@ -2749,7 +2750,7 @@ dht_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postparent, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; xlator_t *hashed_subvol = NULL; local = frame->local; @@ -2766,7 +2767,7 @@ dht_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } gf_msg_debug (this->name, op_errno, "Unlink: subvolume %s returned -1", - prev->this->name); + prev->name); goto unlock; } @@ -2794,10 +2795,10 @@ unlock: * to unlink linkfile from hashed subvol if data * file is deleted successfully */ - STACK_WIND (frame, dht_unlink_linkfile_cbk, - hashed_subvol, - hashed_subvol->fops->unlink, &local->loc, - local->flags, xdata); + STACK_WIND_COOKIE (frame, dht_unlink_linkfile_cbk, + hashed_subvol, hashed_subvol, + hashed_subvol->fops->unlink, &local->loc, + local->flags, xdata); return 0; } } @@ -2816,7 +2817,7 @@ dht_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; local = frame->local; prev = cookie; @@ -2827,7 +2828,7 @@ dht_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto unlock; } @@ -3000,7 +3001,7 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; dht_conf_t *conf = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int this_call_cnt = 0; int ret = 0; char *uuid_str = NULL; @@ -3049,7 +3050,7 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_UUID_PARSE_ERROR, "Failed to parse uuid" - " failed for %s", prev->this->name); + " failed for %s", prev->name); local->op_ret = -1; local->op_errno = EINVAL; goto unlock; @@ -3058,12 +3059,12 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (gf_uuid_compare (node_uuid, conf->defrag->node_uuid)) { gf_msg_debug (this->name, 0, "subvol %s does not" "belong to this node", - prev->this->name); + prev->name); } else { conf->local_subvols[(conf->local_subvols_cnt)++] - = prev->this; + = prev; gf_msg_debug (this->name, 0, "subvol %s belongs to" - " this node", prev->this->name); + " this node", prev->name); break; } } @@ -3160,7 +3161,7 @@ dht_vgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dht_local_t *local = NULL; int ret = 0; dict_t *dict = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; gf_boolean_t flag = _gf_true; local = frame->local; @@ -3172,7 +3173,7 @@ dht_vgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg (this->name, GF_LOG_ERROR, op_errno, DHT_MSG_GET_XATTR_FAILED, "vgetxattr: Subvolume %s returned -1", - prev->this->name); + prev->name); goto unwind; } @@ -3519,10 +3520,11 @@ dht_getxattr (call_frame_t *frame, xlator_t *this, (void) strncpy (local->xsel, node_uuid_key, 256); cnt = local->call_cnt = conf->subvolume_cnt; for (i = 0; i < cnt; i++) { - STACK_WIND (frame, dht_find_local_subvol_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->getxattr, - loc, node_uuid_key, xdata); + STACK_WIND_COOKIE (frame, dht_find_local_subvol_cbk, + conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->getxattr, + loc, node_uuid_key, xdata); } if (node_uuid_key) GF_FREE (node_uuid_key); @@ -3560,8 +3562,9 @@ dht_getxattr (call_frame_t *frame, xlator_t *this, (void) strncpy (local->xsel, key, 256); local->call_cnt = 1; - STACK_WIND (frame, dht_vgetxattr_cbk, cached_subvol, - cached_subvol->fops->getxattr, loc, key, xdata); + STACK_WIND_COOKIE (frame, dht_vgetxattr_cbk, cached_subvol, + cached_subvol, cached_subvol->fops->getxattr, + loc, key, xdata); return 0; } @@ -3706,11 +3709,11 @@ err: int dht_file_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, dict_t *xdata) + int op_ret, int op_errno, dict_t *xdata) { int ret = -1; dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; struct iatt *stbuf = NULL; inode_t *inode = NULL; xlator_t *subvol1 = NULL, *subvol2 = NULL; @@ -3723,7 +3726,7 @@ dht_file_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret == -1) && !dht_inode_missing (op_errno)) { gf_msg_debug (this->name, op_errno, "subvolume %s returned -1.", - prev->this->name); + prev->name); goto out; } @@ -3829,10 +3832,11 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this, if (IA_ISDIR (fd->inode->ia_type)) { for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_err_cbk, - layout->list[i].xlator, - layout->list[i].xlator->fops->fsetxattr, - fd, xattr, flags, NULL); + STACK_WIND_COOKIE (frame, dht_err_cbk, + layout->list[i].xlator, + layout->list[i].xlator, + layout->list[i].xlator->fops->fsetxattr, + fd, xattr, flags, NULL); } } else { @@ -3851,8 +3855,9 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this, DHT_IATT_IN_XDATA_KEY, fd); } - STACK_WIND (frame, dht_file_setxattr_cbk, subvol, - subvol->fops->fsetxattr, fd, xattr, flags, xdata); + STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol, + subvol, subvol->fops->fsetxattr, fd, xattr, + flags, xdata); if (xdata) dict_unref (xdata); @@ -3888,7 +3893,7 @@ dht_checking_pathinfo_cbk (call_frame_t *frame, void *cookie, xlator_t *this, char *value = NULL; dht_local_t *local = NULL; dht_conf_t *conf = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int this_call_cnt = 0; local = frame->local; @@ -3905,8 +3910,8 @@ dht_checking_pathinfo_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!strcmp (value, local->key)) { for (i = 0; i < conf->subvolume_cnt; i++) { - if (conf->subvolumes[i] == prev->this) - conf->decommissioned_bricks[i] = prev->this; + if (conf->subvolumes[i] == prev) + conf->decommissioned_bricks[i] = prev; } } @@ -3949,15 +3954,15 @@ dht_setxattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) local->call_cnt = 2; /* This is the second attempt */ if (local->fop == GF_FOP_SETXATTR) { - STACK_WIND (frame, dht_file_setxattr_cbk, subvol, - subvol->fops->setxattr, &local->loc, - local->rebalance.xattr, local->rebalance.flags, - NULL); + STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol, + subvol, subvol->fops->setxattr, &local->loc, + local->rebalance.xattr, + local->rebalance.flags, NULL); } else { - STACK_WIND (frame, dht_file_setxattr_cbk, subvol, - subvol->fops->fsetxattr, local->fd, - local->rebalance.xattr, local->rebalance.flags, - NULL); + STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol, + subvol, subvol->fops->fsetxattr, local->fd, + local->rebalance.xattr, + local->rebalance.flags, NULL); } return 0; @@ -4164,10 +4169,10 @@ dht_setxattr (call_frame_t *frame, xlator_t *this, for (i = 0 ; i < conf->subvolume_cnt; i++) { /* Get the pathinfo, and then compare */ - STACK_WIND (frame, dht_checking_pathinfo_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->getxattr, - loc, GF_XATTR_PATHINFO_KEY, NULL); + STACK_WIND_COOKIE (frame, dht_checking_pathinfo_cbk, + conf->subvolumes[i], conf->subvolumes[i], + conf->subvolumes[i]->fops->getxattr, + loc, GF_XATTR_PATHINFO_KEY, NULL); } return 0; } @@ -4236,10 +4241,11 @@ dht_setxattr (call_frame_t *frame, xlator_t *this, if (IA_ISDIR (loc->inode->ia_type)) { for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_err_cbk, - layout->list[i].xlator, - layout->list[i].xlator->fops->setxattr, - loc, xattr, flags, xdata); + STACK_WIND_COOKIE (frame, dht_err_cbk, + layout->list[i].xlator, + layout->list[i].xlator, + layout->list[i].xlator->fops->setxattr, + loc, xattr, flags, xdata); } } else { @@ -4253,9 +4259,9 @@ dht_setxattr (call_frame_t *frame, xlator_t *this, ret = dict_set_dynstr_with_alloc (xdata, DHT_IATT_IN_XDATA_KEY, "yes"); - STACK_WIND (frame, dht_file_setxattr_cbk, - subvol, subvol->fops->setxattr, - loc, xattr, flags, xdata); + STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol, + subvol, subvol->fops->setxattr, loc, xattr, + flags, xdata); if (xdata) dict_unref (xdata); @@ -4275,11 +4281,11 @@ err: int dht_file_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, dict_t *xdata) + int op_ret, int op_errno, dict_t *xdata) { int ret = -1; dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; struct iatt *stbuf = NULL; inode_t *inode = NULL; xlator_t *subvol1 = NULL, *subvol2 = NULL; @@ -4292,7 +4298,7 @@ dht_file_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret == -1) && !dht_inode_missing (op_errno)) { gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto out; } @@ -4371,13 +4377,13 @@ dht_removexattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, } if (local->fop == GF_FOP_REMOVEXATTR) { - STACK_WIND (frame, dht_file_removexattr_cbk, subvol, - subvol->fops->removexattr, &local->loc, - local->key, NULL); + STACK_WIND_COOKIE (frame, dht_file_removexattr_cbk, subvol, + subvol, subvol->fops->removexattr, + &local->loc, local->key, NULL); } else { - STACK_WIND (frame, dht_file_removexattr_cbk, subvol, - subvol->fops->fremovexattr, local->fd, - local->key, NULL); + STACK_WIND_COOKIE (frame, dht_file_removexattr_cbk, subvol, + subvol, subvol->fops->fremovexattr, + local->fd, local->key, NULL); } return 0; @@ -4394,7 +4400,7 @@ dht_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; local = frame->local; prev = cookie; @@ -4405,7 +4411,7 @@ dht_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto unlock; } @@ -4477,10 +4483,11 @@ dht_removexattr (call_frame_t *frame, xlator_t *this, if (IA_ISDIR (loc->inode->ia_type)) { for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_removexattr_cbk, - layout->list[i].xlator, - layout->list[i].xlator->fops->removexattr, - loc, key, NULL); + STACK_WIND_COOKIE (frame, dht_removexattr_cbk, + layout->list[i].xlator, + layout->list[i].xlator, + layout->list[i].xlator->fops->removexattr, + loc, key, NULL); } } else { @@ -4497,9 +4504,9 @@ dht_removexattr (call_frame_t *frame, xlator_t *this, DHT_IATT_IN_XDATA_KEY, loc->path); } - STACK_WIND (frame, dht_file_removexattr_cbk, - subvol, subvol->fops->removexattr, - loc, key, xdata); + STACK_WIND_COOKIE (frame, dht_file_removexattr_cbk, subvol, + subvol, subvol->fops->removexattr, loc, key, + xdata); if (xdata) dict_unref (xdata); @@ -4566,10 +4573,11 @@ dht_fremovexattr (call_frame_t *frame, xlator_t *this, if (IA_ISDIR (fd->inode->ia_type)) { for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_removexattr_cbk, - layout->list[i].xlator, - layout->list[i].xlator->fops->fremovexattr, - fd, key, NULL); + STACK_WIND_COOKIE (frame, dht_removexattr_cbk, + layout->list[i].xlator, + layout->list[i].xlator, + layout->list[i].xlator->fops->fremovexattr, + fd, key, NULL); } } else { @@ -4586,9 +4594,9 @@ dht_fremovexattr (call_frame_t *frame, xlator_t *this, DHT_IATT_IN_XDATA_KEY, fd); } - STACK_WIND (frame, dht_file_removexattr_cbk, - subvol, subvol->fops->fremovexattr, - fd, key, xdata); + STACK_WIND_COOKIE (frame, dht_file_removexattr_cbk, subvol, + subvol, subvol->fops->fremovexattr, fd, key, + xdata); if (xdata) dict_unref (xdata); @@ -4610,7 +4618,7 @@ dht_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; local = frame->local; prev = cookie; @@ -4621,7 +4629,7 @@ dht_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto unlock; } @@ -4874,19 +4882,20 @@ dht_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, local->call_cnt = conf->subvolume_cnt; for (i = 0; i < conf->subvolume_cnt; i++) { - STACK_WIND (frame, dht_fd_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->opendir, - loc, fd, xdata); - + STACK_WIND_COOKIE (frame, dht_fd_cbk, + conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->opendir, + loc, fd, xdata); } } else { local->call_cnt = conf->local_subvols_cnt; for (i = 0; i < conf->local_subvols_cnt; i++) { - STACK_WIND (frame, dht_fd_cbk, - conf->local_subvols[i], - conf->local_subvols[i]->fops->opendir, - loc, fd, xdata); + STACK_WIND_COOKIE (frame, dht_fd_cbk, + conf->local_subvols[i], + conf->local_subvols[i], + conf->local_subvols[i]->fops->opendir, + loc, fd, xdata); } } @@ -4908,7 +4917,7 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, gf_dirent_t entries; gf_dirent_t *orig_entry = NULL; gf_dirent_t *entry = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; xlator_t *next_subvol = NULL; off_t next_offset = 0; int count = 0; @@ -4973,7 +4982,7 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, * directory entry. */ if (readdir_optimize) { - if (prev->this == local->first_up_subvol) + if (prev == local->first_up_subvol) goto list; else continue; @@ -4983,11 +4992,11 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, hashed_subvol = methods->layout_search (this, layout, orig_entry->d_name); - if (prev->this == hashed_subvol) + if (prev == hashed_subvol) goto list; if ((hashed_subvol && dht_subvol_status (conf, hashed_subvol)) - ||(prev->this != local->first_up_subvol)) + || (prev != local->first_up_subvol)) continue; goto list; @@ -5009,7 +5018,7 @@ list: if (conf->search_unhashed == GF_DHT_LOOKUP_UNHASHED_AUTO) { subvol = methods->layout_search (this, layout, orig_entry->d_name); - if (!subvol || (subvol != prev->this)) { + if (!subvol || (subvol != prev)) { /* TODO: Count the number of entries which need linkfile to prove its existence in fs */ layout->search_unhashed++; @@ -5038,7 +5047,7 @@ list: } } else { if (orig_entry->inode) { - ret = dht_layout_preset (this, prev->this, + ret = dht_layout_preset (this, prev, orig_entry->inode); if (ret) gf_msg (this->name, GF_LOG_WARNING, 0, @@ -5060,7 +5069,7 @@ list: orig_entry->d_stat.ia_gfid); if (inode) { ret = dht_layout_preset - (this, prev->this, + (this, prev, inode); if (ret) gf_msg (this->name, @@ -5084,7 +5093,7 @@ list: * distribute we're not concerned only with a posix's view of the * directory but the aggregated namespace' view of the directory. */ - if (prev->this != dht_last_up_subvol (this)) + if (prev != dht_last_up_subvol (this)) op_errno = 0; done: @@ -5093,9 +5102,9 @@ done: EOF is not yet hit on the current subvol */ if (next_offset == 0) { - next_subvol = dht_subvol_next (this, prev->this); + next_subvol = dht_subvol_next (this, prev); } else { - next_subvol = prev->this; + next_subvol = prev; } if (!next_subvol) { @@ -5118,10 +5127,10 @@ done: } } - STACK_WIND (frame, dht_readdirp_cbk, - next_subvol, next_subvol->fops->readdirp, - local->fd, local->size, next_offset, - local->xattr); + STACK_WIND_COOKIE (frame, dht_readdirp_cbk, next_subvol, + next_subvol, next_subvol->fops->readdirp, + local->fd, local->size, next_offset, + local->xattr); return 0; } @@ -5147,7 +5156,7 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_dirent_t entries; gf_dirent_t *orig_entry = NULL; gf_dirent_t *entry = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; xlator_t *next_subvol = NULL; off_t next_offset = 0; int count = 0; @@ -5179,7 +5188,7 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, subvol = methods->layout_search (this, layout, orig_entry->d_name); - if (!subvol || (subvol == prev->this)) { + if (!subvol || (subvol == prev)) { entry = gf_dirent_for_name (orig_entry->d_name); if (!entry) { gf_msg (this->name, GF_LOG_ERROR, ENOMEM, @@ -5205,7 +5214,7 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * distribute we're not concerned only with a posix's view of the * directory but the aggregated namespace' view of the directory. */ - if (prev->this != dht_last_up_subvol (this)) + if (prev != dht_last_up_subvol (this)) op_errno = 0; done: @@ -5214,18 +5223,18 @@ done: EOF is not yet hit on the current subvol */ if (next_offset == 0) { - next_subvol = dht_subvol_next (this, prev->this); + next_subvol = dht_subvol_next (this, prev); } else { - next_subvol = prev->this; + next_subvol = prev; } if (!next_subvol) { goto unwind; } - STACK_WIND (frame, dht_readdir_cbk, - next_subvol, next_subvol->fops->readdir, - local->fd, local->size, next_offset, NULL); + STACK_WIND_COOKIE (frame, dht_readdir_cbk, next_subvol, + next_subvol, next_subvol->fops->readdir, + local->fd, local->size, next_offset, NULL); return 0; } @@ -5307,11 +5316,13 @@ dht_do_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, } } - STACK_WIND (frame, dht_readdirp_cbk, xvol, xvol->fops->readdirp, - fd, size, yoff, local->xattr); + STACK_WIND_COOKIE (frame, dht_readdirp_cbk, xvol, xvol, + xvol->fops->readdirp, fd, size, yoff, + local->xattr); } else { - STACK_WIND (frame, dht_readdir_cbk, xvol, xvol->fops->readdir, - fd, size, yoff, local->xattr); + STACK_WIND_COOKIE (frame, dht_readdir_cbk, xvol, xvol, + xvol->fops->readdir, fd, size, yoff, + local->xattr); } return 0; @@ -6337,9 +6348,8 @@ dht_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, } local->flags = xflag; - STACK_WIND (frame, dht_unlink_cbk, - cached_subvol, cached_subvol->fops->unlink, loc, - xflag, xdata); + STACK_WIND_COOKIE (frame, dht_unlink_cbk, cached_subvol, cached_subvol, + cached_subvol->fops->unlink, loc, xflag, xdata); return 0; err: @@ -6620,7 +6630,7 @@ dht_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, fd_t *fd, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, struct iatt *postparent, dict_t *xdata) { - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = -1; dht_local_t *local = NULL; @@ -6644,11 +6654,11 @@ dht_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, postparent, 1); } - ret = dht_layout_preset (this, prev->this, inode); + ret = dht_layout_preset (this, prev, inode); if (ret != 0) { gf_msg_debug (this->name, 0, "could not set preset layout for subvol %s", - prev->this->name); + prev->name); op_ret = -1; op_errno = EINVAL; goto out; @@ -6720,10 +6730,10 @@ dht_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, dict_del (local->params, GLUSTERFS_INTERNAL_FOP_KEY); } - STACK_WIND (frame, dht_create_cbk, - cached_subvol, cached_subvol->fops->create, - &local->loc, local->flags, local->mode, - local->umask, local->fd, local->params); + STACK_WIND_COOKIE (frame, dht_create_cbk, cached_subvol, + cached_subvol, cached_subvol->fops->create, + &local->loc, local->flags, local->mode, + local->umask, local->fd, local->params); return 0; err: @@ -6753,9 +6763,9 @@ dht_create_wind_to_avail_subvol (call_frame_t *frame, xlator_t *this, "creating %s on %s", loc->path, subvol->name); - STACK_WIND (frame, dht_create_cbk, - subvol, subvol->fops->create, - loc, flags, mode, umask, fd, params); + STACK_WIND_COOKIE (frame, dht_create_cbk, subvol, + subvol, subvol->fops->create, + loc, flags, mode, umask, fd, params); } else { avail_subvol = dht_free_disk_available_subvol (this, subvol, local); @@ -6781,9 +6791,9 @@ dht_create_wind_to_avail_subvol (call_frame_t *frame, xlator_t *this, gf_msg_debug (this->name, 0, "creating %s on %s", loc->path, subvol->name); - STACK_WIND (frame, dht_create_cbk, - subvol, subvol->fops->create, - loc, flags, mode, umask, fd, params); + STACK_WIND_COOKIE (frame, dht_create_cbk, subvol, + subvol, subvol->fops->create, + loc, flags, mode, umask, fd, params); } out: return 0; @@ -7065,9 +7075,9 @@ dht_create (call_frame_t *frame, xlator_t *this, DHT_MSG_SUBVOL_INFO, "creating %s on %s (got create on %s)", local->loc.path, subvol->name, loc->path); - STACK_WIND (frame, dht_create_cbk, - subvol, subvol->fops->create, - &local->loc, flags, mode, umask, fd, params); + STACK_WIND_COOKIE (frame, dht_create_cbk, subvol, + subvol, subvol->fops->create, &local->loc, + flags, mode, umask, fd, params); goto done; } @@ -7211,19 +7221,19 @@ dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int ret = -1; gf_boolean_t subvol_filled = _gf_false; gf_boolean_t dir_exists = _gf_false; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; dht_layout_t *layout = NULL; local = frame->local; prev = cookie; layout = local->layout; - subvol_filled = dht_is_subvol_filled (this, prev->this); + subvol_filled = dht_is_subvol_filled (this, prev); LOCK (&frame->lock); { if (subvol_filled && (op_ret != -1)) { - ret = dht_layout_merge (this, layout, prev->this, + ret = dht_layout_merge (this, layout, prev, -1, ENOSPC, NULL); } else { if (op_ret == -1 && op_errno == EEXIST) { @@ -7237,14 +7247,14 @@ dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret = 0; dir_exists = _gf_true; } - ret = dht_layout_merge (this, layout, prev->this, + ret = dht_layout_merge (this, layout, prev, op_ret, op_errno, NULL); } if (ret) gf_msg (this->name, GF_LOG_WARNING, 0, DHT_MSG_LAYOUT_MERGE_FAILED, "%s: failed to merge layouts for subvol %s", - local->loc.path, prev->this->name); + local->loc.path, prev->name); if (op_ret == -1) { local->op_errno = op_errno; @@ -7254,10 +7264,9 @@ dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (dir_exists) goto unlock; - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); - dht_iatt_merge (this, &local->preparent, preparent, prev->this); - dht_iatt_merge (this, &local->postparent, postparent, - prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev); + dht_iatt_merge (this, &local->preparent, preparent, prev); + dht_iatt_merge (this, &local->postparent, postparent, prev); } unlock: UNLOCK (&frame->lock); @@ -7385,10 +7394,9 @@ dht_mkdir_helper (call_frame_t *frame, xlator_t *this, parent_disk_layout = NULL; - STACK_WIND (frame, dht_mkdir_hashed_cbk, - hashed_subvol, - hashed_subvol->fops->mkdir, - loc, mode, umask, params); + STACK_WIND_COOKIE (frame, dht_mkdir_hashed_cbk, hashed_subvol, + hashed_subvol, hashed_subvol->fops->mkdir, + loc, mode, umask, params); return 0; @@ -7417,7 +7425,7 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie, { dht_local_t *local = NULL; int ret = -1; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; dht_layout_t *layout = NULL; dht_conf_t *conf = NULL; int i = 0; @@ -7473,10 +7481,10 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie, dict_del (local->params, conf->xattr_name); if (dht_is_subvol_filled (this, hashed_subvol)) - ret = dht_layout_merge (this, layout, prev->this, + ret = dht_layout_merge (this, layout, prev, -1, ENOSPC, NULL); else - ret = dht_layout_merge (this, layout, prev->this, + ret = dht_layout_merge (this, layout, prev, op_ret, op_errno, NULL); /* TODO: we may have to return from the function @@ -7485,13 +7493,13 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie, gf_msg (this->name, GF_LOG_WARNING, 0, DHT_MSG_LAYOUT_MERGE_FAILED, "%s: failed to merge layouts for subvol %s", - local->loc.path, prev->this->name); + local->loc.path, prev->name); local->op_ret = 0; - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); - dht_iatt_merge (this, &local->preparent, preparent, prev->this); - dht_iatt_merge (this, &local->postparent, postparent, prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev); + dht_iatt_merge (this, &local->preparent, preparent, prev); + dht_iatt_merge (this, &local->postparent, postparent, prev); local->call_cnt = conf->subvolume_cnt - 1; @@ -7506,10 +7514,11 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie, for (i = 0; i < conf->subvolume_cnt; i++) { if (conf->subvolumes[i] == hashed_subvol) continue; - STACK_WIND (frame, dht_mkdir_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->mkdir, &local->loc, - local->mode, local->umask, local->params); + STACK_WIND_COOKIE (frame, dht_mkdir_cbk, conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->mkdir, + &local->loc, local->mode, local->umask, + local->params); } return 0; err: @@ -7548,10 +7557,10 @@ dht_mkdir_guard_parent_layout_cbk (call_frame_t *frame, xlator_t *this, local->op_ret = -1; - STACK_WIND (frame, dht_mkdir_hashed_cbk, - local->hashed_subvol, - local->hashed_subvol->fops->mkdir, - loc, mode, umask, params); + STACK_WIND_COOKIE (frame, dht_mkdir_hashed_cbk, local->hashed_subvol, + local->hashed_subvol, + local->hashed_subvol->fops->mkdir, + loc, mode, umask, params); return 0; err: @@ -7698,7 +7707,7 @@ dht_rmdir_hashed_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this, call_frame_t *heal_frame = NULL; dht_conf_t *conf = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; char gfid[GF_UUID_BUF_SIZE] ={0}; local = frame->local; @@ -7722,14 +7731,13 @@ dht_rmdir_hashed_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg_debug (this->name, op_errno, "rmdir on %s for %s failed " "(gfid = %s)", - prev->this->name, local->loc.path, + prev->name, local->loc.path, gfid); goto unlock; } - dht_iatt_merge (this, &local->preparent, preparent, prev->this); - dht_iatt_merge (this, &local->postparent, postparent, - prev->this); + dht_iatt_merge (this, &local->preparent, preparent, prev); + dht_iatt_merge (this, &local->postparent, postparent, prev); } unlock: @@ -7814,7 +7822,7 @@ dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int done = 0; char gfid[GF_UUID_BUF_SIZE] ={0}; dht_local_t *heal_local = NULL; @@ -7841,16 +7849,15 @@ dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg_debug (this->name, op_errno, "rmdir on %s for %s failed." "(gfid = %s)", - prev->this->name, local->loc.path, + prev->name, local->loc.path, gfid); goto unlock; } /* Track if rmdir succeeded on atleast one subvol*/ local->fop_succeeded = 1; - dht_iatt_merge (this, &local->preparent, preparent, prev->this); - dht_iatt_merge (this, &local->postparent, postparent, - prev->this); + dht_iatt_merge (this, &local->preparent, preparent, prev); + dht_iatt_merge (this, &local->postparent, postparent, prev); } unlock: UNLOCK (&frame->lock); @@ -7910,10 +7917,11 @@ unlock: * The fop failed with ENOENT/ESTALE on * all subvols */ - STACK_WIND (frame, dht_rmdir_hashed_subvol_cbk, - local->hashed_subvol, - local->hashed_subvol->fops->rmdir, - &local->loc, local->flags, NULL); + STACK_WIND_COOKIE (frame, dht_rmdir_hashed_subvol_cbk, + local->hashed_subvol, + local->hashed_subvol, + local->hashed_subvol->fops->rmdir, + &local->loc, local->flags, NULL); } else { /* hashed-subvol was non-NULL and rmdir failed on * all non hashed-subvols. Unwind rmdir with @@ -8041,10 +8049,10 @@ dht_rmdir_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this, (local->hashed_subvol == conf->subvolumes[i])) continue; - STACK_WIND (frame, dht_rmdir_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->rmdir, - &local->loc, local->flags, NULL); + STACK_WIND_COOKIE (frame, dht_rmdir_cbk, conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->rmdir, + &local->loc, local->flags, NULL); } return 0; @@ -8096,10 +8104,10 @@ dht_rmdir_do (call_frame_t *frame, xlator_t *this) /* When DHT has only 1 child */ if (conf->subvolume_cnt == 1) { - STACK_WIND (frame, dht_rmdir_hashed_subvol_cbk, - conf->subvolumes[0], - conf->subvolumes[0]->fops->rmdir, - &local->loc, local->flags, NULL); + STACK_WIND_COOKIE (frame, dht_rmdir_hashed_subvol_cbk, + conf->subvolumes[0], conf->subvolumes[0], + conf->subvolumes[0]->fops->rmdir, + &local->loc, local->flags, NULL); return 0; } @@ -8161,7 +8169,7 @@ dht_rmdir_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this struct iatt *postparent, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; xlator_t *src = NULL; call_frame_t *main_frame = NULL; dht_local_t *main_local = NULL; @@ -8171,7 +8179,7 @@ dht_rmdir_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this local = frame->local; prev = cookie; - src = prev->this; + src = prev; main_frame = local->main_frame; main_local = main_frame->local; @@ -8205,7 +8213,7 @@ dht_rmdir_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *stbuf, dict_t *xattr, struct iatt *parent) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; xlator_t *src = NULL; call_frame_t *main_frame = NULL; dht_local_t *main_local = NULL; @@ -8215,7 +8223,7 @@ dht_rmdir_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; prev = cookie; - src = prev->this; + src = prev; main_frame = local->main_frame; main_local = main_frame->local; @@ -8236,8 +8244,8 @@ dht_rmdir_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto err; } - STACK_WIND (frame, dht_rmdir_linkfile_unlink_cbk, - src, src->fops->unlink, &local->loc, 0, NULL); + STACK_WIND_COOKIE (frame, dht_rmdir_linkfile_unlink_cbk, src, + src, src->fops->unlink, &local->loc, 0, NULL); return 0; err: @@ -8304,8 +8312,8 @@ dht_rmdir_cached_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto err; } - STACK_WIND (frame, dht_rmdir_lookup_cbk, - src, src->fops->lookup, &local->loc, xattrs); + STACK_WIND_COOKIE (frame, dht_rmdir_lookup_cbk, src, src, + src->fops->lookup, &local->loc, xattrs); if (xattrs) dict_unref (xattrs); @@ -8427,9 +8435,9 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this, "Linkfile does not have link subvolume. " "path = %s, gfid = %s", lookup_local->loc.path, gfid); - STACK_WIND (lookup_frame, dht_rmdir_lookup_cbk, - src, src->fops->lookup, - &lookup_local->loc, xattrs); + STACK_WIND_COOKIE (lookup_frame, dht_rmdir_lookup_cbk, + src, src, src->fops->lookup, + &lookup_local->loc, xattrs); } else { STACK_WIND (lookup_frame, dht_rmdir_cached_lookup_cbk, subvol, subvol->fops->lookup, @@ -8459,13 +8467,13 @@ dht_rmdir_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = -1; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; xlator_t *src = NULL; int ret = 0; local = frame->local; prev = cookie; - src = prev->this; + src = prev; if (op_ret > 2) { ret = dht_rmdir_is_subvol_empty (frame, this, entries, src); @@ -8474,7 +8482,7 @@ dht_rmdir_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, case 0: /* non linkfiles exist */ gf_msg_trace (this->name, 0, "readdir on %s for %s returned %d " - "entries", prev->this->name, + "entries", prev->name, local->loc.path, op_ret); local->op_ret = -1; local->op_errno = ENOTEMPTY; @@ -8483,7 +8491,7 @@ dht_rmdir_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, /* @ret number of linkfiles are getting unlinked */ gf_msg_trace (this->name, 0, "readdir on %s for %s found %d " - "linkfiles", prev->this->name, + "linkfiles", prev->name, local->loc.path, ret); break; } @@ -8505,7 +8513,7 @@ dht_rmdir_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = -1; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; dict_t *dict = NULL; int ret = 0; dht_conf_t *conf = this->private; @@ -8523,7 +8531,7 @@ dht_rmdir_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg_debug (this->name, op_errno, "opendir on %s for %s failed, " "gfid = %s,", - prev->this->name, local->loc.path, gfid); + prev->name, local->loc.path, gfid); if ((op_errno != ENOENT) && (op_errno != ESTALE)) { local->op_ret = -1; local->op_errno = op_errno; @@ -8554,10 +8562,10 @@ dht_rmdir_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->call_cnt = conf->subvolume_cnt; for (i = 0; i < conf->subvolume_cnt; i++) { - STACK_WIND (frame, dht_rmdir_readdirp_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->readdirp, - local->fd, 4096, 0, dict); + STACK_WIND_COOKIE (frame, dht_rmdir_readdirp_cbk, + conf->subvolumes[i], conf->subvolumes[i], + conf->subvolumes[i]->fops->readdirp, + local->fd, 4096, 0, dict); } if (dict) @@ -8616,10 +8624,10 @@ dht_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, } for (i = 0; i < conf->subvolume_cnt; i++) { - STACK_WIND (frame, dht_rmdir_opendir_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->opendir, - loc, local->fd, NULL); + STACK_WIND_COOKIE (frame, dht_rmdir_opendir_cbk, + conf->subvolumes[i], conf->subvolumes[i], + conf->subvolumes[i]->fops->opendir, + loc, local->fd, NULL); } return 0; diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c index 1eb9e63c531..06957434c58 100644 --- a/xlators/cluster/dht/src/dht-diskusage.c +++ b/xlators/cluster/dht/src/dht-diskusage.c @@ -26,7 +26,7 @@ dht_du_info_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dict_t *xdata) { dht_conf_t *conf = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int this_call_cnt = 0; int i = 0; double percent = 0; @@ -41,7 +41,7 @@ dht_du_info_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { gf_msg (this->name, GF_LOG_WARNING, op_errno, DHT_MSG_GET_DISK_INFO_ERROR, - "failed to get disk info from %s", prev->this->name); + "failed to get disk info from %s", prev->name); goto out; } @@ -76,7 +76,7 @@ dht_du_info_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&conf->subvolume_lock); { for (i = 0; i < conf->subvolume_cnt; i++) - if (prev->this == conf->subvolumes[i]) { + if (prev == conf->subvolumes[i]) { conf->du_stats[i].avail_percent = percent; conf->du_stats[i].avail_space = bytes; conf->du_stats[i].avail_inodes = percent_inodes; @@ -86,7 +86,7 @@ dht_du_info_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "is: %.2f and avail_space " "is: %" PRIu64" and avail_inodes" " is: %.2f", - prev->this->name, + prev->name, conf->du_stats[i].avail_percent, conf->du_stats[i].avail_space, conf->du_stats[i].avail_inodes); @@ -131,10 +131,11 @@ dht_get_du_info_for_subvol (xlator_t *this, int subvol_idx) tmp_loc.gfid[15] = 1; statfs_local->call_cnt = 1; - STACK_WIND (statfs_frame, dht_du_info_cbk, - conf->subvolumes[subvol_idx], - conf->subvolumes[subvol_idx]->fops->statfs, - &tmp_loc, NULL); + STACK_WIND_COOKIE (statfs_frame, dht_du_info_cbk, + conf->subvolumes[subvol_idx], + conf->subvolumes[subvol_idx], + conf->subvolumes[subvol_idx]->fops->statfs, + &tmp_loc, NULL); return 0; err: @@ -194,10 +195,11 @@ dht_get_du_info (call_frame_t *frame, xlator_t *this, loc_t *loc) statfs_local->call_cnt = conf->subvolume_cnt; for (i = 0; i < conf->subvolume_cnt; i++) { - STACK_WIND (statfs_frame, dht_du_info_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->statfs, - &tmp_loc, statfs_local->params); + STACK_WIND_COOKIE (statfs_frame, dht_du_info_cbk, + conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->statfs, + &tmp_loc, statfs_local->params); } conf->last_stat_fetch.tv_sec = tv.tv_sec; diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c index 8abf0d59b88..58168dec81b 100644 --- a/xlators/cluster/dht/src/dht-inode-read.c +++ b/xlators/cluster/dht/src/dht-inode-read.c @@ -32,7 +32,7 @@ dht_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, fd_t *fd, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = 0; local = frame->local; @@ -42,7 +42,7 @@ dht_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret == -1) && !dht_inode_missing(op_errno)) { gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto out; } @@ -86,9 +86,9 @@ dht_open2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) local->call_cnt = 2; - STACK_WIND (frame, dht_open_cbk, subvol, subvol->fops->open, - &local->loc, local->rebalance.flags, local->fd, - NULL); + STACK_WIND_COOKIE (frame, dht_open_cbk, subvol, subvol, + subvol->fops->open, &local->loc, + local->rebalance.flags, local->fd, NULL); return 0; out: @@ -126,8 +126,8 @@ dht_open (call_frame_t *frame, xlator_t *this, local->rebalance.flags = flags; local->call_cnt = 1; - STACK_WIND (frame, dht_open_cbk, subvol, subvol->fops->open, - loc, flags, fd, xdata); + STACK_WIND_COOKIE (frame, dht_open_cbk, subvol, subvol, + subvol->fops->open, loc, flags, fd, xdata); return 0; @@ -145,7 +145,7 @@ dht_file_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, xlator_t *subvol1 = 0; xlator_t *subvol2 = 0; dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = -1; inode_t *inode = NULL; @@ -161,7 +161,7 @@ dht_file_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto out; } @@ -238,11 +238,11 @@ dht_attr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) local->call_cnt = 2; if (local->fop == GF_FOP_FSTAT) { - STACK_WIND (frame, dht_file_attr_cbk, subvol, - subvol->fops->fstat, local->fd, NULL); + STACK_WIND_COOKIE (frame, dht_file_attr_cbk, subvol, subvol, + subvol->fops->fstat, local->fd, NULL); } else { - STACK_WIND (frame, dht_file_attr_cbk, subvol, - subvol->fops->stat, &local->loc, NULL); + STACK_WIND_COOKIE (frame, dht_file_attr_cbk, subvol, subvol, + subvol->fops->stat, &local->loc, NULL); } return 0; @@ -258,7 +258,7 @@ dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; GF_VALIDATE_OR_GOTO ("dht", frame, err); GF_VALIDATE_OR_GOTO ("dht", this, out); @@ -274,12 +274,12 @@ dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto unlock; } - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev); local->op_ret = 0; } @@ -331,8 +331,8 @@ dht_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) subvol = local->cached_subvol; - STACK_WIND (frame, dht_file_attr_cbk, subvol, - subvol->fops->stat, loc, xdata); + STACK_WIND_COOKIE (frame, dht_file_attr_cbk, subvol, subvol, + subvol->fops->stat, loc, xdata); return 0; } @@ -342,9 +342,8 @@ dht_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) for (i = 0; i < call_cnt; i++) { subvol = layout->list[i].xlator; - STACK_WIND (frame, dht_attr_cbk, - subvol, subvol->fops->stat, - loc, xdata); + STACK_WIND_COOKIE (frame, dht_attr_cbk, subvol, subvol, + subvol->fops->stat, loc, xdata); } return 0; @@ -391,8 +390,8 @@ dht_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) subvol = local->cached_subvol; - STACK_WIND (frame, dht_file_attr_cbk, subvol, - subvol->fops->fstat, fd, xdata); + STACK_WIND_COOKIE (frame, dht_file_attr_cbk, subvol, subvol, + subvol->fops->fstat, fd, xdata); return 0; } @@ -401,9 +400,8 @@ dht_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) for (i = 0; i < call_cnt; i++) { subvol = layout->list[i].xlator; - STACK_WIND (frame, dht_attr_cbk, - subvol, subvol->fops->fstat, - fd, xdata); + STACK_WIND_COOKIE (frame, dht_attr_cbk, subvol, subvol, + subvol->fops->fstat, fd, xdata); } return 0; @@ -567,19 +565,19 @@ dht_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int ret = -1; dht_local_t *local = NULL; xlator_t *subvol = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; local = frame->local; prev = cookie; - if (!prev || !prev->this) + if (!prev) goto out; if (local->call_cnt != 1) goto out; if ((op_ret == -1) && ((op_errno == ENOTCONN) || dht_inode_missing(op_errno)) && IA_ISDIR(local->loc.inode->ia_type)) { - subvol = dht_subvol_next_available (this, prev->this); + subvol = dht_subvol_next_available (this, prev); if (!subvol) goto out; @@ -588,8 +586,9 @@ dht_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto out; } - STACK_WIND (frame, dht_access_cbk, subvol, subvol->fops->access, - &local->loc, local->rebalance.flags, NULL); + STACK_WIND_COOKIE (frame, dht_access_cbk, subvol, subvol, + subvol->fops->access, &local->loc, + local->rebalance.flags, NULL); return 0; } if ((op_ret == -1) && dht_inode_missing(op_errno) && @@ -634,8 +633,9 @@ dht_access2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) local->call_cnt = 2; - STACK_WIND (frame, dht_access_cbk, subvol, subvol->fops->access, - &local->loc, local->rebalance.flags, NULL); + STACK_WIND_COOKIE (frame, dht_access_cbk, subvol, subvol, + subvol->fops->access, &local->loc, + local->rebalance.flags, NULL); return 0; @@ -675,8 +675,8 @@ dht_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask, goto err; } - STACK_WIND (frame, dht_access_cbk, subvol, subvol->fops->access, - loc, mask, xdata); + STACK_WIND_COOKIE (frame, dht_access_cbk, subvol, subvol, + subvol->fops->access, loc, mask, xdata); return 0; @@ -807,7 +807,7 @@ dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = -1; inode_t *inode = NULL; xlator_t *src_subvol = 0; @@ -820,7 +820,7 @@ dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, if (op_ret == -1 && !dht_inode_missing(op_errno)) { gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto out; } @@ -906,8 +906,9 @@ dht_fsync2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) local->call_cnt = 2; /* This is the second attempt */ - STACK_WIND (frame, dht_fsync_cbk, subvol, subvol->fops->fsync, - local->fd, local->rebalance.flags, NULL); + STACK_WIND_COOKIE (frame, dht_fsync_cbk, subvol, subvol, + subvol->fops->fsync, local->fd, + local->rebalance.flags, NULL); return 0; @@ -940,8 +941,8 @@ dht_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync, subvol = local->cached_subvol; - STACK_WIND (frame, dht_fsync_cbk, subvol, subvol->fops->fsync, - fd, datasync, xdata); + STACK_WIND_COOKIE (frame, dht_fsync_cbk, subvol, subvol, + subvol->fops->fsync, fd, datasync, xdata); return 0; diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c index 112685b659e..93755b9703a 100644 --- a/xlators/cluster/dht/src/dht-inode-write.c +++ b/xlators/cluster/dht/src/dht-inode-write.c @@ -30,7 +30,7 @@ dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postbuf, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = -1; xlator_t *subvol1 = NULL; xlator_t *subvol2 = NULL; @@ -49,7 +49,7 @@ dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_ret = -1; gf_msg_debug (this->name, 0, "subvolume %s returned -1 (%s)", - prev->this->name, strerror (op_errno)); + prev->name, strerror (op_errno)); goto out; } @@ -139,11 +139,12 @@ dht_writev2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) local->call_cnt = 2; /* This is the second attempt */ - STACK_WIND (frame, dht_writev_cbk, - subvol, subvol->fops->writev, - local->fd, local->rebalance.vector, local->rebalance.count, - local->rebalance.offset, local->rebalance.flags, - local->rebalance.iobref, NULL); + STACK_WIND_COOKIE (frame, dht_writev_cbk, subvol, + subvol, subvol->fops->writev, + local->fd, local->rebalance.vector, + local->rebalance.count, + local->rebalance.offset, local->rebalance.flags, + local->rebalance.iobref, NULL); return 0; @@ -189,9 +190,9 @@ dht_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, local->rebalance.iobref = iobref_ref (iobref); local->call_cnt = 1; - STACK_WIND (frame, dht_writev_cbk, - subvol, subvol->fops->writev, - fd, vector, count, off, flags, iobref, xdata); + STACK_WIND_COOKIE (frame, dht_writev_cbk, subvol, subvol, + subvol->fops->writev, fd, vector, count, off, flags, + iobref, xdata); return 0; @@ -210,7 +211,7 @@ dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postbuf, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = -1; xlator_t *src_subvol = NULL; xlator_t *dst_subvol = NULL; @@ -229,7 +230,7 @@ dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_ret = -1; gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto out; } @@ -321,13 +322,13 @@ dht_truncate2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) local->call_cnt = 2; /* This is the second attempt */ if (local->fop == GF_FOP_TRUNCATE) { - STACK_WIND (frame, dht_truncate_cbk, subvol, - subvol->fops->truncate, &local->loc, - local->rebalance.offset, NULL); + STACK_WIND_COOKIE (frame, dht_truncate_cbk, subvol, subvol, + subvol->fops->truncate, &local->loc, + local->rebalance.offset, NULL); } else { - STACK_WIND (frame, dht_truncate_cbk, subvol, - subvol->fops->ftruncate, local->fd, - local->rebalance.offset, NULL); + STACK_WIND_COOKIE (frame, dht_truncate_cbk, subvol, subvol, + subvol->fops->ftruncate, local->fd, + local->rebalance.offset, NULL); } return 0; @@ -367,9 +368,8 @@ dht_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, goto err; } - STACK_WIND (frame, dht_truncate_cbk, - subvol, subvol->fops->truncate, - loc, offset, xdata); + STACK_WIND_COOKIE (frame, dht_truncate_cbk, subvol, subvol, + subvol->fops->truncate, loc, offset, xdata); return 0; @@ -408,9 +408,8 @@ dht_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, goto err; } - STACK_WIND (frame, dht_truncate_cbk, - subvol, subvol->fops->ftruncate, - fd, offset, xdata); + STACK_WIND_COOKIE (frame, dht_truncate_cbk, subvol, subvol, + subvol->fops->ftruncate, fd, offset, xdata); return 0; @@ -428,7 +427,7 @@ dht_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postbuf, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = -1; xlator_t *src_subvol = NULL; xlator_t *dst_subvol = NULL; @@ -446,7 +445,7 @@ dht_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, local->op_ret = -1; gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto out; } @@ -531,9 +530,10 @@ dht_fallocate2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) local->call_cnt = 2; /* This is the second attempt */ - STACK_WIND(frame, dht_fallocate_cbk, subvol, subvol->fops->fallocate, - local->fd, local->rebalance.flags, local->rebalance.offset, - local->rebalance.size, NULL); + STACK_WIND_COOKIE (frame, dht_fallocate_cbk, subvol, subvol, + subvol->fops->fallocate, local->fd, + local->rebalance.flags, local->rebalance.offset, + local->rebalance.size, NULL); return 0; @@ -573,9 +573,9 @@ dht_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, goto err; } - STACK_WIND (frame, dht_fallocate_cbk, - subvol, subvol->fops->fallocate, - fd, mode, offset, len, xdata); + STACK_WIND_COOKIE (frame, dht_fallocate_cbk, subvol, subvol, + subvol->fops->fallocate, fd, mode, offset, len, + xdata); return 0; @@ -593,7 +593,7 @@ dht_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postbuf, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = -1; xlator_t *src_subvol = NULL; xlator_t *dst_subvol = NULL; @@ -611,7 +611,7 @@ dht_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this, local->op_ret = -1; gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto out; } @@ -696,9 +696,10 @@ dht_discard2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) local->call_cnt = 2; /* This is the second attempt */ - STACK_WIND(frame, dht_discard_cbk, subvol, subvol->fops->discard, - local->fd, local->rebalance.offset, local->rebalance.size, - NULL); + STACK_WIND_COOKIE (frame, dht_discard_cbk, subvol, subvol, + subvol->fops->discard, local->fd, + local->rebalance.offset, local->rebalance.size, + NULL); return 0; @@ -737,8 +738,8 @@ dht_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, goto err; } - STACK_WIND (frame, dht_discard_cbk, subvol, subvol->fops->discard, - fd, offset, len, xdata); + STACK_WIND_COOKIE (frame, dht_discard_cbk, subvol, subvol, + subvol->fops->discard, fd, offset, len, xdata); return 0; @@ -755,7 +756,7 @@ dht_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postbuf, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = -1; xlator_t *subvol1 = NULL, *subvol2 = NULL; @@ -772,7 +773,7 @@ dht_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, local->op_ret = -1; gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto out; } @@ -859,9 +860,10 @@ dht_zerofill2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) local->call_cnt = 2; /* This is the second attempt */ - STACK_WIND(frame, dht_zerofill_cbk, subvol, subvol->fops->zerofill, - local->fd, local->rebalance.offset, local->rebalance.size, - NULL); + STACK_WIND_COOKIE (frame, dht_zerofill_cbk, subvol, subvol, + subvol->fops->zerofill, + local->fd, local->rebalance.offset, + local->rebalance.size, NULL); return 0; @@ -901,8 +903,8 @@ dht_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, goto err; } - STACK_WIND (frame, dht_zerofill_cbk, subvol, subvol->fops->zerofill, - fd, offset, len, xdata); + STACK_WIND_COOKIE (frame, dht_zerofill_cbk, subvol, subvol, + subvol->fops->zerofill, fd, offset, len, xdata); return 0; @@ -922,7 +924,7 @@ dht_file_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postbuf, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = -1; local = frame->local; @@ -932,7 +934,7 @@ dht_file_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret == -1) && !dht_inode_missing(op_errno)) { gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto out; } @@ -1001,15 +1003,15 @@ dht_setattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) local->call_cnt = 2; /* This is the second attempt */ if (local->fop == GF_FOP_SETATTR) { - STACK_WIND (frame, dht_file_setattr_cbk, subvol, - subvol->fops->setattr, &local->loc, - &local->rebalance.stbuf, local->rebalance.flags, - NULL); + STACK_WIND_COOKIE (frame, dht_file_setattr_cbk, subvol, + subvol, subvol->fops->setattr, &local->loc, + &local->rebalance.stbuf, local->rebalance.flags, + NULL); } else { - STACK_WIND (frame, dht_file_setattr_cbk, subvol, - subvol->fops->fsetattr, local->fd, - &local->rebalance.stbuf, local->rebalance.flags, - NULL); + STACK_WIND_COOKIE (frame, dht_file_setattr_cbk, subvol, + subvol, subvol->fops->fsetattr, local->fd, + &local->rebalance.stbuf, local->rebalance.flags, + NULL); } return 0; @@ -1028,7 +1030,7 @@ dht_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; local = frame->local; @@ -1040,12 +1042,12 @@ dht_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; gf_msg_debug (this->name, op_errno, "subvolume %s returned -1", - prev->this->name); + prev->name); goto unlock; } - dht_iatt_merge (this, &local->prebuf, statpre, prev->this); - dht_iatt_merge (this, &local->stbuf, statpost, prev->this); + dht_iatt_merge (this, &local->prebuf, statpre, prev); + dht_iatt_merge (this, &local->stbuf, statpost, prev); local->op_ret = 0; } @@ -1111,9 +1113,9 @@ dht_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, local->call_cnt = 1; subvol = local->cached_subvol; - STACK_WIND (frame, dht_file_setattr_cbk, subvol, - subvol->fops->setattr, - loc, stbuf, valid, xdata); + STACK_WIND_COOKIE (frame, dht_file_setattr_cbk, subvol, + subvol, subvol->fops->setattr, loc, stbuf, + valid, xdata); return 0; } @@ -1121,10 +1123,11 @@ dht_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, local->call_cnt = call_cnt = layout->cnt; for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_setattr_cbk, - layout->list[i].xlator, - layout->list[i].xlator->fops->setattr, - loc, stbuf, valid, xdata); + STACK_WIND_COOKIE (frame, dht_setattr_cbk, + layout->list[i].xlator, + layout->list[i].xlator, + layout->list[i].xlator->fops->setattr, + loc, stbuf, valid, xdata); } return 0; @@ -1182,9 +1185,9 @@ dht_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf, local->call_cnt = 1; subvol = local->cached_subvol; - STACK_WIND (frame, dht_file_setattr_cbk, subvol, - subvol->fops->fsetattr, - fd, stbuf, valid, xdata); + STACK_WIND_COOKIE (frame, dht_file_setattr_cbk, subvol, + subvol, subvol->fops->fsetattr, fd, stbuf, + valid, xdata); return 0; } @@ -1192,10 +1195,11 @@ dht_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf, local->call_cnt = call_cnt = layout->cnt; for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_setattr_cbk, - layout->list[i].xlator, - layout->list[i].xlator->fops->fsetattr, - fd, stbuf, valid, xdata); + STACK_WIND_COOKIE (frame, dht_setattr_cbk, + layout->list[i].xlator, + layout->list[i].xlator, + layout->list[i].xlator->fops->fsetattr, + fd, stbuf, valid, xdata); } return 0; diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c index deba2138672..355d8302ac2 100644 --- a/xlators/cluster/dht/src/dht-linkfile.c +++ b/xlators/cluster/dht/src/dht-linkfile.c @@ -24,7 +24,7 @@ dht_linkfile_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, char is_linkfile = 0; dht_conf_t *conf = NULL; dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; char gfid[GF_UUID_BUF_SIZE] = {0}; local = frame->local; @@ -42,7 +42,7 @@ dht_linkfile_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg (this->name, GF_LOG_WARNING, 0, DHT_MSG_NOT_LINK_FILE_ERROR, "got non-linkfile %s:%s, gfid = %s", - prev->this->name, local->loc.path, gfid); + prev->name, local->loc.path, gfid); out: local->linkfile.linkfile_cbk (frame, cookie, this, op_ret, op_errno, inode, stbuf, postparent, postparent, @@ -59,7 +59,6 @@ dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; xlator_t *subvol = NULL; - call_frame_t *prev = NULL; dict_t *xattrs = NULL; dht_conf_t *conf = NULL; int ret = -1; @@ -73,8 +72,7 @@ dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret && (op_errno == EEXIST)) { conf = this->private; - prev = cookie; - subvol = prev->this; + subvol = cookie; if (!subvol) goto out; xattrs = dict_new (); @@ -89,8 +87,9 @@ dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto out; } - STACK_WIND (frame, dht_linkfile_lookup_cbk, subvol, - subvol->fops->lookup, &local->loc, xattrs); + STACK_WIND_COOKIE (frame, dht_linkfile_lookup_cbk, subvol, + subvol, subvol->fops->lookup, &local->loc, + xattrs); if (xattrs) dict_unref (xattrs); return 0; @@ -167,16 +166,16 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk, /* Always create as root:root. dht_linkfile_attr_heal fixes the * ownsership */ FRAME_SU_DO (frame, dht_local_t); - STACK_WIND (frame, dht_linkfile_create_cbk, - fromvol, fromvol->fops->mknod, loc, - S_IFREG | DHT_LINKFILE_MODE, 0, 0, dict); + STACK_WIND_COOKIE (frame, dht_linkfile_create_cbk, fromvol, fromvol, + fromvol->fops->mknod, loc, + S_IFREG | DHT_LINKFILE_MODE, 0, 0, dict); if (need_unref && dict) dict_unref (dict); return 0; out: - local->linkfile.linkfile_cbk (frame, NULL, frame->this, -1, ENOMEM, + local->linkfile.linkfile_cbk (frame, frame->this, frame->this, -1, ENOMEM, loc->inode, NULL, NULL, NULL, NULL); if (need_unref && dict) @@ -193,13 +192,11 @@ dht_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; xlator_t *subvol = NULL; char gfid[GF_UUID_BUF_SIZE] = {0}; local = frame->local; - prev = cookie; - subvol = prev->this; + subvol = cookie; if (op_ret == -1) { @@ -238,9 +235,9 @@ dht_linkfile_unlink (call_frame_t *frame, xlator_t *this, goto err; } - STACK_WIND (unlink_frame, dht_linkfile_unlink_cbk, - subvol, subvol->fops->unlink, - &unlink_local->loc, 0, NULL); + STACK_WIND_COOKIE (unlink_frame, dht_linkfile_unlink_cbk, subvol, + subvol, subvol->fops->unlink, + &unlink_local->loc, 0, NULL); return 0; err: diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index d955ee411eb..7e7e7151af7 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -27,7 +27,7 @@ dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; char gfid[GF_UUID_BUF_SIZE] = {0}; local = frame->local; @@ -42,7 +42,7 @@ dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, DHT_MSG_RENAME_FAILED, "Rename %s -> %s on %s failed, (gfid = %s)", local->loc.path, local->loc2.path, - prev->this->name, gfid); + prev->name, gfid); local->op_ret = op_ret; local->op_errno = op_errno; @@ -53,15 +53,11 @@ dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * FIXME: is this the correct way to build stbuf and * parent bufs? */ - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); - dht_iatt_merge (this, &local->preoldparent, preoldparent, - prev->this); - dht_iatt_merge (this, &local->postoldparent, postoldparent, - prev->this); - dht_iatt_merge (this, &local->preparent, prenewparent, - prev->this); - dht_iatt_merge (this, &local->postparent, postnewparent, - prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev); + dht_iatt_merge (this, &local->preoldparent, preoldparent, prev); + dht_iatt_merge (this, &local->postoldparent, postoldparent, prev); + dht_iatt_merge (this, &local->preparent, prenewparent, prev); + dht_iatt_merge (this, &local->postparent, postnewparent, prev); unwind: @@ -90,7 +86,7 @@ dht_rename_hashed_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dht_conf_t *conf = NULL; dht_local_t *local = NULL; int call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int i = 0; char gfid[GF_UUID_BUF_SIZE] = {0}; @@ -108,7 +104,7 @@ dht_rename_hashed_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, DHT_MSG_RENAME_FAILED, "rename %s -> %s on %s failed, (gfid = %s) ", local->loc.path, local->loc2.path, - prev->this->name, gfid ); + prev->name, gfid); local->op_ret = op_ret; local->op_errno = op_errno; @@ -119,15 +115,11 @@ dht_rename_hashed_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * FIXME: is this the correct way to build stbuf and * parent bufs? */ - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); - dht_iatt_merge (this, &local->preoldparent, preoldparent, - prev->this); - dht_iatt_merge (this, &local->postoldparent, postoldparent, - prev->this); - dht_iatt_merge (this, &local->preparent, prenewparent, - prev->this); - dht_iatt_merge (this, &local->postparent, postnewparent, - prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev); + dht_iatt_merge (this, &local->preoldparent, preoldparent, prev); + dht_iatt_merge (this, &local->postoldparent, postoldparent, prev); + dht_iatt_merge (this, &local->preparent, prenewparent, prev); + dht_iatt_merge (this, &local->postparent, postnewparent, prev); call_cnt = local->call_cnt = conf->subvolume_cnt - 1; @@ -137,10 +129,11 @@ dht_rename_hashed_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, for (i = 0; i < conf->subvolume_cnt; i++) { if (conf->subvolumes[i] == local->dst_hashed) continue; - STACK_WIND (frame, dht_rename_dir_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->rename, - &local->loc, &local->loc2, NULL); + STACK_WIND_COOKIE (frame, dht_rename_dir_cbk, + conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->rename, + &local->loc, &local->loc2, NULL); if (!--call_cnt) break; } @@ -170,10 +163,10 @@ dht_rename_dir_do (call_frame_t *frame, xlator_t *this) local->op_ret = 0; - STACK_WIND (frame, dht_rename_hashed_dir_cbk, - local->dst_hashed, - local->dst_hashed->fops->rename, - &local->loc, &local->loc2, NULL); + STACK_WIND_COOKIE (frame, dht_rename_hashed_dir_cbk, local->dst_hashed, + local->dst_hashed, + local->dst_hashed->fops->rename, + &local->loc, &local->loc2, NULL); return 0; err: @@ -189,7 +182,7 @@ dht_rename_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = -1; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; local = frame->local; prev = cookie; @@ -197,7 +190,7 @@ dht_rename_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret > 2) { gf_msg_trace (this->name, 0, "readdir on %s for %s returned %d entries", - prev->this->name, local->loc.path, op_ret); + prev->name, local->loc.path, op_ret); local->op_ret = -1; local->op_errno = ENOTEMPTY; } @@ -218,7 +211,7 @@ dht_rename_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = -1; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; char gfid[GF_UUID_BUF_SIZE] = {0}; local = frame->local; @@ -231,14 +224,13 @@ dht_rename_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg (this->name, GF_LOG_INFO, op_errno, DHT_MSG_OPENDIR_FAILED, "opendir on %s for %s failed,(gfid = %s) ", - prev->this->name, local->loc.path, gfid); + prev->name, local->loc.path, gfid); goto err; } fd_bind (fd); - STACK_WIND (frame, dht_rename_readdir_cbk, - prev->this, prev->this->fops->readdir, - local->fd, 4096, 0, NULL); + STACK_WIND_COOKIE (frame, dht_rename_readdir_cbk, prev, prev, + prev->fops->readdir, local->fd, 4096, 0, NULL); return 0; @@ -299,10 +291,11 @@ dht_rename_dir_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } for (i = 0; i < conf->subvolume_cnt; i++) { - STACK_WIND (frame, dht_rename_opendir_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->opendir, - &local->loc2, local->fd, NULL); + STACK_WIND_COOKIE (frame, dht_rename_opendir_cbk, + conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->opendir, + &local->loc2, local->fd, NULL); } return 0; @@ -631,7 +624,7 @@ dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postparent, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int this_call_cnt = 0; local = frame->local; @@ -651,7 +644,7 @@ dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg (this->name, GF_LOG_WARNING, op_errno, DHT_MSG_UNLINK_FAILED, "%s: Rename: unlink on %s failed ", - local->loc.path, prev->this->name); + local->loc.path, prev->name); } WIPE (&local->preoldparent); @@ -725,9 +718,9 @@ dht_rename_cleanup (call_frame_t *frame) DHT_MARKER_DONT_ACCOUNT(xattr_new); FRAME_SU_DO (frame, dht_local_t); - STACK_WIND (frame, dht_rename_unlink_cbk, - dst_hashed, dst_hashed->fops->unlink, - &local->loc, 0, xattr_new); + STACK_WIND_COOKIE (frame, dht_rename_unlink_cbk, dst_hashed, + dst_hashed, dst_hashed->fops->unlink, + &local->loc, 0, xattr_new); dict_unref (xattr_new); xattr_new = NULL; @@ -753,9 +746,9 @@ dht_rename_cleanup (call_frame_t *frame) * it will fail. */ FRAME_SU_DO (frame, dht_local_t); - STACK_WIND (frame, dht_rename_unlink_cbk, - src_cached, src_cached->fops->unlink, - &local->loc2, 0, xattr_new); + STACK_WIND_COOKIE (frame, dht_rename_unlink_cbk, src_cached, + src_cached, src_cached->fops->unlink, + &local->loc2, 0, xattr_new); dict_unref (xattr_new); xattr_new = NULL; @@ -784,7 +777,7 @@ dht_rename_links_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *preparent, struct iatt *postparent, dict_t *xdata) { - call_frame_t *prev = NULL; + xlator_t *prev = NULL; dht_local_t *local = NULL; prev = cookie; @@ -794,7 +787,7 @@ dht_rename_links_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg (this->name, GF_LOG_WARNING, op_errno, DHT_MSG_CREATE_LINK_FAILED, "link/file %s on %s failed", - local->loc.path, prev->this->name); + local->loc.path, prev->name); } if (local->linked == _gf_true) { @@ -815,7 +808,7 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; xlator_t *src_hashed = NULL; xlator_t *src_cached = NULL; xlator_t *dst_hashed = NULL; @@ -856,11 +849,11 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { /* Critical failure: unable to rename the cached file */ - if (prev->this == src_cached) { + if (prev == src_cached) { gf_msg (this->name, GF_LOG_WARNING, op_errno, DHT_MSG_RENAME_FAILED, "%s: Rename on %s failed, (gfid = %s) ", - local->loc.path, prev->this->name, + local->loc.path, prev->name, local->loc.inode ? uuid_utoa(local->loc.inode->gfid):""); local->op_ret = op_ret; @@ -874,7 +867,7 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, DHT_MSG_RENAME_FAILED, "%s: Rename (linkto file) on %s failed, " "(gfid = %s) ", - local->loc.path, prev->this->name, + local->loc.path, prev->name, local->loc.inode ? uuid_utoa(local->loc.inode->gfid):""); } @@ -913,16 +906,14 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, err: /* Merge attrs only from src_cached. In case there of src_cached != * dst_hashed, this ignores linkfile attrs. */ - if (prev->this == src_cached) { - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + if (prev == src_cached) { + dht_iatt_merge (this, &local->stbuf, stbuf, prev); dht_iatt_merge (this, &local->preoldparent, preoldparent, - prev->this); + prev); dht_iatt_merge (this, &local->postoldparent, postoldparent, - prev->this); - dht_iatt_merge (this, &local->preparent, prenewparent, - prev->this); - dht_iatt_merge (this, &local->postparent, postnewparent, - prev->this); + prev); + dht_iatt_merge (this, &local->preparent, prenewparent, prev); + dht_iatt_merge (this, &local->postparent, postnewparent, prev); } @@ -967,9 +958,9 @@ err: DHT_CHANGELOG_TRACK_AS_RENAME(xattr_new, &local->loc, &local->loc2); - STACK_WIND (frame, dht_rename_unlink_cbk, - src_cached, src_cached->fops->unlink, - &local->loc, 0, xattr_new); + STACK_WIND_COOKIE (frame, dht_rename_unlink_cbk, src_cached, + src_cached, src_cached->fops->unlink, + &local->loc, 0, xattr_new); dict_unref (xattr_new); xattr_new = NULL; @@ -986,9 +977,9 @@ err: DHT_MARKER_DONT_ACCOUNT(xattr_new); - STACK_WIND (frame, dht_rename_unlink_cbk, - src_hashed, src_hashed->fops->unlink, - &local->loc, 0, xattr_new); + STACK_WIND_COOKIE (frame, dht_rename_unlink_cbk, src_hashed, + src_hashed, src_hashed->fops->unlink, + &local->loc, 0, xattr_new); dict_unref (xattr_new); xattr_new = NULL; @@ -1001,9 +992,9 @@ err: "deleting old dst datafile %s @ %s", local->loc2.path, dst_cached->name); - STACK_WIND (frame, dht_rename_unlink_cbk, - dst_cached, dst_cached->fops->unlink, - &local->loc2, 0, xattr); + STACK_WIND_COOKIE (frame, dht_rename_unlink_cbk, dst_cached, + dst_cached, dst_cached->fops->unlink, + &local->loc2, 0, xattr); } if (xattr) dict_unref (xattr); @@ -1063,9 +1054,9 @@ dht_do_rename (call_frame_t *frame) if (local->linked == _gf_true) FRAME_SU_DO (frame, dht_local_t); - STACK_WIND (frame, dht_rename_cbk, - rename_subvol, rename_subvol->fops->rename, - &local->loc, &local->loc2, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_rename_cbk, rename_subvol, rename_subvol, + rename_subvol->fops->rename, &local->loc, + &local->loc2, local->xattr_req); return 0; } @@ -1077,7 +1068,7 @@ dht_rename_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; local = frame->local; prev = cookie; @@ -1085,12 +1076,12 @@ dht_rename_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { gf_msg_debug (this->name, 0, "link/file on %s failed (%s)", - prev->this->name, strerror (op_errno)); + prev->name, strerror (op_errno)); local->op_ret = -1; local->op_errno = op_errno; local->added_link = _gf_false; } else - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev); if (local->op_ret == -1) goto cleanup; @@ -1113,7 +1104,7 @@ dht_rename_linkto_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; xlator_t *src_cached = NULL; dict_t *xattr = NULL; @@ -1125,7 +1116,7 @@ dht_rename_linkto_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { gf_msg_debug (this->name, 0, "link/file on %s failed (%s)", - prev->this->name, strerror (op_errno)); + prev->name, strerror (op_errno)); local->op_ret = -1; local->op_errno = op_errno; } @@ -1146,9 +1137,9 @@ dht_rename_linkto_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->added_link = _gf_true; - STACK_WIND (frame, dht_rename_link_cbk, - src_cached, src_cached->fops->link, - &local->loc, &local->loc2, xattr); + STACK_WIND_COOKIE (frame, dht_rename_link_cbk, src_cached, src_cached, + src_cached->fops->link, &local->loc, &local->loc2, + xattr); if (xattr) dict_unref (xattr); @@ -1171,7 +1162,7 @@ dht_rename_unlink_links_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; local = frame->local; @@ -1180,7 +1171,7 @@ dht_rename_unlink_links_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret == -1) && (op_errno != ENOENT)) { gf_msg_debug (this->name, 0, "unlink of %s on %s failed (%s)", - local->loc2.path, prev->this->name, + local->loc2.path, prev->name, strerror (op_errno)); local->op_ret = -1; local->op_errno = op_errno; @@ -1237,9 +1228,10 @@ dht_rename_create_links (call_frame_t *frame) DHT_MARKER_DONT_ACCOUNT(xattr_new); - STACK_WIND (frame, dht_rename_unlink_links_cbk, - dst_hashed, dst_hashed->fops->unlink, - &local->loc2, 0, xattr_new); + STACK_WIND_COOKIE (frame, dht_rename_unlink_links_cbk, + dst_hashed, dst_hashed, + dst_hashed->fops->unlink, &local->loc2, 0, + xattr_new); dict_unref (xattr_new); if (xattr) @@ -1291,9 +1283,9 @@ dht_rename_create_links (call_frame_t *frame) local->added_link = _gf_true; - STACK_WIND (frame, dht_rename_link_cbk, - src_cached, src_cached->fops->link, - &local->loc, &local->loc2, xattr_new); + STACK_WIND_COOKIE (frame, dht_rename_link_cbk, src_cached, + src_cached, src_cached->fops->link, + &local->loc, &local->loc2, xattr_new); dict_unref (xattr_new); } diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 331878b3608..7fa05a95a53 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -174,7 +174,7 @@ dht_refresh_layout_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; int this_call_cnt = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; dht_layout_t *layout = NULL; GF_VALIDATE_OR_GOTO ("dht", frame, err); @@ -189,16 +189,16 @@ dht_refresh_layout_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - op_ret = dht_layout_merge (this, layout, prev->this, + op_ret = dht_layout_merge (this, layout, prev, op_ret, op_errno, xattr); - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev); if (op_ret == -1) { local->op_errno = op_errno; gf_msg_debug (this->name, op_errno, "lookup of %s on %s returned error", - local->loc.path, prev->this->name); + local->loc.path, prev->name); goto unlock; } @@ -279,10 +279,10 @@ dht_refresh_layout (call_frame_t *frame) } for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_refresh_layout_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_refresh_layout_cbk, + conf->subvolumes[i], conf->subvolumes[i], + conf->subvolumes[i]->fops->lookup, + &local->loc, local->xattr_req); } return 0; @@ -1139,7 +1139,7 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { dht_local_t *local = NULL; dht_layout_t *layout = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; xlator_t *subvol = NULL; int i = 0, ret = -1; int this_call_cnt = 0; @@ -1148,7 +1148,7 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; layout = local->selfheal.layout; prev = cookie; - subvol = prev->this; + subvol = prev; if ((op_ret == 0) || ((op_ret == -1) && (op_errno == EEXIST))) { for (i = 0; i < layout->cnt; i++) { @@ -1168,8 +1168,8 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->loc.path, gfid ); goto out; } - dht_iatt_merge (this, &local->preparent, preparent, prev->this); - dht_iatt_merge (this, &local->postparent, postparent, prev->this); + dht_iatt_merge (this, &local->preparent, preparent, prev); + dht_iatt_merge (this, &local->postparent, postparent, prev); ret = 0; out: @@ -1277,13 +1277,14 @@ dht_selfheal_dir_mkdir_lookup_done (call_frame_t *frame, xlator_t *this) "Creating directory %s on subvol %s", loc->path, layout->list[i].xlator->name); - STACK_WIND (frame, dht_selfheal_dir_mkdir_cbk, - layout->list[i].xlator, - layout->list[i].xlator->fops->mkdir, - loc, - st_mode_from_ia (local->stbuf.ia_prot, - local->stbuf.ia_type), - 0, dict); + STACK_WIND_COOKIE (frame, dht_selfheal_dir_mkdir_cbk, + layout->list[i].xlator, + layout->list[i].xlator, + layout->list[i].xlator->fops->mkdir, + loc, + st_mode_from_ia (local->stbuf.ia_prot, + local->stbuf.ia_type), + 0, dict); } } @@ -1309,7 +1310,7 @@ dht_selfheal_dir_mkdir_lookup_cbk (call_frame_t *frame, void *cookie, int missing_dirs = 0; dht_layout_t *layout = NULL; loc_t *loc = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; VALIDATE_OR_GOTO (this->private, err); @@ -1329,7 +1330,7 @@ dht_selfheal_dir_mkdir_lookup_cbk (call_frame_t *frame, void *cookie, } if (!op_ret) { - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + dht_iatt_merge (this, &local->stbuf, stbuf, prev); } } @@ -1413,10 +1414,10 @@ dht_selfheal_dir_mkdir_lock_cbk (call_frame_t *frame, void *cookie, */ for (i = 0; i < conf->subvolume_cnt; i++) { - STACK_WIND (frame, dht_selfheal_dir_mkdir_lookup_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->lookup, - &local->loc, NULL); + STACK_WIND_COOKIE (frame, dht_selfheal_dir_mkdir_lookup_cbk, + conf->subvolumes[i], conf->subvolumes[i], + conf->subvolumes[i]->fops->lookup, + &local->loc, NULL); } return 0; diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index 56e17d6e884..afa446584ba 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -28,7 +28,7 @@ nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dht_local_t *local = NULL; loc_t *loc = NULL; int i = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int call_cnt = 0; int ret = 0; @@ -55,11 +55,11 @@ nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!is_dir && !is_linkfile) { /* non-directory and not a linkfile */ - ret = dht_layout_preset (this, prev->this, inode); + ret = dht_layout_preset (this, prev, inode); if (ret < 0) { gf_msg_debug (this->name, 0, "could not set pre-set layout for subvol" - " %s", prev->this->name); + " %s", prev->name); op_ret = -1; op_errno = EINVAL; goto err; @@ -86,10 +86,11 @@ nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_lookup_dir_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_dir_cbk, + conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->lookup, + &local->loc, local->xattr_req); } } @@ -104,9 +105,9 @@ nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, return 0; } - STACK_WIND (frame, dht_lookup_linkfile_cbk, - subvol, subvol->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_linkfile_cbk, subvol, + subvol, subvol->fops->lookup, + &local->loc, local->xattr_req); } return 0; @@ -121,9 +122,10 @@ out: return 0; } - STACK_WIND (frame, dht_lookup_cbk, - local->hashed_subvol, local->hashed_subvol->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_cbk, local->hashed_subvol, + local->hashed_subvol, + local->hashed_subvol->fops->lookup, + &local->loc, local->xattr_req); return 0; @@ -211,9 +213,9 @@ nufa_lookup (call_frame_t *frame, xlator_t *this, for (i = 0; i < layout->cnt; i++) { subvol = layout->list[i].xlator; - STACK_WIND (frame, dht_revalidate_cbk, - subvol, subvol->fops->lookup, - loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_revalidate_cbk, subvol, + subvol, subvol->fops->lookup, + loc, local->xattr_req); if (!--call_cnt) break; @@ -241,10 +243,11 @@ nufa_lookup (call_frame_t *frame, xlator_t *this, } /* Send it to only local volume */ - STACK_WIND (frame, nufa_local_lookup_cbk, - (xlator_t *)conf->private, - ((xlator_t *)conf->private)->fops->lookup, - loc, local->xattr_req); + STACK_WIND_COOKIE (frame, nufa_local_lookup_cbk, + ((xlator_t *)conf->private), + ((xlator_t *)conf->private), + ((xlator_t *)conf->private)->fops->lookup, + loc, local->xattr_req); } return 0; @@ -270,10 +273,10 @@ nufa_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, if (op_ret == -1) goto err; - STACK_WIND (frame, dht_create_cbk, - local->cached_subvol, local->cached_subvol->fops->create, - &local->loc, local->flags, local->mode, local->umask, - local->fd, local->params); + STACK_WIND_COOKIE (frame, dht_create_cbk, local->cached_subvol, + local->cached_subvol, local->cached_subvol->fops->create, + &local->loc, local->flags, local->mode, local->umask, + local->fd, local->params); return 0; @@ -340,9 +343,9 @@ nufa_create (call_frame_t *frame, xlator_t *this, gf_msg_trace (this->name, 0, "creating %s on %s", loc->path, subvol->name); - STACK_WIND (frame, dht_create_cbk, - subvol, subvol->fops->create, - loc, flags, mode, umask, fd, params); + STACK_WIND_COOKIE (frame, dht_create_cbk, subvol, + subvol, subvol->fops->create, + loc, flags, mode, umask, fd, params); return 0; diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c index f1e9a399442..9795ff4af4d 100644 --- a/xlators/cluster/dht/src/switch.c +++ b/xlators/cluster/dht/src/switch.c @@ -111,7 +111,7 @@ switch_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dht_local_t *local = NULL; loc_t *loc = NULL; int i = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int call_cnt = 0; int ret = 0; @@ -139,12 +139,12 @@ switch_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!is_dir && !is_linkfile) { /* non-directory and not a linkfile */ - ret = dht_layout_preset (this, prev->this, inode); + ret = dht_layout_preset (this, prev, inode); if (ret < 0) { gf_msg_debug (this->name, 0, "could not set pre-set layout " "for subvol %s", - prev->this->name); + prev->name); op_ret = -1; op_errno = EINVAL; goto err; @@ -173,10 +173,11 @@ switch_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_lookup_dir_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_dir_cbk, + conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->lookup, + &local->loc, local->xattr_req); } } @@ -191,9 +192,9 @@ switch_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, return 0; } - STACK_WIND (frame, dht_lookup_linkfile_cbk, - subvol, subvol->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_linkfile_cbk, subvol, + subvol, subvol->fops->lookup, + &local->loc, local->xattr_req); } return 0; @@ -208,9 +209,10 @@ out: return 0; } - STACK_WIND (frame, dht_lookup_cbk, - local->hashed_subvol, local->hashed_subvol->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_cbk, local->hashed_subvol, + local->hashed_subvol, + local->hashed_subvol->fops->lookup, + &local->loc, local->xattr_req); return 0; @@ -298,9 +300,9 @@ switch_lookup (call_frame_t *frame, xlator_t *this, for (i = 0; i < layout->cnt; i++) { subvol = layout->list[i].xlator; - STACK_WIND (frame, dht_revalidate_cbk, - subvol, subvol->fops->lookup, - loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_revalidate_cbk, subvol, + subvol, subvol->fops->lookup, + loc, local->xattr_req); if (!--call_cnt) break; @@ -339,10 +341,11 @@ switch_lookup (call_frame_t *frame, xlator_t *this, } for (i = 0; i < call_cnt; i++) { - STACK_WIND (frame, dht_lookup_dir_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->lookup, - &local->loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_dir_cbk, + conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->lookup, + &local->loc, local->xattr_req); } return 0; } @@ -351,15 +354,15 @@ switch_lookup (call_frame_t *frame, xlator_t *this, cached_subvol = get_switch_matching_subvol (loc->path, conf, hashed_subvol); if (cached_subvol == hashed_subvol) { - STACK_WIND (frame, dht_lookup_cbk, - hashed_subvol, - hashed_subvol->fops->lookup, - loc, local->xattr_req); + STACK_WIND_COOKIE (frame, dht_lookup_cbk, hashed_subvol, + hashed_subvol, + hashed_subvol->fops->lookup, + loc, local->xattr_req); } else { - STACK_WIND (frame, switch_local_lookup_cbk, - cached_subvol, - cached_subvol->fops->lookup, - loc, local->xattr_req); + STACK_WIND_COOKIE (frame, switch_local_lookup_cbk, + cached_subvol, cached_subvol, + cached_subvol->fops->lookup, + loc, local->xattr_req); } } @@ -386,10 +389,10 @@ switch_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, if (op_ret == -1) goto err; - STACK_WIND (frame, dht_create_cbk, - local->cached_subvol, local->cached_subvol->fops->create, - &local->loc, local->flags, local->mode, local->umask, - local->fd, local->params); + STACK_WIND_COOKIE (frame, dht_create_cbk, local->cached_subvol, + local->cached_subvol, local->cached_subvol->fops->create, + &local->loc, local->flags, local->mode, local->umask, + local->fd, local->params); return 0; @@ -454,9 +457,9 @@ switch_create (call_frame_t *frame, xlator_t *this, gf_msg_trace (this->name, 0, "creating %s on %s", loc->path, subvol->name); - STACK_WIND (frame, dht_create_cbk, - subvol, subvol->fops->create, - loc, flags, mode, umask, fd, params); + STACK_WIND_COOKIE (frame, dht_create_cbk, subvol, subvol, + subvol->fops->create, loc, flags, mode, umask, fd, + params); return 0; diff --git a/xlators/cluster/dht/src/tier-common.c b/xlators/cluster/dht/src/tier-common.c index f7ccbc014c6..b2f3db28f48 100644 --- a/xlators/cluster/dht/src/tier-common.c +++ b/xlators/cluster/dht/src/tier-common.c @@ -167,7 +167,7 @@ tier_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, fd_t *fd, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, struct iatt *postparent, dict_t *xdata) { - call_frame_t *prev = NULL; + xlator_t *prev = NULL; int ret = -1; dht_local_t *local = NULL; xlator_t *hashed_subvol = NULL; @@ -218,11 +218,11 @@ tier_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, postparent, 1); } - ret = dht_layout_preset (this, prev->this, inode); + ret = dht_layout_preset (this, prev, inode); if (ret != 0) { gf_msg_debug (this->name, 0, "could not set preset layout for subvol %s", - prev->this->name); + prev->name); op_ret = -1; op_errno = EINVAL; goto out; @@ -356,10 +356,10 @@ tier_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, " : key = %s", TIER_LINKFILE_GFID); } - STACK_WIND (frame, tier_create_cbk, - cached_subvol, cached_subvol->fops->create, - &local->loc, local->flags, local->mode, - local->umask, local->fd, local->params); + STACK_WIND_COOKIE (frame, tier_create_cbk, cached_subvol, + cached_subvol, cached_subvol->fops->create, + &local->loc, local->flags, local->mode, + local->umask, local->fd, local->params); return 0; err: @@ -431,9 +431,9 @@ tier_create (call_frame_t *frame, xlator_t *this, "creating %s on %s", loc->path, cold_subvol->name); - STACK_WIND (frame, tier_create_cbk, - cold_subvol, cold_subvol->fops->create, - loc, flags, mode, umask, fd, params); + STACK_WIND_COOKIE (frame, tier_create_cbk, cold_subvol, + cold_subvol, cold_subvol->fops->create, + loc, flags, mode, umask, fd, params); } else { local->params = dict_ref (params); local->flags = flags; @@ -470,7 +470,7 @@ tier_unlink_nonhashed_linkfile_cbk (call_frame_t *frame, void *cookie, struct iatt *postparent, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; local = frame->local; prev = cookie; @@ -483,7 +483,7 @@ tier_unlink_nonhashed_linkfile_cbk (call_frame_t *frame, void *cookie, gf_msg_debug (this->name, op_errno, "Unlink link: subvolume %s" " returned -1", - prev->this->name); + prev->name); goto unlock; } @@ -513,7 +513,7 @@ tier_unlink_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postparent) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; dht_conf_t *conf = NULL; xlator_t *hot_subvol = NULL; @@ -526,9 +526,9 @@ tier_unlink_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, /* * linkfile present on hot tier. unlinking the linkfile */ - STACK_WIND (frame, tier_unlink_nonhashed_linkfile_cbk, - hot_subvol, hot_subvol->fops->unlink, - &local->loc, local->flags, NULL); + STACK_WIND_COOKIE (frame, tier_unlink_nonhashed_linkfile_cbk, + hot_subvol, hot_subvol, hot_subvol->fops->unlink, + &local->loc, local->flags, NULL); return 0; } @@ -543,7 +543,7 @@ tier_unlink_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } gf_msg_debug (this->name, op_errno, "Lookup : subvolume %s returned -1", - prev->this->name); + prev->name); } UNLOCK (&frame->lock); @@ -560,7 +560,7 @@ tier_unlink_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postparent, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; local = frame->local; prev = cookie; @@ -576,7 +576,7 @@ tier_unlink_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg_debug (this->name, op_errno, "Unlink link: subvolume %s" " returned -1", - prev->this->name); + prev->name); goto unlock; } @@ -605,7 +605,7 @@ tier_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postparent, dict_t *xdata) { dht_local_t *local = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; struct iatt *stbuf = NULL; dht_conf_t *conf = NULL; int ret = -1; @@ -631,7 +631,7 @@ tier_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg_debug (this->name, op_errno, "Unlink: subvolume %s returned -1" " with errno = %d", - prev->this->name, op_errno); + prev->name, op_errno); goto unlock; } @@ -659,10 +659,10 @@ unlock: * a link file on cold tier, deleting the linkfile * from cold tier */ - STACK_WIND (frame, tier_unlink_linkfile_cbk, - cold_tier, - cold_tier->fops->unlink, &local->loc, - local->flags, xdata); + STACK_WIND_COOKIE (frame, tier_unlink_linkfile_cbk, cold_tier, + cold_tier, cold_tier->fops->unlink, + &local->loc, + local->flags, xdata); return 0; } @@ -673,10 +673,9 @@ unlock: * File is migrating from cold to hot tier. * Delete the destination linkfile. */ - STACK_WIND (frame, tier_unlink_lookup_cbk, - hot_tier, - hot_tier->fops->lookup, - &local->loc, NULL); + STACK_WIND_COOKIE (frame, tier_unlink_lookup_cbk, hot_tier, + hot_tier, hot_tier->fops->lookup, + &local->loc, NULL); return 0; } @@ -750,9 +749,9 @@ tier_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, * File is on hot tier, delete the data file first, then * linkfile from cold. */ - STACK_WIND (frame, tier_unlink_cbk, - cached_subvol, cached_subvol->fops->unlink, loc, - xflag, xdata); + STACK_WIND_COOKIE (frame, tier_unlink_cbk, cached_subvol, + cached_subvol, cached_subvol->fops->unlink, loc, + xflag, xdata); if (xdata) dict_unref (xdata); return 0; @@ -772,7 +771,7 @@ tier_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_dirent_t entries; gf_dirent_t *orig_entry = NULL; gf_dirent_t *entry = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; xlator_t *next_subvol = NULL; off_t next_offset = 0; int count = 0; @@ -811,14 +810,14 @@ done: EOF is not yet hit on the current subvol */ if (next_offset != 0) { - next_subvol = prev->this; + next_subvol = prev; } else { goto unwind; } - STACK_WIND (frame, tier_readdir_cbk, - next_subvol, next_subvol->fops->readdir, - local->fd, local->size, next_offset, NULL); + STACK_WIND_COOKIE (frame, tier_readdir_cbk, next_subvol, + next_subvol, next_subvol->fops->readdir, + local->fd, local->size, next_offset, NULL); return 0; } @@ -841,7 +840,7 @@ tier_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret gf_dirent_t entries; gf_dirent_t *orig_entry = NULL; gf_dirent_t *entry = NULL; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; xlator_t *next_subvol = NULL; off_t next_offset = 0; int count = 0; @@ -911,7 +910,7 @@ tier_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret } } else { if (orig_entry->inode) { - ret = dht_layout_preset (this, prev->this, + ret = dht_layout_preset (this, prev, orig_entry->inode); if (ret) gf_msg (this->name, GF_LOG_WARNING, 0, @@ -957,15 +956,15 @@ done: EOF is not yet hit on the current subvol */ if (next_offset != 0) { - next_subvol = prev->this; + next_subvol = prev; } else { goto unwind; } - STACK_WIND (frame, tier_readdirp_cbk, - next_subvol, next_subvol->fops->readdirp, - local->fd, local->size, next_offset, - local->xattr); + STACK_WIND_COOKIE (frame, tier_readdirp_cbk, next_subvol, + next_subvol, next_subvol->fops->readdirp, + local->fd, local->size, next_offset, + local->xattr); return 0; } @@ -1029,14 +1028,14 @@ tier_do_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, } - STACK_WIND (frame, tier_readdirp_cbk, hashed_subvol, - hashed_subvol->fops->readdirp, - fd, size, yoff, local->xattr); + STACK_WIND_COOKIE (frame, tier_readdirp_cbk, hashed_subvol, + hashed_subvol, hashed_subvol->fops->readdirp, + fd, size, yoff, local->xattr); } else { - STACK_WIND (frame, tier_readdir_cbk, hashed_subvol, - hashed_subvol->fops->readdir, - fd, size, yoff, local->xattr); + STACK_WIND_COOKIE (frame, tier_readdir_cbk, hashed_subvol, + hashed_subvol, hashed_subvol->fops->readdir, + fd, size, yoff, local->xattr); } return 0; @@ -1097,7 +1096,7 @@ tier_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, GF_UNUSED int ret = 0; unsigned long new_usage = 0; unsigned long cur_usage = 0; - call_frame_t *prev = NULL; + xlator_t *prev = NULL; dht_conf_t *conf = NULL; tier_statvfs_t *tier_stat = NULL; @@ -1185,7 +1184,7 @@ tier_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->statvfs.f_frsize = statvfs->f_frsize; } - if (prev->this == TIER_HASHED_SUBVOL) { + if (prev == TIER_HASHED_SUBVOL) { local->statvfs.f_blocks = statvfs->f_blocks; local->statvfs.f_files = statvfs->f_files; local->statvfs.f_fsid = statvfs->f_fsid; @@ -1280,10 +1279,10 @@ tier_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) local->call_cnt = conf->subvolume_cnt; for (i = 0; i < conf->subvolume_cnt; i++) { - STACK_WIND (frame, tier_statfs_cbk, - conf->subvolumes[i], - conf->subvolumes[i]->fops->statfs, loc, - xdata); + STACK_WIND_COOKIE (frame, tier_statfs_cbk, conf->subvolumes[i], + conf->subvolumes[i], + conf->subvolumes[i]->fops->statfs, loc, + xdata); } return 0; |