From b304333f8686468b2d3b2c60e040b1667d8c38c9 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Fri, 3 Sep 2010 13:59:06 +0000 Subject: gfid: change in create() prototype to have params dictionary with uuid in it Signed-off-by: Anand V. Avati Signed-off-by: Anand V. Avati Signed-off-by: Vijay Bellur BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971 --- xlators/cluster/afr/src/afr-common.c | 2 ++ xlators/cluster/afr/src/afr-dir-write.c | 8 ++++++-- xlators/cluster/afr/src/afr-dir-write.h | 3 ++- xlators/cluster/afr/src/afr.h | 1 + xlators/cluster/dht/src/dht-common.c | 13 ++++++++----- xlators/cluster/dht/src/dht-common.h | 1 + xlators/cluster/dht/src/dht-helper.c | 5 +++++ xlators/cluster/dht/src/nufa.c | 10 +++++++--- xlators/cluster/dht/src/switch.c | 8 +++++--- xlators/cluster/stripe/src/stripe.c | 5 +++-- 10 files changed, 40 insertions(+), 16 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 22bb4322e..6a732e118 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -391,6 +391,8 @@ afr_local_cleanup (afr_local_t *local, xlator_t *this) { /* create */ if (local->cont.create.fd) fd_unref (local->cont.create.fd); + if (local->cont.create.params) + dict_unref (local->cont.create.params); } { /* writev */ diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 27dd35177..3e9f48f9a 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -253,7 +253,8 @@ afr_create_wind (call_frame_t *frame, xlator_t *this) &local->loc, local->cont.create.flags, local->cont.create.mode, - local->cont.create.fd); + local->cont.create.fd, + local->cont.create.params); if (!--call_count) break; } @@ -280,7 +281,8 @@ afr_create_done (call_frame_t *frame, xlator_t *this) int afr_create (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, mode_t mode, fd_t *fd) + loc_t *loc, int32_t flags, mode_t mode, + fd_t *fd, dict_t *params) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -326,6 +328,8 @@ afr_create (call_frame_t *frame, xlator_t *this, local->cont.create.flags = flags; local->cont.create.mode = mode; local->cont.create.fd = fd_ref (fd); + if (params) + local->cont.create.params = dict_ref (params); if (loc->parent) local->cont.create.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 4fa618b65..5369ba968 100644 --- a/xlators/cluster/afr/src/afr-dir-write.h +++ b/xlators/cluster/afr/src/afr-dir-write.h @@ -22,7 +22,8 @@ int32_t afr_create (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, mode_t mode, fd_t *fd); + loc_t *loc, int32_t flags, mode_t mode, + fd_t *fd, dict_t *params); int32_t afr_mknod (call_frame_t *frame, xlator_t *this, diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 6df8c697c..f222cb0f8 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -480,6 +480,7 @@ typedef struct _afr_local { uint64_t gen; ino_t parent_ino; fd_t *fd; + dict_t *params; int32_t flags; mode_t mode; inode_t *inode; diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index cef73a9d6..17ddb3247 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -3242,7 +3242,8 @@ dht_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, STACK_WIND (frame, dht_create_cbk, cached_subvol, cached_subvol->fops->create, - &local->loc, local->flags, local->mode, local->fd); + &local->loc, local->flags, local->mode, + local->fd, local->params); return 0; err: @@ -3252,7 +3253,8 @@ dht_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, int dht_create (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, mode_t mode, fd_t *fd) + loc_t *loc, int32_t flags, mode_t mode, + fd_t *fd, dict_t *params) { int op_errno = -1; int ret = -1; @@ -3284,7 +3286,7 @@ dht_create (call_frame_t *frame, xlator_t *this, local->loc.path, subvol->name, loc->path); STACK_WIND (frame, dht_create_cbk, subvol, subvol->fops->create, - &local->loc, flags, mode, fd); + &local->loc, flags, mode, fd, params); goto done; } @@ -3309,7 +3311,7 @@ dht_create (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, fd); + loc, flags, mode, fd, params); goto done; } /* Choose the minimum filled volume, and create the @@ -3318,6 +3320,7 @@ dht_create (call_frame_t *frame, xlator_t *this, avail_subvol = dht_free_disk_available_subvol (this, subvol); if (avail_subvol != subvol) { local->fd = fd_ref (fd); + local->params = dict_ref (params); local->flags = flags; local->mode = mode; @@ -3335,7 +3338,7 @@ dht_create (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, fd); + loc, flags, mode, fd, params); done: return 0; diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 464832c41..58edca9f6 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -81,6 +81,7 @@ struct dht_local { struct statvfs statvfs; fd_t *fd; inode_t *inode; + dict_t *params; dict_t *xattr; dict_t *xattr_req; dht_layout_t *layout; diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index 6580f788d..09c326289 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -199,6 +199,11 @@ dht_local_wipe (xlator_t *this, dht_local_t *local) local->fd = NULL; } + if (local->params) { + dict_unref (local->params); + local->params = NULL; + } + if (local->xattr_req) dict_unref (local->xattr_req); diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index aaad5d5fa..e807ff304 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -302,7 +302,9 @@ nufa_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, STACK_WIND (frame, dht_create_cbk, local->cached_subvol, local->cached_subvol->fops->create, - &local->loc, local->flags, local->mode, local->fd); + &local->loc, local->flags, local->mode, local->fd, + local->params); + return 0; err: @@ -313,7 +315,8 @@ nufa_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, int nufa_create (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, mode_t mode, fd_t *fd) + loc_t *loc, int32_t flags, mode_t mode, + fd_t *fd, dict_t *params) { dht_local_t *local = NULL; dht_conf_t *conf = NULL; @@ -365,6 +368,7 @@ nufa_create (call_frame_t *frame, xlator_t *this, } local->fd = fd_ref (fd); + local->params = dict_ref (params); local->mode = mode; local->flags = flags; @@ -380,7 +384,7 @@ nufa_create (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, dht_create_cbk, subvol, subvol->fops->create, - loc, flags, mode, fd); + loc, flags, mode, fd, params); return 0; diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c index 5ec9e6657..f47ffb1fd 100644 --- a/xlators/cluster/dht/src/switch.c +++ b/xlators/cluster/dht/src/switch.c @@ -405,7 +405,8 @@ switch_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, STACK_WIND (frame, dht_create_cbk, local->cached_subvol, local->cached_subvol->fops->create, - &local->loc, local->flags, local->mode, local->fd); + &local->loc, local->flags, local->mode, local->fd, + local->params); return 0; @@ -417,7 +418,8 @@ switch_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, int switch_create (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, mode_t mode, fd_t *fd) + loc_t *loc, int32_t flags, mode_t mode, + fd_t *fd, dict_t *params) { dht_local_t *local = NULL; dht_conf_t *conf = NULL; @@ -483,7 +485,7 @@ switch_create (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, dht_create_cbk, subvol, subvol->fops->create, - loc, flags, mode, fd); + loc, flags, mode, fd, params); return 0; diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 05012b891..a13bba34f 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -2055,7 +2055,7 @@ out: */ int32_t stripe_create (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, mode_t mode, fd_t *fd) + int32_t flags, mode_t mode, fd_t *fd, dict_t *params) { stripe_private_t *priv = NULL; stripe_local_t *local = NULL; @@ -2102,7 +2102,8 @@ stripe_create (call_frame_t *frame, xlator_t *this, loc_t *loc, trav = this->children; while (trav) { STACK_WIND (frame, stripe_create_cbk, trav->xlator, - trav->xlator->fops->create, loc, flags, mode, fd); + trav->xlator->fops->create, loc, flags, + mode, fd, params); trav = trav->next; } -- cgit