diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2009-10-01 06:58:46 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-01 07:22:42 -0700 |
commit | 186a86f342625a9dce53fe537f8237c6099d5c54 (patch) | |
tree | 63ee2f3def75293b9f50acf9e49081fb1caad8ae /xlators/performance/io-cache | |
parent | dca4b2a23cb55e1e15fb393e7cbfd39b59280c9c (diff) |
Global: Introduce setattr and fsetattr fops
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 146 (Add setattr FOP)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=146
Diffstat (limited to 'xlators/performance/io-cache')
-rw-r--r-- | xlators/performance/io-cache/src/io-cache.c | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index 49a1ce82391..db1e204fd4f 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -132,48 +132,32 @@ ioc_inode_flush (ioc_inode_t *ioc_inode) return; } -/* - * ioc_utimens_cbk - - * - * @frame: - * @cookie: - * @this: - * @op_ret: - * @op_errno: - * @stbuf: - * - */ int32_t -ioc_utimens_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) +ioc_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, + struct stat *preop, struct stat *postop) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); - return 0; + STACK_UNWIND (frame, op_ret, op_errno, preop, postop); + return 0; } -/* - * ioc_utimens - - * - * @frame: - * @this: - * @loc: - * @tv: - * - */ int32_t -ioc_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct timespec *tv) +ioc_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, + struct stat *stbuf, int32_t valid) { - uint64_t ioc_inode = 0; - inode_ctx_get (loc->inode, this, &ioc_inode); + uint64_t ioc_inode = 0; - if (ioc_inode) - ioc_inode_flush ((ioc_inode_t *)(long)ioc_inode); + inode_ctx_get (loc->inode, this, &ioc_inode); - STACK_WIND (frame, ioc_utimens_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->utimens, loc, tv); + if (ioc_inode + && ((valid & GF_SET_ATTR_ATIME) + || (valid & GF_SET_ATTR_MTIME))) + ioc_inode_flush ((ioc_inode_t *)(long)ioc_inode); - return 0; + STACK_WIND (frame, ioc_setattr_cbk, FIRST_CHILD (this), + FIRST_CHILD (this)->fops->setattr, loc, stbuf, valid); + + return 0; } int32_t @@ -1563,9 +1547,9 @@ struct xlator_fops fops = { .writev = ioc_writev, .truncate = ioc_truncate, .ftruncate = ioc_ftruncate, - .utimens = ioc_utimens, .lookup = ioc_lookup, - .lk = ioc_lk + .lk = ioc_lk, + .setattr = ioc_setattr }; struct xlator_mops mops = { |