diff options
author | Anand Avati <avati@gluster.com> | 2010-09-03 14:00:05 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-04 01:45:25 -0700 |
commit | a7fd7dbed9b995c173664bcadf3d2e5b6131e4ea (patch) | |
tree | a4098ccb4a695f10c07c692edfb9da2b2e561a96 | |
parent | 8b9a144414162413a399d59975fe3b7347907f4f (diff) |
gfid: changes in symlink() prototype to have params dictionary with uuid in it
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com>
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 971 (dynamic volume management)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
28 files changed, 77 insertions, 68 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 789b12c9796..7008cfd6f38 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -599,10 +599,8 @@ out: call_stub_t * -fop_symlink_stub (call_frame_t *frame, - fop_symlink_t fn, - const char *linkname, - loc_t *loc) +fop_symlink_stub (call_frame_t *frame, fop_symlink_t fn, + const char *linkname, loc_t *loc, dict_t *params) { call_stub_t *stub = NULL; @@ -616,6 +614,8 @@ fop_symlink_stub (call_frame_t *frame, stub->args.symlink.fn = fn; stub->args.symlink.linkname = gf_strdup (linkname); loc_copy (&stub->args.symlink.loc, loc); + if (params) + stub->args.symlink.params = dict_ref (params); out: return stub; } @@ -2189,7 +2189,8 @@ call_resume_wind (call_stub_t *stub) stub->args.symlink.fn (stub->frame, stub->frame->this, stub->args.symlink.linkname, - &stub->args.symlink.loc); + &stub->args.symlink.loc, + stub->args.symlink.params); } break; @@ -3362,6 +3363,8 @@ call_stub_destroy_wind (call_stub_t *stub) { GF_FREE ((char *)stub->args.symlink.linkname); loc_wipe (&stub->args.symlink.loc); + if (stub->args.symlink.params) + dict_unref (stub->args.symlink.params); } break; diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 7c67b18e514..83efa9a4857 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -186,6 +186,7 @@ typedef struct { fop_symlink_t fn; const char *linkname; loc_t loc; + dict_t *params; } symlink; struct { fop_symlink_cbk_t fn; @@ -727,10 +728,8 @@ fop_rmdir_cbk_stub (call_frame_t *frame, struct iatt *postparent); call_stub_t * -fop_symlink_stub (call_frame_t *frame, - fop_symlink_t fn, - const char *linkname, - loc_t *loc); +fop_symlink_stub (call_frame_t *frame, fop_symlink_t fn, + const char *linkname, loc_t *loc, dict_t *params); call_stub_t * fop_symlink_cbk_stub (call_frame_t *frame, diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index 3224e730405..628130a0946 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -370,17 +370,15 @@ default_symlink_cbk (call_frame_t *frame, return 0; } -int32_t -default_symlink (call_frame_t *frame, - xlator_t *this, - const char *linkpath, - loc_t *loc) + +int +default_symlink (call_frame_t *frame, xlator_t *this, + const char *linkpath, loc_t *loc, dict_t *params) { - STACK_WIND (frame, - default_symlink_cbk, + STACK_WIND (frame, default_symlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink, - linkpath, loc); + linkpath, loc, params); return 0; } diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index f58d55e1a73..a1177cb6c52 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -96,10 +96,8 @@ int32_t default_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc); -int32_t default_symlink (call_frame_t *frame, - xlator_t *this, - const char *linkpath, - loc_t *loc); +int32_t default_symlink (call_frame_t *frame, xlator_t *this, + const char *linkpath, loc_t *loc, dict_t *params); int32_t default_rename (call_frame_t *frame, xlator_t *this, diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index 84839418374..c71aa7bb3cc 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -458,10 +458,9 @@ typedef int32_t (*fop_rmdir_t) (call_frame_t *frame, xlator_t *this, loc_t *loc); -typedef int32_t (*fop_symlink_t) (call_frame_t *frame, - xlator_t *this, - const char *linkname, - loc_t *loc); +typedef int32_t (*fop_symlink_t) (call_frame_t *frame, xlator_t *this, + const char *linkname, loc_t *loc, + dict_t *params); typedef int32_t (*fop_rename_t) (call_frame_t *frame, xlator_t *this, diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index e5330b4e468..d536b45547a 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -405,6 +405,11 @@ afr_local_cleanup (afr_local_t *local, xlator_t *this) dict_unref (local->cont.mkdir.params); } + { /* symlink */ + if (local->cont.symlink.params) + dict_unref (local->cont.symlink.params); + } + { /* writev */ GF_FREE (local->cont.writev.vector); } diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 70da6f94955..5d5bf40e06a 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -1253,7 +1253,8 @@ afr_symlink_wind (call_frame_t *frame, xlator_t *this) priv->children[i], priv->children[i]->fops->symlink, local->cont.symlink.linkpath, - &local->loc); + &local->loc, + local->cont.symlink.params); if (!--call_count) break; @@ -1280,7 +1281,7 @@ afr_symlink_done (call_frame_t *frame, xlator_t *this) int afr_symlink (call_frame_t *frame, xlator_t *this, - const char *linkpath, loc_t *loc) + const char *linkpath, loc_t *loc, dict_t *params) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -1324,6 +1325,8 @@ afr_symlink (call_frame_t *frame, xlator_t *this, UNLOCK (&priv->read_child_lock); local->cont.symlink.linkpath = gf_strdup (linkpath); + if (params) + local->cont.symlink.params = dict_ref (params); if (loc->parent) local->cont.symlink.parent_ino = loc->parent->ino; diff --git a/xlators/cluster/afr/src/afr-dir-write.h b/xlators/cluster/afr/src/afr-dir-write.h index 878e1e714cf..e2ed8c759d0 100644 --- a/xlators/cluster/afr/src/afr-dir-write.h +++ b/xlators/cluster/afr/src/afr-dir-write.h @@ -49,9 +49,9 @@ int32_t afr_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc); -int32_t +int afr_symlink (call_frame_t *frame, xlator_t *this, - const char *linkpath, loc_t *oldloc); + const char *linkpath, loc_t *oldloc, dict_t *params); int32_t afr_setdents (call_frame_t *frame, xlator_t *this, diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index fda879d3cb2..0e25be6944f 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -1115,7 +1115,7 @@ sh_missing_entries_symlink (call_frame_t *frame, xlator_t *this, (void *) (long) i, priv->children[i], priv->children[i]->fops->symlink, - link, &local->loc); + link, &local->loc, NULL); if (!--call_count) break; } diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index 140795bdd7f..af6c0c68916 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -1341,7 +1341,7 @@ afr_sh_entry_impunge_symlink (call_frame_t *impunge_frame, xlator_t *this, (void *) (long) child_index, priv->children[child_index], priv->children[child_index]->fops->symlink, - linkname, &impunge_local->loc); + linkname, &impunge_local->loc, NULL); return 0; } diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 85f66c8255c..af3e7f204a2 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -561,6 +561,7 @@ typedef struct _afr_local { uint64_t gen; ino_t parent_ino; inode_t *inode; + dict_t *params; struct iatt buf; struct iatt read_child_buf; char *linkpath; diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 0da8ad73eef..24430e6bcb4 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2901,7 +2901,7 @@ err: int dht_symlink (call_frame_t *frame, xlator_t *this, - const char *linkname, loc_t *loc) + const char *linkname, loc_t *loc, dict_t *params) { xlator_t *subvol = NULL; int op_errno = -1; @@ -2942,7 +2942,7 @@ dht_symlink (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, dht_newfile_cbk, subvol, subvol->fops->symlink, - linkname, loc); + linkname, loc, params); return 0; diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index e7ed8c6a850..095b077b48e 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -847,7 +847,7 @@ error_gen_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int error_gen_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, - loc_t *loc) + loc_t *loc, dict_t *params) { int op_errno = 0; eg_t *egp = NULL; @@ -869,7 +869,7 @@ error_gen_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, STACK_WIND (frame, error_gen_symlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink, - linkpath, loc); + linkpath, loc, params); return 0; } diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index b283bd7b4bc..ee0e9336512 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -927,14 +927,14 @@ io_stats_rmdir (call_frame_t *frame, xlator_t *this, int io_stats_symlink (call_frame_t *frame, xlator_t *this, - const char *linkpath, loc_t *loc) + const char *linkpath, loc_t *loc, dict_t *params) { BUMP_FOP (SYMLINK); STACK_WIND (frame, io_stats_symlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink, - linkpath, loc); + linkpath, loc, params); return 0; } diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index 7b5164c8439..f3f2fe2e185 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -1404,7 +1404,7 @@ trace_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) int trace_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, - loc_t *loc) + loc_t *loc, dict_t *params) { if (trace_fop_names[GF_FOP_SYMLINK].enabled) { gf_log (this->name, GF_LOG_NORMAL, @@ -1416,7 +1416,7 @@ trace_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, STACK_WIND (frame, trace_symlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink, - linkpath, loc); + linkpath, loc, params); return 0; } diff --git a/xlators/features/access-control/src/access-control.c b/xlators/features/access-control/src/access-control.c index 159debb3f01..b659a013309 100644 --- a/xlators/features/access-control/src/access-control.c +++ b/xlators/features/access-control/src/access-control.c @@ -867,10 +867,10 @@ out: int32_t ac_symlink_resume (call_frame_t *frame, xlator_t *this, const char *linkname, - loc_t *loc) + loc_t *loc, dict_t *params) { STACK_WIND (frame, default_symlink_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->symlink, linkname, loc); + FIRST_CHILD(this)->fops->symlink, linkname, loc, params); return 0; } @@ -906,15 +906,16 @@ out: } -int32_t +int ac_symlink (call_frame_t *frame, xlator_t *this, const char *linkname, - loc_t *loc) + loc_t *loc, dict_t *params) { call_stub_t *stub = NULL; int ret = -EFAULT; loc_t parentloc = {0, }; - stub = fop_symlink_stub (frame, ac_symlink_resume, linkname, loc); + stub = fop_symlink_stub (frame, ac_symlink_resume, linkname, loc, + params); if (!stub) { gf_log (this->name, GF_LOG_ERROR, "cannot create call stub: " "(out of memory)"); diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 002f6b35b51..40cfeb07fcc 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -581,7 +581,7 @@ quota_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int quota_symlink (call_frame_t *frame, xlator_t *this, - const char *linkpath, loc_t *loc) + const char *linkpath, loc_t *loc, dict_t *params) { struct quota_priv *priv = NULL; @@ -608,7 +608,7 @@ quota_symlink (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, quota_symlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink, - linkpath, loc); + linkpath, loc, params); return 0; } diff --git a/xlators/features/read-only/src/read-only.c b/xlators/features/read-only/src/read-only.c index 9ebbdaaba0f..49c2ce58dd1 100644 --- a/xlators/features/read-only/src/read-only.c +++ b/xlators/features/read-only/src/read-only.c @@ -144,9 +144,10 @@ ro_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) return 0; } -int32_t + +int ro_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, - loc_t *loc) + loc_t *loc, dict_t *params) { STACK_UNWIND_STRICT (symlink, frame, -1, EROFS, NULL, NULL, NULL, NULL); return 0; diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 6ff5dafa7a5..069135d57b3 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -1213,7 +1213,7 @@ fuse_symlink_resume (fuse_state_t *state) state->loc.path, state->name); FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_SYMLINK, - symlink, state->name, &state->loc); + symlink, state->name, &state->loc, NULL); } static void diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c index a71e1204a44..544f6c9e6b1 100644 --- a/xlators/nfs/server/src/nfs-fops.c +++ b/xlators/nfs/server/src/nfs-fops.c @@ -748,8 +748,8 @@ nfs_fop_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err); nfs_fop_save_root_ino (nfl, pathloc); - STACK_WIND_COOKIE (frame, nfs_fop_symlink_cbk, xl, xl, - xl->fops->symlink, target, pathloc); + STACK_WIND_COOKIE (frame, nfs_fop_symlink_cbk, xl, xl, + xl->fops->symlink, target, pathloc, NULL); ret = 0; err: if (ret < 0) { diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index a9c596fb944..e2a00fcfadc 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -584,22 +584,23 @@ iot_symlink_cbk (call_frame_t *frame, void * cookie, xlator_t *this, int iot_symlink_wrapper (call_frame_t *frame, xlator_t *this, const char *linkname, - loc_t *loc) + loc_t *loc, dict_t *params) { STACK_WIND (frame, iot_symlink_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->symlink, linkname, loc); + FIRST_CHILD (this)->fops->symlink, linkname, loc, params); return 0; } int iot_symlink (call_frame_t *frame, xlator_t *this, const char *linkname, - loc_t *loc) + loc_t *loc, dict_t *params) { call_stub_t *stub = NULL; int ret = -1; - stub = fop_symlink_stub (frame, iot_symlink_wrapper, linkname, loc); + stub = fop_symlink_stub (frame, iot_symlink_wrapper, linkname, loc, + params); if (!stub) { gf_log (this->name, GF_LOG_ERROR, "cannot create symlink stub" "(out of memory)"); diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index cd784dcf07f..20301cffd07 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -1820,9 +1820,9 @@ out: } -int32_t +int sp_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, - loc_t *loc) + loc_t *loc, dict_t *params) { int32_t ret = -1, op_errno = -1; char need_unwind = 1; @@ -1874,7 +1874,7 @@ out: NULL); } else { STACK_WIND (frame, sp_new_entry_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->symlink, linkpath, loc); + FIRST_CHILD(this)->fops->symlink, linkpath, loc, params); } return 0; diff --git a/xlators/performance/symlink-cache/src/symlink-cache.c b/xlators/performance/symlink-cache/src/symlink-cache.c index 6560c7775c7..0c6eb2b2a2d 100644 --- a/xlators/performance/symlink-cache/src/symlink-cache.c +++ b/xlators/performance/symlink-cache/src/symlink-cache.c @@ -311,14 +311,14 @@ sc_symlink_cbk (call_frame_t *frame, void *cookie, int sc_symlink (call_frame_t *frame, xlator_t *this, - const char *dst, loc_t *src) + const char *dst, loc_t *src, dict_t *params) { frame->local = strdup (dst); STACK_WIND (frame, sc_symlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink, - dst, src); + dst, src, params); return 0; } diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index e5e5bd11198..f1d99ce6c54 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -468,10 +468,9 @@ out: } - -int32_t +int client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, - loc_t *loc) + loc_t *loc, dict_t *params) { int ret = -1; clnt_conf_t *conf = NULL; diff --git a/xlators/protocol/legacy/client/src/client-protocol.c b/xlators/protocol/legacy/client/src/client-protocol.c index e0f716ed965..57cfbc73e33 100644 --- a/xlators/protocol/legacy/client/src/client-protocol.c +++ b/xlators/protocol/legacy/client/src/client-protocol.c @@ -1195,7 +1195,7 @@ unwind: int client_symlink (call_frame_t *frame, xlator_t *this, const char *linkname, - loc_t *loc) + loc_t *loc, dict_t *params) { int ret = -1; gf_hdr_common_t *hdr = NULL; diff --git a/xlators/protocol/legacy/server/src/server-protocol.c b/xlators/protocol/legacy/server/src/server-protocol.c index 4c48e75a9ec..b2ce4bd116e 100644 --- a/xlators/protocol/legacy/server/src/server-protocol.c +++ b/xlators/protocol/legacy/server/src/server-protocol.c @@ -4618,7 +4618,7 @@ server_symlink_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_symlink_cbk, bound_xl, bound_xl->fops->symlink, - state->name, &state->loc); + state->name, &state->loc, state->params); return 0; err: diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index ecafb57f52b..17348162824 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -1860,7 +1860,7 @@ server_symlink_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_symlink_cbk, bound_xl, bound_xl->fops->symlink, - state->name, &state->loc); + state->name, &state->loc, state->params); return 0; err: diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 1afbffab844..0730dc2cde2 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -1598,9 +1598,10 @@ posix_rmdir (call_frame_t *frame, xlator_t *this, return 0; } -int32_t + +int posix_symlink (call_frame_t *frame, xlator_t *this, - const char *linkname, loc_t *loc) + const char *linkname, loc_t *loc, dict_t *params) { int32_t op_ret = -1; int32_t op_errno = 0; |