diff options
author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-04-21 04:48:33 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-22 13:06:30 +0530 |
commit | 6b426bc53e2e6106e32568f09354d4e4ce382f11 (patch) | |
tree | 41ce18265ef298092761984e963a4bd510956d6c /xlators/performance/io-threads/src/io-threads.c | |
parent | 1cb8064b2a653f06062c226dc12d524d8f1a2da2 (diff) |
io-threads: Add setxattr fop
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/performance/io-threads/src/io-threads.c')
-rw-r--r-- | xlators/performance/io-threads/src/io-threads.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index 672cc285e..93a529575 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -1594,6 +1594,50 @@ iot_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc) return 0; } +int +iot_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) +{ + STACK_UNWIND (frame, op_ret, op_errno); + return 0; +} + +int +iot_setxattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *dict, int32_t flags) +{ + STACK_WIND (frame, iot_setxattr_cbk, FIRST_CHILD (this), + FIRST_CHILD (this)->fops->setxattr, loc, dict, flags); + return 0; +} + +int +iot_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, + int32_t flags) +{ + call_stub_t *stub = NULL; + fd_t *fd = NULL; + + stub = fop_setxattr_stub (frame, iot_setxattr_wrapper, loc, dict, + flags); + if (!stub) { + gf_log (this->name, GF_LOG_ERROR, "cannot get setxattr stub"); + STACK_UNWIND (frame, -1, ENOMEM, NULL); + return 0; + } + fd = fd_lookup (loc->inode, frame->root->pid); + if (fd == NULL) + iot_schedule_unordered ((iot_conf_t *)this->private, + loc->inode, stub); + else { + iot_schedule_ordered ((iot_conf_t *)this->private, loc->inode, + stub); + fd_unref (fd); + } + + return 0; +} + /* Must be called with worker lock held */ void _iot_queue (iot_worker_t *worker, @@ -2119,6 +2163,7 @@ struct xlator_fops fops = { .opendir = iot_opendir, /* U */ .fsyncdir = iot_fsyncdir, /* O */ .statfs = iot_statfs, /* U */ + .setxattr = iot_setxattr, /* U */ }; struct xlator_mops mops = { |