summaryrefslogtreecommitdiffstats
path: root/xlators/performance/md-cache
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-03-20 17:22:24 +0530
committerAnand Avati <avati@redhat.com>2012-03-22 16:40:27 -0700
commit9d3af972f516b6ba38d2736ce2016e34a452d569 (patch)
tree1dcdc620748a42cdfb5464c3adaae5a4a3a6f869 /xlators/performance/md-cache
parentafe542eca18888463798747d2a95e5a9d239a4a0 (diff)
core: adding extra data for fops
with this change, the xlator APIs will have a dictionary as extra argument, which is passed between all the layers. This can be utilized for overloading in some of the operations. Change-Id: I58a8186b3ef647650280e63f3e5e9b9de7827b40 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 782265 Reviewed-on: http://review.gluster.com/2960 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/performance/md-cache')
-rw-r--r--xlators/performance/md-cache/src/md-cache.c243
1 files changed, 134 insertions, 109 deletions
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
index 5fa6e214bf8..13396a44e8a 100644
--- a/xlators/performance/md-cache/src/md-cache.c
+++ b/xlators/performance/md-cache/src/md-cache.c
@@ -632,7 +632,7 @@ out:
int
mdc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
- dict_t *xattr_req)
+ dict_t *xdata)
{
int ret = 0;
struct iatt stbuf = {0, };
@@ -651,12 +651,12 @@ mdc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
if (ret != 0)
goto uncached;
- if (xattr_req) {
+ if (xdata) {
ret = mdc_inode_xatt_get (this, loc->inode, &xattr_rsp);
if (ret != 0)
goto uncached;
- if (!mdc_xattr_satisfied (this, xattr_req, xattr_rsp))
+ if (!mdc_xattr_satisfied (this, xdata, xattr_rsp))
goto uncached;
}
@@ -669,11 +669,11 @@ mdc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
return 0;
uncached:
- if (xattr_req)
- mdc_load_reqs (this, xattr_req);
+ if (xdata)
+ mdc_load_reqs (this, xdata);
STACK_WIND (frame, mdc_lookup_cbk, FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->lookup, loc, xattr_req);
+ FIRST_CHILD (this)->fops->lookup, loc, xdata);
if (xattr_rsp)
dict_unref (xattr_rsp);
@@ -684,7 +684,7 @@ uncached:
int
mdc_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *buf)
+ int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -698,14 +698,14 @@ mdc_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_iatt_set (this, local->loc.inode, buf);
out:
- MDC_STACK_UNWIND (stat, frame, op_ret, op_errno, buf);
+ MDC_STACK_UNWIND (stat, frame, op_ret, op_errno, buf, xdata);
return 0;
}
int
-mdc_stat (call_frame_t *frame, xlator_t *this, loc_t *loc)
+mdc_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
int ret;
struct iatt stbuf;
@@ -721,21 +721,22 @@ mdc_stat (call_frame_t *frame, xlator_t *this, loc_t *loc)
if (ret != 0)
goto uncached;
- MDC_STACK_UNWIND (stat, frame, 0, 0, &stbuf);
+ MDC_STACK_UNWIND (stat, frame, 0, 0, &stbuf, xdata);
return 0;
uncached:
STACK_WIND (frame, mdc_stat_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->stat,
- loc);
+ loc, xdata);
return 0;
}
int
mdc_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *buf)
+ int32_t op_ret, int32_t op_errno, struct iatt *buf,
+ dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -749,14 +750,14 @@ mdc_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_iatt_set (this, local->fd->inode, buf);
out:
- MDC_STACK_UNWIND (fstat, frame, op_ret, op_errno, buf);
+ MDC_STACK_UNWIND (fstat, frame, op_ret, op_errno, buf, xdata);
return 0;
}
int
-mdc_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd)
+mdc_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
{
int ret;
struct iatt stbuf;
@@ -772,14 +773,14 @@ mdc_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd)
if (ret != 0)
goto uncached;
- MDC_STACK_UNWIND (fstat, frame, 0, 0, &stbuf);
+ MDC_STACK_UNWIND (fstat, frame, 0, 0, &stbuf, xdata);
return 0;
uncached:
STACK_WIND (frame, mdc_fstat_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->fstat,
- fd);
+ fd, xdata);
return 0;
}
@@ -787,7 +788,7 @@ uncached:
int
mdc_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf)
+ struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -802,7 +803,8 @@ mdc_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_iatt_set (this, local->loc.inode, postbuf);
out:
- MDC_STACK_UNWIND (truncate, frame, op_ret, op_errno, prebuf, postbuf);
+ MDC_STACK_UNWIND (truncate, frame, op_ret, op_errno, prebuf, postbuf,
+ xdata);
return 0;
}
@@ -810,7 +812,7 @@ out:
int
mdc_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
- off_t offset)
+ off_t offset, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -820,7 +822,7 @@ mdc_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
STACK_WIND (frame, mdc_truncate_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate,
- loc, offset);
+ loc, offset, xdata);
return 0;
}
@@ -828,7 +830,7 @@ mdc_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
int
mdc_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf)
+ struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -843,7 +845,8 @@ mdc_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_iatt_set (this, local->fd->inode, postbuf);
out:
- MDC_STACK_UNWIND (ftruncate, frame, op_ret, op_errno, prebuf, postbuf);
+ MDC_STACK_UNWIND (ftruncate, frame, op_ret, op_errno, prebuf, postbuf,
+ xdata);
return 0;
}
@@ -851,7 +854,7 @@ out:
int
mdc_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd,
- off_t offset)
+ off_t offset, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -861,7 +864,7 @@ mdc_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd,
STACK_WIND (frame, mdc_ftruncate_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->ftruncate,
- fd, offset);
+ fd, offset, xdata);
return 0;
}
@@ -869,7 +872,8 @@ mdc_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd,
int
mdc_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode,
- struct iatt *buf, struct iatt *preparent, struct iatt *postparent)
+ struct iatt *buf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -891,25 +895,25 @@ mdc_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
out:
MDC_STACK_UNWIND (mknod, frame, op_ret, op_errno, inode, buf,
- preparent, postparent);
+ preparent, postparent, xdata);
return 0;
}
int
mdc_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc,
- mode_t mode, dev_t rdev, dict_t *params)
+ mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata)
{
mdc_local_t *local = NULL;
local = mdc_local_get (frame);
loc_copy (&local->loc, loc);
- local->xattr = dict_ref (params);
+ local->xattr = dict_ref (xdata);
STACK_WIND (frame, mdc_mknod_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->mknod,
- loc, mode, rdev, params);
+ loc, mode, rdev, umask, xdata);
return 0;
}
@@ -917,7 +921,8 @@ mdc_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc,
int
mdc_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode,
- struct iatt *buf, struct iatt *preparent, struct iatt *postparent)
+ struct iatt *buf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -939,25 +944,25 @@ mdc_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
out:
MDC_STACK_UNWIND (mkdir, frame, op_ret, op_errno, inode, buf,
- preparent, postparent);
+ preparent, postparent, xdata);
return 0;
}
int
mdc_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc,
- mode_t mode, dict_t *params)
+ mode_t mode, mode_t umask, dict_t *xdata)
{
mdc_local_t *local = NULL;
local = mdc_local_get (frame);
loc_copy (&local->loc, loc);
- local->xattr = dict_ref (params);
+ local->xattr = dict_ref (xdata);
STACK_WIND (frame, mdc_mkdir_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->mkdir,
- loc, mode, params);
+ loc, mode, umask, xdata);
return 0;
}
@@ -965,7 +970,7 @@ mdc_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc,
int
mdc_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- struct iatt *preparent, struct iatt *postparent)
+ struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -987,13 +992,14 @@ mdc_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
MDC_STACK_UNWIND (unlink, frame, op_ret, op_errno,
- preparent, postparent);
+ preparent, postparent, xdata);
return 0;
}
int
-mdc_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
+mdc_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t xflag,
+ dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1003,7 +1009,7 @@ mdc_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
STACK_WIND (frame, mdc_unlink_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink,
- loc);
+ loc, xflag, xdata);
return 0;
}
@@ -1011,7 +1017,7 @@ mdc_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
int
mdc_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- struct iatt *preparent, struct iatt *postparent)
+ struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1029,13 +1035,14 @@ mdc_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
MDC_STACK_UNWIND (rmdir, frame, op_ret, op_errno,
- preparent, postparent);
+ preparent, postparent, xdata);
return 0;
}
int
-mdc_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flag)
+mdc_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flag,
+ dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1045,7 +1052,7 @@ mdc_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flag)
STACK_WIND (frame, mdc_rmdir_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->rmdir,
- loc, flag);
+ loc, flag, xdata);
return 0;
}
@@ -1053,7 +1060,8 @@ mdc_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flag)
int
mdc_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode,
- struct iatt *buf, struct iatt *preparent, struct iatt *postparent)
+ struct iatt *buf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1074,14 +1082,14 @@ mdc_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
out:
MDC_STACK_UNWIND (symlink, frame, op_ret, op_errno, inode, buf,
- preparent, postparent);
+ preparent, postparent, xdata);
return 0;
}
int
mdc_symlink (call_frame_t *frame, xlator_t *this, const char *linkname,
- loc_t *loc, dict_t *params)
+ loc_t *loc, mode_t umask, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1093,7 +1101,7 @@ mdc_symlink (call_frame_t *frame, xlator_t *this, const char *linkname,
STACK_WIND (frame, mdc_symlink_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink,
- linkname, loc, params);
+ linkname, loc, umask, xdata);
return 0;
}
@@ -1102,7 +1110,8 @@ int
mdc_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *buf,
struct iatt *preoldparent, struct iatt *postoldparent,
- struct iatt *prenewparent, struct iatt *postnewparent)
+ struct iatt *prenewparent, struct iatt *postnewparent,
+ dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1131,14 +1140,15 @@ mdc_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
out:
MDC_STACK_UNWIND (rename, frame, op_ret, op_errno, buf,
- preoldparent, postoldparent, prenewparent, postnewparent);
+ preoldparent, postoldparent, prenewparent,
+ postnewparent, xdata);
return 0;
}
int
mdc_rename (call_frame_t *frame, xlator_t *this,
- loc_t *oldloc, loc_t *newloc)
+ loc_t *oldloc, loc_t *newloc, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1149,7 +1159,7 @@ mdc_rename (call_frame_t *frame, xlator_t *this,
STACK_WIND (frame, mdc_rename_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename,
- oldloc, newloc);
+ oldloc, newloc, xdata);
return 0;
}
@@ -1157,7 +1167,7 @@ mdc_rename (call_frame_t *frame, xlator_t *this,
int
mdc_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *buf,
- struct iatt *preparent, struct iatt *postparent)
+ struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1178,14 +1188,14 @@ mdc_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
out:
MDC_STACK_UNWIND (link, frame, op_ret, op_errno, inode, buf,
- preparent, postparent);
+ preparent, postparent, xdata);
return 0;
}
int
mdc_link (call_frame_t *frame, xlator_t *this,
- loc_t *oldloc, loc_t *newloc)
+ loc_t *oldloc, loc_t *newloc, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1196,7 +1206,7 @@ mdc_link (call_frame_t *frame, xlator_t *this,
STACK_WIND (frame, mdc_link_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->link,
- oldloc, newloc);
+ oldloc, newloc, xdata);
return 0;
}
@@ -1204,7 +1214,8 @@ mdc_link (call_frame_t *frame, xlator_t *this,
int
mdc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode,
- struct iatt *buf, struct iatt *preparent, struct iatt *postparent)
+ struct iatt *buf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1226,25 +1237,25 @@ mdc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
out:
MDC_STACK_UNWIND (create, frame, op_ret, op_errno, fd, inode, buf,
- preparent, postparent);
+ preparent, postparent, xdata);
return 0;
}
int
mdc_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
- mode_t mode, fd_t *fd, dict_t *params)
+ mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata)
{
mdc_local_t *local = NULL;
local = mdc_local_get (frame);
loc_copy (&local->loc, loc);
- local->xattr = dict_ref (params);
+ local->xattr = dict_ref (xdata);
STACK_WIND (frame, mdc_create_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->create,
- loc, flags, mode, fd, params);
+ loc, flags, mode, umask, fd, xdata);
return 0;
}
@@ -1253,7 +1264,7 @@ int
mdc_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iovec *vector, int32_t count,
- struct iatt *stbuf, struct iobref *iobref)
+ struct iatt *stbuf, struct iobref *iobref, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1269,7 +1280,7 @@ mdc_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
MDC_STACK_UNWIND (readv, frame, op_ret, op_errno, vector, count,
- stbuf, iobref);
+ stbuf, iobref, xdata);
return 0;
}
@@ -1277,7 +1288,7 @@ out:
int
mdc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset, uint32_t flags)
+ off_t offset, uint32_t flags, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1287,7 +1298,7 @@ mdc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
STACK_WIND (frame, mdc_readv_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->readv,
- fd, size, offset, flags);
+ fd, size, offset, flags, xdata);
return 0;
}
@@ -1295,7 +1306,7 @@ mdc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
int
mdc_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf)
+ struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1310,7 +1321,8 @@ mdc_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_iatt_set (this, local->fd->inode, postbuf);
out:
- MDC_STACK_UNWIND (writev, frame, op_ret, op_errno, prebuf, postbuf);
+ MDC_STACK_UNWIND (writev, frame, op_ret, op_errno, prebuf, postbuf,
+ xdata);
return 0;
}
@@ -1318,7 +1330,8 @@ out:
int
mdc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
- int count, off_t offset, uint32_t flags, struct iobref *iobref)
+ int count, off_t offset, uint32_t flags, struct iobref *iobref,
+ dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1328,7 +1341,7 @@ mdc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
STACK_WIND (frame, mdc_writev_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev,
- fd, vector, count, offset, flags, iobref);
+ fd, vector, count, offset, flags, iobref, xdata);
return 0;
}
@@ -1336,7 +1349,7 @@ mdc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
int
mdc_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf)
+ struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1353,7 +1366,8 @@ mdc_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_iatt_set (this, local->loc.inode, postbuf);
out:
- MDC_STACK_UNWIND (setattr, frame, op_ret, op_errno, prebuf, postbuf);
+ MDC_STACK_UNWIND (setattr, frame, op_ret, op_errno, prebuf, postbuf,
+ xdata);
return 0;
}
@@ -1361,7 +1375,7 @@ out:
int
mdc_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
- struct iatt *stbuf, int valid)
+ struct iatt *stbuf, int valid, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1371,7 +1385,7 @@ mdc_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
STACK_WIND (frame, mdc_setattr_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->setattr,
- loc, stbuf, valid);
+ loc, stbuf, valid, xdata);
return 0;
}
@@ -1379,7 +1393,7 @@ mdc_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
int
mdc_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf)
+ struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1394,7 +1408,8 @@ mdc_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_iatt_set (this, local->fd->inode, postbuf);
out:
- MDC_STACK_UNWIND (fsetattr, frame, op_ret, op_errno, prebuf, postbuf);
+ MDC_STACK_UNWIND (fsetattr, frame, op_ret, op_errno, prebuf, postbuf,
+ xdata);
return 0;
}
@@ -1402,7 +1417,7 @@ out:
int
mdc_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
- struct iatt *stbuf, int valid)
+ struct iatt *stbuf, int valid, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1412,7 +1427,7 @@ mdc_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
STACK_WIND (frame, mdc_setattr_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetattr,
- fd, stbuf, valid);
+ fd, stbuf, valid, xdata);
return 0;
}
@@ -1420,7 +1435,7 @@ mdc_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
int
mdc_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf)
+ struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1435,14 +1450,16 @@ mdc_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_iatt_set (this, local->fd->inode, postbuf);
out:
- MDC_STACK_UNWIND (fsync, frame, op_ret, op_errno, prebuf, postbuf);
+ MDC_STACK_UNWIND (fsync, frame, op_ret, op_errno, prebuf, postbuf,
+ xdata);
return 0;
}
int
-mdc_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync)
+mdc_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync,
+ dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1452,14 +1469,14 @@ mdc_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync)
STACK_WIND (frame, mdc_fsync_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsync,
- fd, datasync);
+ fd, datasync, xdata);
return 0;
}
int
mdc_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1474,7 +1491,7 @@ mdc_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_xatt_update (this, local->loc.inode, local->xattr);
out:
- MDC_STACK_UNWIND (setxattr, frame, op_ret, op_errno);
+ MDC_STACK_UNWIND (setxattr, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -1482,7 +1499,7 @@ out:
int
mdc_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
- dict_t *xattr, int flags)
+ dict_t *xattr, int flags, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1493,14 +1510,14 @@ mdc_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
STACK_WIND (frame, mdc_setxattr_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->setxattr,
- loc, xattr, flags);
+ loc, xattr, flags, xdata);
return 0;
}
int
mdc_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1515,7 +1532,7 @@ mdc_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_xatt_update (this, local->fd->inode, local->xattr);
out:
- MDC_STACK_UNWIND (fsetxattr, frame, op_ret, op_errno);
+ MDC_STACK_UNWIND (fsetxattr, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -1523,7 +1540,7 @@ out:
int
mdc_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
- dict_t *xattr, int flags)
+ dict_t *xattr, int flags, dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1534,13 +1551,14 @@ mdc_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
STACK_WIND (frame, mdc_fsetxattr_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetxattr,
- fd, xattr, flags);
+ fd, xattr, flags, xdata);
return 0;
}
int
mdc_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xattr)
+ int32_t op_ret, int32_t op_errno, dict_t *xattr,
+ dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1554,14 +1572,15 @@ mdc_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_xatt_update (this, local->loc.inode, xattr);
out:
- MDC_STACK_UNWIND (getxattr, frame, op_ret, op_errno, xattr);
+ MDC_STACK_UNWIND (getxattr, frame, op_ret, op_errno, xattr, xdata);
return 0;
}
int
-mdc_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *key)
+mdc_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *key,
+ dict_t *xdata)
{
int ret;
mdc_local_t *local = NULL;
@@ -1583,21 +1602,22 @@ mdc_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *key)
if (!dict_get (xattr, (char *)key))
goto uncached;
- MDC_STACK_UNWIND (getxattr, frame, 0, 0, xattr);
+ MDC_STACK_UNWIND (getxattr, frame, 0, 0, xattr, xdata);
return 0;
uncached:
STACK_WIND (frame, mdc_getxattr_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->getxattr,
- loc, key);
+ loc, key, xdata);
return 0;
}
int
mdc_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xattr)
+ int32_t op_ret, int32_t op_errno, dict_t *xattr,
+ dict_t *xdata)
{
mdc_local_t *local = NULL;
@@ -1611,14 +1631,15 @@ mdc_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
mdc_inode_xatt_update (this, local->fd->inode, xattr);
out:
- MDC_STACK_UNWIND (fgetxattr, frame, op_ret, op_errno, xattr);
+ MDC_STACK_UNWIND (fgetxattr, frame, op_ret, op_errno, xattr, xdata);
return 0;
}
int
-mdc_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, const char *key)
+mdc_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, const char *key,
+ dict_t *xdata)
{
int ret;
mdc_local_t *local = NULL;
@@ -1640,21 +1661,21 @@ mdc_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, const char *key)
if (!dict_get (xattr, (char *)key))
goto uncached;
- MDC_STACK_UNWIND (fgetxattr, frame, 0, 0, xattr);
+ MDC_STACK_UNWIND (fgetxattr, frame, 0, 0, xattr, xdata);
return 0;
uncached:
STACK_WIND (frame, mdc_fgetxattr_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->fgetxattr,
- fd, key);
+ fd, key, xdata);
return 0;
}
int
mdc_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, gf_dirent_t *entries)
+ int op_ret, int op_errno, gf_dirent_t *entries, dict_t *xdata)
{
gf_dirent_t *entry = NULL;
@@ -1669,39 +1690,43 @@ mdc_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
unwind:
- STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries);
+ STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries, xdata);
return 0;
}
int
mdc_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd,
- size_t size, off_t offset, dict_t *xattr_req)
+ size_t size, off_t offset, dict_t *xdata)
{
STACK_WIND (frame, mdc_readdirp_cbk,
FIRST_CHILD (this), FIRST_CHILD (this)->fops->readdirp,
- fd, size, offset, xattr_req);
+ fd, size, offset, xdata);
return 0;
}
int
mdc_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd,
- size_t size, off_t offset)
+ size_t size, off_t offset, dict_t *xdata)
{
- dict_t *xattr_req = NULL;
+ int need_unref = 0;
- xattr_req = dict_new ();
+ if (!xdata) {
+ xdata = dict_new ();
+ need_unref = 1;
+ }
- if (xattr_req) {
- mdc_load_reqs (this, xattr_req);
- }
+ if (xdata)
+ mdc_load_reqs (this, xdata);
STACK_WIND (frame, mdc_readdirp_cbk,
FIRST_CHILD (this), FIRST_CHILD (this)->fops->readdirp,
- fd, size, offset, xattr_req);
+ fd, size, offset, xdata);
+
+ if (need_unref && xdata)
+ dict_unref (xdata);
- dict_unref (xattr_req);
return 0;
}