summaryrefslogtreecommitdiffstats
path: root/xlators/performance
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
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')
-rw-r--r--xlators/performance/io-cache/src/io-cache.c54
-rw-r--r--xlators/performance/io-threads/src/io-threads.c240
-rw-r--r--xlators/performance/quick-read/src/quick-read.c127
-rw-r--r--xlators/performance/read-ahead/src/read-ahead.c34
-rw-r--r--xlators/performance/stat-prefetch/src/stat-prefetch.c142
5 files changed, 87 insertions, 510 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 49a1ce823..db1e204fd 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 = {
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index 118ae4242..dc4b55616 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 */
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index c7d282aff..1249da87b 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -1183,124 +1183,36 @@ out:
}
-static int32_t
-qr_fchown_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
-qr_fchown_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, uid_t uid,
- gid_t gid)
-{
- STACK_WIND (frame, qr_fchown_cbk, FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->fchown, fd, uid, gid);
- return 0;
-}
-
-
-int32_t
-qr_fchown (call_frame_t *frame, xlator_t *this, fd_t *fd, uid_t uid, gid_t gid)
-{
- uint64_t value = 0;
- int flags = 0;
- call_stub_t *stub = NULL;
- char *path = NULL;
- loc_t loc = {0, };
- qr_fd_ctx_t *qr_fd_ctx = NULL;
- int32_t ret = -1, op_ret = -1, op_errno = -1;
- char need_open = 0, can_wind = 0, need_unwind = 0;
-
- ret = fd_ctx_get (fd, this, &value);
- if (ret == 0) {
- qr_fd_ctx = (qr_fd_ctx_t *)(long) value;
- }
-
- if (qr_fd_ctx) {
- LOCK (&qr_fd_ctx->lock);
- {
- path = qr_fd_ctx->path;
- flags = qr_fd_ctx->flags;
-
- if (!(qr_fd_ctx->opened
- || qr_fd_ctx->open_in_transit)) {
- need_open = 1;
- qr_fd_ctx->open_in_transit = 1;
- }
-
- if (qr_fd_ctx->opened) {
- can_wind = 1;
- } else {
- stub = fop_fchown_stub (frame, qr_fchown_helper,
- fd, uid, gid);
- if (stub == NULL) {
- op_ret = -1;
- op_errno = ENOMEM;
- need_unwind = 1;
- qr_fd_ctx->open_in_transit = 0;
- goto unlock;
- }
-
- list_add_tail (&stub->list,
- &qr_fd_ctx->waiting_ops);
- }
- }
- unlock:
- UNLOCK (&qr_fd_ctx->lock);
- } else {
- can_wind = 1;
- }
-
-out:
- if (need_unwind) {
- STACK_UNWIND (frame, op_ret, op_errno, NULL);
- } else if (can_wind) {
- STACK_WIND (frame, qr_fchown_cbk, FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->fchown, fd, uid, gid);
- } else if (need_open) {
- op_ret = qr_loc_fill (&loc, fd->inode, path);
- if (op_ret == -1) {
- qr_resume_pending_ops (qr_fd_ctx);
- goto out;
- }
-
- STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->open, &loc, flags, fd);
-
- qr_loc_wipe (&loc);
- }
-
- return 0;
-}
int32_t
-qr_fchmod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *buf)
+qr_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;
}
int32_t
-qr_fchmod_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, mode_t mode)
+qr_fsetattr_helper (call_frame_t *frame, xlator_t *this, fd_t *fd,
+ struct stat *stbuf, int32_t valid)
{
- STACK_WIND(frame, qr_fchmod_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fchmod, fd, mode);
+ STACK_WIND(frame, qr_fsetattr_cbk, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->fsetattr, fd, stbuf,
+ valid);
return 0;
}
int32_t
-qr_fchmod (call_frame_t *frame, xlator_t *this, fd_t *fd, mode_t mode)
+qr_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
+ struct stat *stbuf, int32_t valid)
{
uint64_t value = 0;
int flags = 0;
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
char *path = NULL;
loc_t loc = {0, };
qr_fd_ctx_t *qr_fd_ctx = NULL;
@@ -1326,8 +1238,9 @@ qr_fchmod (call_frame_t *frame, xlator_t *this, fd_t *fd, mode_t mode)
if (qr_fd_ctx->opened) {
can_wind = 1;
} else {
- stub = fop_fchmod_stub (frame, qr_fchmod_helper,
- fd, mode);
+ stub = fop_fsetattr_stub (frame,
+ qr_fsetattr_helper,
+ fd, stbuf, valid);
if (stub == NULL) {
op_ret = -1;
op_errno = ENOMEM;
@@ -1348,10 +1261,11 @@ qr_fchmod (call_frame_t *frame, xlator_t *this, fd_t *fd, mode_t mode)
out:
if (need_unwind) {
- STACK_UNWIND (frame, op_ret, op_errno, NULL);
+ STACK_UNWIND (frame, op_ret, op_errno, NULL, NULL);
} else if (can_wind) {
- STACK_WIND (frame, qr_fchmod_cbk, FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->fchmod, fd, mode);
+ STACK_WIND (frame, qr_fsetattr_cbk, FIRST_CHILD (this),
+ FIRST_CHILD (this)->fops->fsetattr, fd, stbuf,
+ valid);
} else if (need_open) {
op_ret = qr_loc_fill (&loc, fd->inode, path);
if (op_ret == -1) {
@@ -2292,8 +2206,6 @@ struct xlator_fops fops = {
.readv = qr_readv,
.writev = qr_writev,
.fstat = qr_fstat,
- .fchown = qr_fchown,
- .fchmod = qr_fchmod,
.fsetxattr = qr_fsetxattr,
.fgetxattr = qr_fgetxattr,
.flush = qr_flush,
@@ -2302,6 +2214,7 @@ struct xlator_fops fops = {
.fsync = qr_fsync,
.ftruncate = qr_ftruncate,
.lk = qr_lk,
+ .fsetattr = qr_fsetattr,
};
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c
index 49cf0b9bf..6d1c5a2bc 100644
--- a/xlators/performance/read-ahead/src/read-ahead.c
+++ b/xlators/performance/read-ahead/src/read-ahead.c
@@ -725,39 +725,6 @@ ra_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd)
int
-ra_fchown (call_frame_t *frame, xlator_t *this, fd_t *fd, uid_t uid, gid_t gid)
-{
- ra_file_t *file = NULL;
- fd_t *iter_fd = NULL;
- inode_t *inode = NULL;
- int ret = 0;
- uint64_t tmp_file = 0;
-
- inode = fd->inode;
-
- LOCK (&inode->lock);
- {
- list_for_each_entry (iter_fd, &inode->fd_list, inode_list) {
- ret = fd_ctx_get (iter_fd, this, &tmp_file);
- file = (ra_file_t *)(long)tmp_file;
-
- if (!file)
- continue;
- flush_region (frame, file, 0,
- file->pages.prev->offset + 1);
- }
- }
- UNLOCK (&inode->lock);
-
- STACK_WIND (frame, ra_attr_cbk,
- FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->fchown,
- fd, uid, gid);
- return 0;
-}
-
-
-int
ra_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset)
{
ra_file_t *file = NULL;
@@ -892,7 +859,6 @@ struct xlator_fops fops = {
.truncate = ra_truncate,
.ftruncate = ra_ftruncate,
.fstat = ra_fstat,
- .fchown = ra_fchown,
};
struct xlator_mops mops = {
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index 57bed9a52..67a61fc47 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -681,30 +681,6 @@ sp_stbuf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t
-sp_chmod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode)
-{
- sp_cache_t *cache = NULL;
-
- GF_VALIDATE_OR_GOTO (this->name, loc, unwind);
- GF_VALIDATE_OR_GOTO (this->name, loc->parent, unwind);
- GF_VALIDATE_OR_GOTO (this->name, loc->name, unwind);
-
- cache = sp_get_cache_inode (this, loc->parent, frame->root->pid);
- if (cache) {
- sp_cache_remove_entry (cache, (char *)loc->name, 0);
- }
-
- STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->chmod, loc, mode);
- return 0;
-
-unwind:
- SP_STACK_UNWIND (frame, -1, errno, NULL);
- return 0;
-}
-
-
-int32_t
sp_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, fd_t *fd)
{
@@ -983,100 +959,6 @@ unwind:
int32_t
-sp_fchmod (call_frame_t *frame, xlator_t *this, fd_t *fd, mode_t mode)
-{
- sp_fd_ctx_t *fd_ctx = NULL;
- sp_cache_t *cache = NULL;
- uint64_t value = 0;
- int32_t ret = 0;
- inode_t *parent = NULL;
- char *name = NULL;
-
- ret = fd_ctx_get (fd, this, &value);
- if (ret == -1) {
- errno = EINVAL;
- goto unwind;
- }
-
- fd_ctx = (void *)(long)value;
- name = fd_ctx->name;
- parent = fd_ctx->parent_inode;
-
- cache = sp_get_cache_inode (this, parent, frame->root->pid);
- if (cache) {
- sp_cache_remove_entry (cache, name, 0);
- }
-
- STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fchmod, fd, mode);
- return 0;
-
-unwind:
- SP_STACK_UNWIND (frame, -1, errno, NULL);
- return 0;
-}
-
-
-int32_t
-sp_chown (call_frame_t *frame, xlator_t *this, loc_t *loc, uid_t uid, gid_t gid)
-{
- sp_cache_t *cache = NULL;
-
- GF_VALIDATE_OR_GOTO (this->name, loc, unwind);
- GF_VALIDATE_OR_GOTO (this->name, loc->parent, unwind);
- GF_VALIDATE_OR_GOTO (this->name, loc->name, unwind);
-
- cache = sp_get_cache_inode (this, loc->parent, frame->root->pid);
- if (cache) {
- sp_cache_remove_entry (cache, (char *)loc->name, 0);
- }
-
- STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->chown, loc, uid, gid);
- return 0;
-
-unwind:
- SP_STACK_UNWIND (frame, -1, errno, NULL);
- return 0;
-}
-
-
-int32_t
-sp_fchown (call_frame_t *frame, xlator_t *this, fd_t *fd, uid_t uid, gid_t gid)
-{
- sp_fd_ctx_t *fd_ctx = NULL;
- sp_cache_t *cache = NULL;
- uint64_t value = 0;
- int32_t ret = 0;
- inode_t *parent = NULL;
- char *name = NULL;
-
- ret = fd_ctx_get (fd, this, &value);
- if (ret == -1) {
- errno = EINVAL;
- goto unwind;
- }
-
- fd_ctx = (void *)(long)value;
- name = fd_ctx->name;
- parent = fd_ctx->parent_inode;
-
- cache = sp_get_cache_inode (this, parent, frame->root->pid);
- if (cache) {
- sp_cache_remove_entry (cache, name, 0);
- }
-
- STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fchown, fd, uid, gid);
- return 0;
-
-unwind:
- SP_STACK_UNWIND (frame, -1, errno, NULL);
- return 0;
-}
-
-
-int32_t
sp_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset)
{
sp_cache_t *cache = NULL;
@@ -1136,8 +1018,18 @@ unwind:
int32_t
-sp_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc,
- struct timespec tv[2])
+sp_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ struct stat *prestat, struct stat *poststat)
+{
+ SP_STACK_UNWIND (frame, op_ret, op_errno, poststat);
+ return 0;
+}
+
+
+int
+sp_setattr (call_frame_t *frame, xlator_t *this,
+ loc_t *loc, struct stat *buf, int32_t valid)
{
sp_cache_t *cache = NULL;
@@ -1150,8 +1042,8 @@ sp_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc,
sp_cache_remove_entry (cache, (char *)loc->name, 0);
}
- STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->utimens, loc, tv);
+ STACK_WIND (frame, sp_setattr_cbk, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->setattr, loc, buf, valid);
return 0;
unwind:
@@ -1798,7 +1690,6 @@ fini (xlator_t *this)
struct xlator_fops fops = {
.lookup = sp_lookup,
.readdir = sp_readdir,
- .chmod = sp_chmod,
.open = sp_open,
.create = sp_create,
.opendir = sp_opendir,
@@ -1806,12 +1697,8 @@ struct xlator_fops fops = {
.mknod = sp_mknod,
.symlink = sp_symlink,
.link = sp_link,
- .fchmod = sp_fchmod,
- .chown = sp_chown,
- .fchown = sp_fchown,
.truncate = sp_truncate,
.ftruncate = sp_ftruncate,
- .utimens = sp_utimens,
.readlink = sp_readlink,
.unlink = sp_unlink,
.rmdir = sp_rmdir,
@@ -1826,6 +1713,7 @@ struct xlator_fops fops = {
.checksum = sp_checksum,
.xattrop = sp_xattrop,
.fxattrop = sp_fxattrop,
+ .setattr = sp_setattr,
};
struct xlator_mops mops = {