summaryrefslogtreecommitdiffstats
path: root/xlators/performance/io-threads/src/io-threads.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-10-01 06:58:46 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-01 07:22:42 -0700
commit186a86f342625a9dce53fe537f8237c6099d5c54 (patch)
tree63ee2f3def75293b9f50acf9e49081fb1caad8ae /xlators/performance/io-threads/src/io-threads.c
parentdca4b2a23cb55e1e15fb393e7cbfd39b59280c9c (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-threads/src/io-threads.c')
-rw-r--r--xlators/performance/io-threads/src/io-threads.c240
1 files changed, 33 insertions, 207 deletions
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index 118ae42423f..dc4b556162c 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -365,199 +365,89 @@ out:
int
-iot_chmod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *buf)
+iot_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, buf);
+ STACK_UNWIND (frame, op_ret, op_errno, preop, postop);
return 0;
}
int
-iot_chmod_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc,
- mode_t mode)
+iot_setattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc,
+ struct stat *stbuf, int32_t valid)
{
- STACK_WIND (frame, iot_chmod_cbk,
+ STACK_WIND (frame, iot_setattr_cbk,
FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->chmod,
- loc, mode);
+ FIRST_CHILD (this)->fops->setattr,
+ loc, stbuf, valid);
return 0;
}
int
-iot_chmod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode)
+iot_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
+ struct stat *stbuf, int32_t valid)
{
call_stub_t *stub = NULL;
- fd_t *fd = NULL;
int ret = -1;
- stub = fop_chmod_stub (frame, iot_chmod_wrapper, loc, mode);
+ stub = fop_setattr_stub (frame, iot_setattr_wrapper, loc, stbuf, valid);
if (!stub) {
- gf_log (this->name, GF_LOG_ERROR, "cannot create chmod stub"
- "(out of memory)");
+ gf_log (this->name, GF_LOG_ERROR, "Cannot create setattr stub"
+ "(Out of memory)");
ret = -ENOMEM;
goto out;
}
- fd = fd_lookup (loc->inode, frame->root->pid);
- if (fd == NULL)
- ret = iot_schedule_unordered ((iot_conf_t *)this->private,
- loc->inode, stub);
- else {
- ret = iot_schedule_ordered ((iot_conf_t *)this->private,
- loc->inode, stub);
- fd_unref (fd);
- }
-
-out:
- if (ret < 0) {
- if (stub != NULL) {
- call_stub_destroy (stub);
- }
-
- STACK_UNWIND (frame, -1, -ret, NULL);
- }
-
- return 0;
-}
-
-
-int
-iot_fchmod_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;
-}
-
-
-int
-iot_fchmod_wrapper (call_frame_t *frame, xlator_t *this,
- fd_t *fd, mode_t mode)
-{
- STACK_WIND (frame, iot_fchmod_cbk, FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->fchmod, fd, mode);
- return 0;
-}
-
-
-int
-iot_fchmod (call_frame_t *frame, xlator_t *this, fd_t *fd, mode_t mode)
-{
- call_stub_t *stub = NULL;
- int ret = -1;
-
- stub = fop_fchmod_stub (frame, iot_fchmod_wrapper, fd, mode);
- if (!stub) {
- gf_log (this->name, GF_LOG_ERROR, "cannot create fchmod stub"
- "(out of memory)");
- ret = -ENOMEM;
- goto out;
- }
-
- ret = iot_schedule_ordered ((iot_conf_t *)this->private, fd->inode,
- stub);
+ ret = iot_schedule_unordered ((iot_conf_t *)this->private,
+ loc->inode, stub);
out:
if (ret < 0) {
- STACK_UNWIND (frame, -1, -ret, NULL);
-
if (stub != NULL) {
call_stub_destroy (stub);
}
- }
- return 0;
-}
-
-
-int
-iot_chown_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;
-}
-
-
-int
-iot_chown_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, uid_t uid,
- gid_t gid)
-{
- STACK_WIND (frame, iot_chown_cbk,
- FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->chown,
- loc, uid, gid);
- return 0;
-}
-
-
-int
-iot_chown (call_frame_t *frame, xlator_t *this, loc_t *loc, uid_t uid,
- gid_t gid)
-{
- call_stub_t *stub = NULL;
- fd_t *fd = NULL;
- int ret = -1;
-
- stub = fop_chown_stub (frame, iot_chown_wrapper, loc, uid, gid);
- if (!stub) {
- gf_log (this->name, GF_LOG_ERROR, "cannot create chown stub"
- "(out of memory)");
- ret = -ENOMEM;
- goto out;
- }
- fd = fd_lookup (loc->inode, frame->root->pid);
- if (fd == NULL)
- ret = iot_schedule_unordered ((iot_conf_t *)this->private,
- loc->inode, stub);
- else {
- ret = iot_schedule_ordered ((iot_conf_t *)this->private,
- loc->inode, stub);
- fd_unref (fd);
+ STACK_UNWIND (frame, -1, -ret, NULL, NULL);
}
-out:
- if (ret < 0) {
- STACK_UNWIND (frame, -1, -ret, NULL);
-
- if (stub != NULL) {
- call_stub_destroy (stub);
- }
- }
return 0;
}
int
-iot_fchown_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *buf)
+iot_fsetattr_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, buf);
+ STACK_UNWIND (frame, op_ret, op_errno, preop, postop);
return 0;
}
int
-iot_fchown_wrapper (call_frame_t *frame, xlator_t *this,
- fd_t *fd, uid_t uid, gid_t gid)
+iot_fsetattr_wrapper (call_frame_t *frame, xlator_t *this,
+ fd_t *fd, struct stat *stbuf, int32_t valid)
{
- STACK_WIND (frame, iot_fchown_cbk, FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->fchown, fd, uid, gid);
+ STACK_WIND (frame, iot_fsetattr_cbk, FIRST_CHILD (this),
+ FIRST_CHILD (this)->fops->fsetattr, fd, stbuf, valid);
return 0;
}
int
-iot_fchown (call_frame_t *frame, xlator_t *this, fd_t *fd, uid_t uid, gid_t gid)
+iot_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
+ struct stat *stbuf, int32_t valid)
{
call_stub_t *stub = NULL;
int ret = -1;
- stub = fop_fchown_stub (frame, iot_fchown_wrapper, fd, uid, gid);
+ stub = fop_fsetattr_stub (frame, iot_fsetattr_wrapper, fd, stbuf,
+ valid);
if (!stub) {
- gf_log (this->name, GF_LOG_ERROR, "cannot create fchown stub"
+ gf_log (this->name, GF_LOG_ERROR, "cannot create fsetattr stub"
"(out of memory)");
ret = -ENOMEM;
goto out;
@@ -568,7 +458,7 @@ iot_fchown (call_frame_t *frame, xlator_t *this, fd_t *fd, uid_t uid, gid_t gid)
out:
if (ret < 0) {
- STACK_UNWIND (frame, -1, -ret, NULL);
+ STACK_UNWIND (frame, -1, -ret, NULL, NULL);
if (stub != NULL) {
call_stub_destroy (stub);
}
@@ -1507,67 +1397,6 @@ out:
int
-iot_utimens_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;
-}
-
-
-int
-iot_utimens_wrapper (call_frame_t *frame, xlator_t *this,
- loc_t *loc, struct timespec tv[2])
-{
- STACK_WIND (frame, iot_utimens_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->utimens,
- loc, tv);
- return 0;
-}
-
-
-int
-iot_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc,
- struct timespec tv[2])
-{
- call_stub_t *stub;
- fd_t *fd = NULL;
- int ret = -1;
-
- stub = fop_utimens_stub (frame, iot_utimens_wrapper, loc, tv);
- if (!stub) {
- gf_log (this->name, GF_LOG_ERROR,
- "cannot create fop_utimens call stub"
- "(out of memory)");
- ret = -ENOMEM;
- goto out;
- }
-
- fd = fd_lookup (loc->inode, frame->root->pid);
- if (fd == NULL)
- ret = iot_schedule_unordered ((iot_conf_t *)this->private,
- loc->inode, stub);
- else {
- ret = iot_schedule_ordered ((iot_conf_t *)this->private,
- loc->inode, stub);
- fd_unref (fd);
- }
-
-out:
- if (ret < 0) {
- STACK_UNWIND (frame, -1, -ret, NULL);
-
- if (stub != NULL) {
- call_stub_destroy (stub);
- }
- }
- return 0;
-}
-
-
-int
iot_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, uint8_t *file_checksum,
uint8_t *dir_checksum)
@@ -2975,14 +2804,11 @@ struct xlator_fops fops = {
.fstat = iot_fstat, /* O */
.truncate = iot_truncate, /* V */
.ftruncate = iot_ftruncate, /* O */
- .utimens = iot_utimens, /* V */
.checksum = iot_checksum, /* U */
.unlink = iot_unlink, /* U */
.lookup = iot_lookup, /* U */
- .chmod = iot_chmod, /* V */
- .fchmod = iot_fchmod, /* O */
- .chown = iot_chown, /* V */
- .fchown = iot_fchown, /* O */
+ .setattr = iot_setattr, /* U */
+ .fsetattr = iot_fsetattr, /* O */
.access = iot_access, /* U */
.readlink = iot_readlink, /* U */
.mknod = iot_mknod, /* U */