diff options
author | Amar Tumballi <amar@gluster.com> | 2012-01-18 18:06:44 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2012-01-25 02:03:44 -0800 |
commit | cf8486cbef329ef66868f658fa35f470f97db462 (patch) | |
tree | 18cf37bd7cf65ac820d435fb1ee43dc205a2917b /xlators/protocol/server/src/server3_1-fops.c | |
parent | b02afc6d008f9959db28244eb2b9dd3b9ef92393 (diff) |
core: get xattrs also as part of readdirp
readdirp_req() call sends a dict_t * as an argument, which
contains all the xattr keys for which the entries got in
readdirp_rsp() are having xattr value filled dictionary.
Change-Id: I8b7e1290740ea3e884e67d19156ce849227167c0
Signed-off-by: Amar Tumballi <amar@gluster.com>
BUG: 765785
Reviewed-on: http://review.gluster.com/771
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/protocol/server/src/server3_1-fops.c')
-rw-r--r-- | xlators/protocol/server/src/server3_1-fops.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index c2ab3590ed2..482c242d5ce 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -1038,7 +1038,6 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_stat_from_iatt (&rsp.preparent, preparent); gf_stat_from_iatt (&rsp.postparent, postparent); - link_inode = inode_link (inode, state->loc2.parent, state->loc2.name, stbuf); inode_unref (link_inode); @@ -1738,6 +1737,10 @@ server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_errno = ENOMEM; goto out; } + + /* TODO: need more clear thoughts before calling this function. */ + /* gf_link_inodes_from_dirent (this, state->fd->inode, entries); */ + } else { /* (op_ret == 0) is valid, and means EOF, don't log for that */ gf_log (this->name, (op_ret) ? GF_LOG_INFO : GF_LOG_TRACE, @@ -2132,7 +2135,7 @@ server_readdirp_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_readdirp_cbk, bound_xl, bound_xl->fops->readdirp, state->fd, state->size, - state->offset); + state->offset, state->dict); return 0; err: @@ -3979,10 +3982,10 @@ server_readdirp (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; + char *buf = NULL; gfs3_readdirp_req args = {{0,},}; size_t headers_size = 0; int ret = -1; - if (!req) return ret; @@ -4023,6 +4026,29 @@ server_readdirp (rpcsvc_request_t *req) state->offset = args.offset; memcpy (state->resolve.gfid, args.gfid, 16); + if (args.dict.dict_len) { + /* Unserialize the dictionary */ + state->dict = dict_new (); + + buf = memdup (args.dict.dict_val, args.dict.dict_len); + if (buf == NULL) { + goto out; + } + + ret = dict_unserialize (buf, args.dict.dict_len, + &state->dict); + if (ret < 0) { + gf_log (state->conn->bound_xl->name, GF_LOG_ERROR, + "%"PRId64": failed to unserialize req-buffer " + " to dictionary", frame->root->unique); + goto out; + } + + state->dict->extra_free = buf; + + buf = NULL; + } + ret = 0; resolve_and_resume (frame, server_readdirp_resume); out: |