diff options
author | Raghavendra G <rgowdapp@redhat.com> | 2013-08-12 22:51:00 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2013-08-29 08:02:31 +0530 |
commit | 81c3a43b85324eecbdb1ffb88bad38cd387145d8 (patch) | |
tree | 6281b5c953fa43c00f71baa9df9c4b7f82de0297 | |
parent | bf99fd9d5c439b8be283f5a6f971a95491e13301 (diff) |
features/marker: fill inode contexts in readdirp
Change-Id: If9b4a9e9c2c153895129b6ed44ebee416f3da75c
BUG: 969461
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
-rw-r--r-- | xlators/features/marker/src/marker.c | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 51e56260..2a0c509c 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -2471,17 +2471,39 @@ marker_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, gf_dirent_t *entries, dict_t *xdata) { - gf_dirent_t *entry = NULL; + gf_dirent_t *entry = NULL; + marker_conf_t *priv = NULL; + marker_local_t *local = NULL; + loc_t loc = {0, }; if (op_ret <= 0) goto unwind; + priv = this->private; + local = frame->local; + + if (!(priv->feature_enabled & GF_QUOTA) || (local == NULL)) { + goto unwind; + } + list_for_each_entry (entry, &entries->list, list) { - /* TODO: fill things */ + loc.inode = inode_ref (entry->inode); + loc.parent = inode_ref (local->loc.inode); + + uuid_copy (loc.gfid, loc.inode->gfid); + uuid_copy (loc.pargfid, loc.parent->gfid); + + mq_xattr_state (this, &loc, entry->dict, entry->d_stat); + + loc_wipe (&loc); } unwind: + local = frame->local; + frame->local = NULL; + STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries, xdata); + marker_local_unref (local); return 0; } @@ -2490,15 +2512,27 @@ int marker_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset, dict_t *dict) { - marker_conf_t *priv = NULL; + marker_conf_t *priv = NULL; + loc_t loc = {0, }; + marker_local_t *local = NULL; priv = this->private; if (priv->feature_enabled == 0) goto wind; - if ((priv->feature_enabled & GF_QUOTA) && dict) - mq_req_xattr (this, NULL, dict); + if (priv->feature_enabled & GF_QUOTA) { + local = mem_get0 (this->local_pool); + + MARKER_INIT_LOCAL (frame, local); + + loc.parent = local->loc.inode = inode_ref (fd->inode); + + if (dict == NULL) + dict = dict_new (); + + mq_req_xattr (this, &loc, dict); + } wind: STACK_WIND (frame, marker_readdirp_cbk, |