summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2009-10-05 09:45:52 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-06 07:22:16 -0700
commit29f81133a6cd95ebc9fac627a4fb0da73977f5a8 (patch)
treebf5a633b59b8bce4a28023f39a35fb5d89dcf4bd /xlators
parentf3e46f2cb44e95c453bfa20c870dca6e42fc9a7a (diff)
Removed remaining references to chmod, chown and utimens as part of setattr changes.
Removed references to chmod, chown and utimes. Removed utimes references in AFR and writebehind. 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')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-data.c33
-rw-r--r--xlators/cluster/afr/src/afr.c5
-rw-r--r--xlators/performance/write-behind/src/write-behind.c42
3 files changed, 44 insertions, 36 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
index 5300f0a7528..66aa01dc271 100644
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
@@ -106,8 +106,8 @@ afr_sh_data_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-afr_sh_data_utimes_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *buf)
+afr_sh_data_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct stat *statpre, struct stat *statpost)
{
afr_sh_data_flush_cbk (frame, cookie, this, op_ret, op_errno);
@@ -126,8 +126,9 @@ afr_sh_data_close (call_frame_t *frame, xlator_t *this)
int call_count = 0;
int source = 0;
int active_sinks = 0;
+ int32_t valid = 0;
- struct timespec ts[2];
+ struct stat stbuf = {0,};
local = frame->local;
sh = &local->self_heal;
@@ -136,16 +137,18 @@ afr_sh_data_close (call_frame_t *frame, xlator_t *this)
source = sh->source;
active_sinks = sh->active_sinks;
+ valid |= (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME);
+
#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- ts[0] = sh->buf[source].st_atim;
- ts[1] = sh->buf[source].st_mtim;
+ stbuf.st_atim = sh->buf[source].st_atim;
+ stbuf.st_mtim = sh->buf[source].st_mtim;
#elif HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- ts[0] = sh->buf[source].st_atimespec;
- ts[1] = sh->buf[source].st_mtimespec;
+ stbuf.st_atimespec = sh->buf[source].st_atimespec;
+ stbuf.st_mtimespec = sh->buf[source].st_mtimespec;
#else
- ts[0].tv_sec = sh->buf[source].st_atime;
- ts[1].tv_sec = sh->buf[source].st_mtime;
+ stbuf.st_atime = sh->buf[source].st_atime;
+ stbuf.st_mtime = sh->buf[source].st_mtime;
#endif
if (!sh->healing_fd) {
@@ -168,11 +171,11 @@ afr_sh_data_close (call_frame_t *frame, xlator_t *this)
sh->healing_fd);
call_count--;
- STACK_WIND_COOKIE (frame, afr_sh_data_utimes_cbk,
+ STACK_WIND_COOKIE (frame, afr_sh_data_setattr_cbk,
(void *) (long) sh->source,
priv->children[sh->source],
- priv->children[sh->source]->fops->utimens,
- &local->loc, ts);
+ priv->children[sh->source]->fops->setattr,
+ &local->loc, &stbuf, valid);
call_count--;
@@ -192,11 +195,11 @@ afr_sh_data_close (call_frame_t *frame, xlator_t *this)
call_count--;
- STACK_WIND_COOKIE (frame, afr_sh_data_utimes_cbk,
+ STACK_WIND_COOKIE (frame, afr_sh_data_setattr_cbk,
(void *) (long) i,
priv->children[i],
- priv->children[i]->fops->utimens,
- &local->loc, ts);
+ priv->children[i]->fops->setattr,
+ &local->loc, &stbuf, valid);
if (!--call_count)
break;
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index babcbae8c26..6e69e53d776 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -2596,14 +2596,9 @@ struct xlator_fops fops = {
.readv = afr_readv,
/* inode write */
- .chmod = afr_chmod,
- .chown = afr_chown,
- .fchmod = afr_fchmod,
- .fchown = afr_fchown,
.writev = afr_writev,
.truncate = afr_truncate,
.ftruncate = afr_ftruncate,
- .utimens = afr_utimens,
.setxattr = afr_setxattr,
.setattr = afr_setattr,
.fsetattr = afr_fsetattr,
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 29ae081c351..478202638e6 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -1040,8 +1040,8 @@ unwind:
int32_t
-wb_utimens_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *buf)
+wb_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct stat *statpre, struct stat *statpost)
{
wb_local_t *local = NULL;
wb_request_t *request = NULL;
@@ -1062,7 +1062,7 @@ wb_utimens_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
- STACK_UNWIND (frame, op_ret, op_errno, buf);
+ STACK_UNWIND (frame, op_ret, op_errno, statpre, statpost);
if (request) {
wb_request_unref (request);
@@ -1097,23 +1097,24 @@ wb_utimens_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
static int32_t
-wb_utimens_helper (call_frame_t *frame, xlator_t *this, loc_t *loc,
- struct timespec tv[2])
+wb_setattr_helper (call_frame_t *frame, xlator_t *this, loc_t *loc,
+ struct stat *stbuf, int32_t valid)
{
STACK_WIND (frame,
- wb_utimens_cbk,
+ wb_setattr_cbk,
FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->utimens,
+ FIRST_CHILD(this)->fops->setattr,
loc,
- tv);
+ stbuf,
+ valid);
return 0;
}
int32_t
-wb_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc,
- struct timespec tv[2])
+wb_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
+ struct stat *stbuf, int32_t valid)
{
wb_file_t *file = NULL;
fd_t *iter_fd = NULL;
@@ -1123,6 +1124,15 @@ wb_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc,
wb_request_t *request = NULL;
int32_t ret = -1, op_errno = EINVAL;
+ if (!(valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME))) {
+ STACK_WIND (frame,
+ wb_setattr_cbk,
+ FIRST_CHILD (this),
+ FIRST_CHILD (this)->fops->setattr,
+ loc, stbuf, valid);
+ goto out;
+ }
+
if (loc->inode) {
/*
FIXME: fd_lookup extends life of fd till the execution
@@ -1150,7 +1160,7 @@ wb_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc,
frame->local = local;
if (file) {
- stub = fop_utimens_stub (frame, wb_utimens_helper, loc, tv);
+ stub = fop_setattr_stub (frame, wb_setattr_helper, loc, stbuf, valid);
if (stub == NULL) {
op_errno = ENOMEM;
goto unwind;
@@ -1169,11 +1179,11 @@ wb_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc,
}
} else {
STACK_WIND (frame,
- wb_utimens_cbk,
+ wb_setattr_cbk,
FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->utimens,
+ FIRST_CHILD(this)->fops->setattr,
loc,
- tv);
+ stbuf, valid);
}
return 0;
@@ -1183,7 +1193,7 @@ unwind:
if (stub) {
call_stub_destroy (stub);
}
-
+out:
return 0;
}
@@ -2482,7 +2492,7 @@ struct xlator_fops fops = {
.fstat = wb_fstat,
.truncate = wb_truncate,
.ftruncate = wb_ftruncate,
- .utimens = wb_utimens,
+ .setattr = wb_setattr,
};
struct xlator_mops mops = {