diff options
author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-04-01 13:58:30 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-02 19:19:07 +0530 |
commit | 42df79e2ad14053f38a12f30b29b81dd897921c9 (patch) | |
tree | a6fe2551260c50bdffef67bc788fbc31ee0fb775 /xlators/performance | |
parent | 369476e93e4ab99234602a5bbe2070d734b45567 (diff) |
io-threads: Wire in support for rename fop
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r-- | xlators/performance/io-threads/src/io-threads.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index d3b4dc294..b986a945e 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -534,6 +534,60 @@ iot_symlink (call_frame_t *frame, } int32_t +iot_rename_cbk (call_frame_t *frame, + void * cookie, + xlator_t *this, + int32_t op_ret, + int32_t op_errno, + struct stat *buf) +{ + STACK_UNWIND (frame, op_ret, op_errno, buf); + return 0; +} + +int32_t +iot_rename_wrapper (call_frame_t *frame, + xlator_t *this, + loc_t *oldloc, + loc_t *newloc) +{ + STACK_WIND (frame, iot_rename_cbk, FIRST_CHILD (this), + FIRST_CHILD (this)->fops->rename, oldloc, newloc); + return 0; +} + +int32_t +iot_rename (call_frame_t *frame, + xlator_t *this, + loc_t *oldloc, + loc_t *newloc) +{ + call_stub_t *stub = NULL; + + stub = fop_rename_stub (frame, iot_rename_wrapper, oldloc, newloc); + if (!stub) { + gf_log (this->name, GF_LOG_ERROR, "cannot get rename stub"); + STACK_UNWIND (frame, -1, ENOMEM, NULL); + return 0; + } + + /* We should order this on the oldloc. rename() + * allows the blocks of the newloc to be available till + * the last process that might have it open, closes the file. + * I suppose this is a trade-off and we weigh in favour of + * ordering on oldloc because the client issuing a rename() + * would expect the oldloc's contents to be available at the + * new location after this request. rename()'s guarantee that + * the current + * newloc's block will not be released or over-written allows + * any othe processes that have the newloc open, to continue + * operating. + */ + iot_schedule ((iot_conf_t *)this->private, oldloc->inode, stub); + return 0; +} + +int32_t iot_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -1452,6 +1506,7 @@ struct xlator_fops fops = { .mkdir = iot_mkdir, .rmdir = iot_rmdir, .symlink = iot_symlink, + .rename = iot_rename, }; struct xlator_mops mops = { |