summaryrefslogtreecommitdiffstats
path: root/xlators/debug
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/debug
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/debug')
-rw-r--r--xlators/debug/error-gen/src/error-gen.c188
-rw-r--r--xlators/debug/io-stats/src/io-stats.c149
-rw-r--r--xlators/debug/trace/src/trace.c441
3 files changed, 239 insertions, 539 deletions
diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c
index a14d7bedaa0..5aee0af410b 100644
--- a/xlators/debug/error-gen/src/error-gen.c
+++ b/xlators/debug/error-gen/src/error-gen.c
@@ -129,157 +129,67 @@ error_gen_stat (call_frame_t *frame,
}
int32_t
-error_gen_chmod_cbk (call_frame_t *frame,
- void *cookie,
- xlator_t *this,
- int32_t op_ret,
- int32_t op_errno,
- struct stat *buf)
+error_gen_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);
+ preop, postop);
return 0;
}
int32_t
-error_gen_chmod (call_frame_t *frame,
- xlator_t *this,
- loc_t *loc,
- mode_t mode)
+error_gen_setattr (call_frame_t *frame,
+ xlator_t *this,
+ loc_t *loc,
+ struct stat *stbuf,
+ int32_t valid)
{
int op_errno = 0;
op_errno = error_gen(this);
if (op_errno) {
GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno));
- STACK_UNWIND (frame, -1, op_errno, NULL);
+ STACK_UNWIND (frame, -1, op_errno, NULL, NULL);
return 0;
}
STACK_WIND (frame,
- error_gen_chmod_cbk,
+ error_gen_setattr_cbk,
FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->chmod,
+ FIRST_CHILD(this)->fops->setattr,
loc,
- mode);
+ stbuf, valid);
return 0;
}
-
int32_t
-error_gen_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;
-}
-
-int32_t
-error_gen_fchmod (call_frame_t *frame,
- xlator_t *this,
- fd_t *fd,
- mode_t mode)
+error_gen_fsetattr (call_frame_t *frame,
+ xlator_t *this,
+ fd_t *fd,
+ struct stat *stbuf,
+ int32_t valid)
{
int op_errno = 0;
op_errno = error_gen(this);
if (op_errno) {
GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno));
- STACK_UNWIND (frame, -1, op_errno, NULL);
+ STACK_UNWIND (frame, -1, op_errno, NULL, NULL);
return 0;
}
STACK_WIND (frame,
- error_gen_fchmod_cbk,
+ error_gen_setattr_cbk,
FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fchmod,
+ FIRST_CHILD(this)->fops->fsetattr,
fd,
- mode);
- return 0;
-}
-
-int32_t
-error_gen_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;
-}
-
-int32_t
-error_gen_chown (call_frame_t *frame,
- xlator_t *this,
- loc_t *loc,
- uid_t uid,
- gid_t gid)
-{
- int op_errno = 0;
- op_errno = error_gen(this);
- if (op_errno) {
- GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno));
- STACK_UNWIND (frame, -1, op_errno, NULL);
- return 0;
- }
- STACK_WIND (frame,
- error_gen_chown_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->chown,
- loc,
- uid,
- gid);
+ stbuf, valid);
return 0;
}
-int32_t
-error_gen_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
-error_gen_fchown (call_frame_t *frame,
- xlator_t *this,
- fd_t *fd,
- uid_t uid,
- gid_t gid)
-{
- int op_errno = 0;
- op_errno = error_gen(this);
- if (op_errno) {
- GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno));
- STACK_UNWIND (frame, -1, op_errno, NULL);
- return 0;
- }
- STACK_WIND (frame,
- error_gen_fchown_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fchown,
- fd,
- uid,
- gid);
- return 0;
-}
int32_t
error_gen_truncate_cbk (call_frame_t *frame,
@@ -355,43 +265,6 @@ error_gen_ftruncate (call_frame_t *frame,
return 0;
}
-int32_t
-error_gen_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;
-}
-
-
-int32_t
-error_gen_utimens (call_frame_t *frame,
- xlator_t *this,
- loc_t *loc,
- struct timespec tv[2])
-{
- int op_errno = 0;
- op_errno = error_gen(this);
- if (op_errno) {
- GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno));
- STACK_UNWIND (frame, -1, op_errno, NULL);
- return 0;
- }
- STACK_WIND (frame,
- error_gen_utimens_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->utimens,
- loc,
- tv);
- return 0;
-}
int32_t
error_gen_access_cbk (call_frame_t *frame,
@@ -1740,10 +1613,7 @@ struct xlator_fops fops = {
.symlink = error_gen_symlink,
.rename = error_gen_rename,
.link = error_gen_link,
- .chmod = error_gen_chmod,
- .chown = error_gen_chown,
.truncate = error_gen_truncate,
- .utimens = error_gen_utimens,
.create = error_gen_create,
.open = error_gen_open,
.readv = error_gen_readv,
@@ -1762,8 +1632,6 @@ struct xlator_fops fops = {
.ftruncate = error_gen_ftruncate,
.fstat = error_gen_fstat,
.lk = error_gen_lk,
- .fchmod = error_gen_fchmod,
- .fchown = error_gen_fchown,
.setdents = error_gen_setdents,
.lookup_cbk = error_gen_lookup_cbk,
.checksum = error_gen_checksum,
@@ -1772,7 +1640,9 @@ struct xlator_fops fops = {
.inodelk = error_gen_inodelk,
.finodelk = error_gen_finodelk,
.entrylk = error_gen_entrylk,
- .fentrylk = error_gen_fentrylk
+ .fentrylk = error_gen_fentrylk,
+ .setattr = error_gen_setattr,
+ .fsetattr = error_gen_fsetattr,
};
struct xlator_mops mops = {
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index c0768501752..662762100fe 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -187,50 +187,15 @@ io_stats_fsync_cbk (call_frame_t *frame,
}
int32_t
-io_stats_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;
-}
-
-int32_t
-io_stats_chmod_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
-io_stats_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;
-}
-
-int32_t
-io_stats_fchown_cbk (call_frame_t *frame,
- void *cookie,
- xlator_t *this,
- int32_t op_ret,
- int32_t op_errno,
- struct stat *buf)
+io_stats_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;
}
@@ -857,39 +822,20 @@ io_stats_link (call_frame_t *frame,
}
int32_t
-io_stats_chmod (call_frame_t *frame,
- xlator_t *this,
- loc_t *loc,
- mode_t mode)
-{
- BUMP_HIT(CHMOD);
-
- STACK_WIND (frame,
- io_stats_chmod_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->chmod,
- loc,
- mode);
-
- return 0;
-}
-
-int32_t
-io_stats_chown (call_frame_t *frame,
- xlator_t *this,
- loc_t *loc,
- uid_t uid,
- gid_t gid)
+io_stats_setattr (call_frame_t *frame,
+ xlator_t *this,
+ loc_t *loc,
+ struct stat *stbuf,
+ int32_t valid)
{
- BUMP_HIT(CHOWN);
+ BUMP_HIT(SETATTR);
STACK_WIND (frame,
- io_stats_chown_cbk,
+ io_stats_setattr_cbk,
FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->chown,
+ FIRST_CHILD(this)->fops->setattr,
loc,
- uid,
- gid);
+ stbuf, valid);
return 0;
}
@@ -913,24 +859,6 @@ io_stats_truncate (call_frame_t *frame,
}
int32_t
-io_stats_utimens (call_frame_t *frame,
- xlator_t *this,
- loc_t *loc,
- struct timespec tv[2])
-{
- BUMP_HIT(UTIMENS);
-
- STACK_WIND (frame,
- io_stats_utimens_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->utimens,
- loc,
- tv);
-
- return 0;
-}
-
-int32_t
io_stats_open (call_frame_t *frame,
xlator_t *this,
loc_t *loc,
@@ -1238,38 +1166,20 @@ io_stats_ftruncate (call_frame_t *frame,
}
int32_t
-io_stats_fchown (call_frame_t *frame,
- xlator_t *this,
- fd_t *fd,
- uid_t uid,
- gid_t gid)
-{
- BUMP_HIT(FCHOWN);
-
- STACK_WIND (frame,
- io_stats_fchown_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fchown,
- fd,
- uid,
- gid);
- return 0;
-}
-
-int32_t
-io_stats_fchmod (call_frame_t *frame,
- xlator_t *this,
- fd_t *fd,
- mode_t mode)
+io_stats_fsetattr (call_frame_t *frame,
+ xlator_t *this,
+ fd_t *fd,
+ struct stat *stbuf,
+ int32_t valid)
{
- BUMP_HIT(FCHMOD);
+ BUMP_HIT(FSETATTR);
STACK_WIND (frame,
- io_stats_fchmod_cbk,
+ io_stats_setattr_cbk,
FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fchmod,
+ FIRST_CHILD(this)->fops->fsetattr,
fd,
- mode);
+ stbuf, valid);
return 0;
}
@@ -1513,10 +1423,7 @@ struct xlator_fops fops = {
.symlink = io_stats_symlink,
.rename = io_stats_rename,
.link = io_stats_link,
- .chmod = io_stats_chmod,
- .chown = io_stats_chown,
.truncate = io_stats_truncate,
- .utimens = io_stats_utimens,
.open = io_stats_open,
.readv = io_stats_readv,
.writev = io_stats_writev,
@@ -1533,8 +1440,6 @@ struct xlator_fops fops = {
.ftruncate = io_stats_ftruncate,
.fstat = io_stats_fstat,
.create = io_stats_create,
- .fchown = io_stats_fchown,
- .fchmod = io_stats_fchmod,
.lk = io_stats_lk,
.inodelk = io_stats_inodelk,
.finodelk = io_stats_finodelk,
@@ -1545,6 +1450,8 @@ struct xlator_fops fops = {
.checksum = io_stats_checksum,
.xattrop = io_stats_xattrop,
.fxattrop = io_stats_fxattrop,
+ .setattr = io_stats_setattr,
+ .fsetattr = io_stats_fsetattr,
};
struct xlator_mops mops = {
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index 2c10c751532..2b66720a0cb 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -296,138 +296,123 @@ trace_fsync_cbk (call_frame_t *frame,
return 0;
}
-int32_t
-trace_chown_cbk (call_frame_t *frame,
- void *cookie,
- xlator_t *this,
- int32_t op_ret,
- int32_t op_errno,
- struct stat *buf)
-{
- char atime_buf[256], mtime_buf[256], ctime_buf[256];
- ERR_EINVAL_NORETURN (!this );
-
- if (trace_fop_names[GF_FOP_CHOWN].enabled) {
- if (op_ret >= 0) {
- strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime));
- strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime));
- strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime));
-
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (op_ret=%d, *buf {st_ino=%"PRIu64", st_mode=%o, "
- "st_uid=%d, st_gid=%d, st_atime=%s, st_mtime=%s, st_ctime=%s})",
- frame->root->unique, op_ret, buf->st_ino, buf->st_mode,
- buf->st_uid, buf->st_gid, atime_buf, mtime_buf, ctime_buf);
- } else {
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
- }
- }
-
- STACK_UNWIND (frame, op_ret, op_errno, buf);
- return 0;
-}
+int32_t
+trace_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)
+{
+ char atime_pre[256] = {0,};
+ char mtime_pre[256] = {0,};
+ char ctime_pre[256] = {0,};
+ char atime_post[256] = {0,};
+ char mtime_post[256] = {0,};
+ char ctime_post[256] = {0,};
-int32_t
-trace_chmod_cbk (call_frame_t *frame,
- void *cookie,
- xlator_t *this,
- int32_t op_ret,
- int32_t op_errno,
- struct stat *buf)
-{
- char atime_buf[256], mtime_buf[256], ctime_buf[256];
ERR_EINVAL_NORETURN (!this );
- if (trace_fop_names[GF_FOP_CHMOD].enabled) {
+ if (trace_fop_names[GF_FOP_SETATTR].enabled) {
if (op_ret >= 0) {
- strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime));
- strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime));
- strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime));
+ strftime (atime_pre, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpre->st_atime));
+ strftime (mtime_pre, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpre->st_mtime));
+ strftime (ctime_pre, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpre->st_ctime));
+
+ strftime (atime_post, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpost->st_atime));
+ strftime (mtime_post, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpost->st_mtime));
+ strftime (ctime_post, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpost->st_ctime));
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (op_ret=%d, *buf {st_ino=%"PRIu64", st_mode=%o, "
- "st_atime=%s, st_mtime=%s, st_ctime=%s})",
- frame->root->unique, op_ret, buf->st_ino, buf->st_mode,
- atime_buf, mtime_buf, ctime_buf);
+ gf_log (this->name, GF_LOG_NORMAL,
+ "%"PRId64": (op_ret=%d, *statpre "
+ "{st_ino=%"PRIu64", st_mode=%o, st_uid=%d, "
+ "st_gid=%d, st_atime=%s, st_mtime=%s, "
+ "st_ctime=%s}, *statpost {st_ino=%"PRIu64", "
+ "st_mode=%o, st_uid=%d, st_gid=%d, st_atime=%s,"
+ " st_mtime=%s, st_ctime=%s})",
+ frame->root->unique, op_ret, statpre->st_ino,
+ statpre->st_mode, statpre->st_uid,
+ statpre->st_gid, atime_pre, mtime_pre,
+ ctime_pre, statpost->st_ino, statpost->st_mode,
+ statpost->st_uid, statpost->st_gid, atime_post,
+ mtime_post, ctime_post);
} else {
- gf_log (this->name, GF_LOG_NORMAL,
+ gf_log (this->name, GF_LOG_NORMAL,
"%"PRId64": (op_ret=%d, op_errno=%d)",
frame->root->unique, op_ret, op_errno);
}
}
- STACK_UNWIND (frame, op_ret, op_errno, buf);
+ STACK_UNWIND (frame, op_ret, op_errno, statpre, statpost);
return 0;
}
-int32_t
-trace_fchmod_cbk (call_frame_t *frame,
- void *cookie,
- xlator_t *this,
- int32_t op_ret,
- int32_t op_errno,
- struct stat *buf)
-{
- char atime_buf[256], mtime_buf[256], ctime_buf[256];
- ERR_EINVAL_NORETURN (!this );
-
- if (trace_fop_names[GF_FOP_FCHMOD].enabled) {
- if (op_ret >= 0) {
- strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime));
- strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime));
- strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime));
-
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (op_ret=%d, *buf {st_ino=%"PRIu64", st_mode=%o, "
- "st_atime=%s, st_mtime=%s, st_ctime=%s})",
- frame->root->unique, op_ret, buf->st_ino, buf->st_mode,
- atime_buf, mtime_buf, ctime_buf);
- } else {
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
- }
- }
-
- STACK_UNWIND (frame, op_ret, op_errno, buf);
- return 0;
-}
+int32_t
+trace_fsetattr_cbk (call_frame_t *frame,
+ void *cookie,
+ xlator_t *this,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *statpre,
+ struct stat *statpost)
+{
+ char atime_pre[256] = {0,};
+ char mtime_pre[256] = {0,};
+ char ctime_pre[256] = {0,};
+ char atime_post[256] = {0,};
+ char mtime_post[256] = {0,};
+ char ctime_post[256] = {0,};
-int32_t
-trace_fchown_cbk (call_frame_t *frame,
- void *cookie,
- xlator_t *this,
- int32_t op_ret,
- int32_t op_errno,
- struct stat *buf)
-{
- char atime_buf[256], mtime_buf[256], ctime_buf[256];
ERR_EINVAL_NORETURN (!this );
- if (trace_fop_names[GF_FOP_FCHOWN].enabled) {
+ if (trace_fop_names[GF_FOP_FSETATTR].enabled) {
if (op_ret >= 0) {
- strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime));
- strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime));
- strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime));
+ strftime (atime_pre, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpre->st_atime));
+ strftime (mtime_pre, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpre->st_mtime));
+ strftime (ctime_pre, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpre->st_ctime));
+
+ strftime (atime_post, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpost->st_atime));
+ strftime (mtime_post, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpost->st_mtime));
+ strftime (ctime_post, 256, "[%b %d %H:%M:%S]",
+ localtime (&statpost->st_ctime));
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (op_ret=%d, *buf {st_ino=%"PRIu64", st_mode=%o, "
- "st_uid=%d, st_gid=%d, st_atime=%s, st_mtime=%s, st_ctime=%s})",
- frame->root->unique, op_ret, buf->st_ino, buf->st_mode,
- buf->st_uid, buf->st_gid, atime_buf, mtime_buf, ctime_buf);
+ gf_log (this->name, GF_LOG_NORMAL,
+ "%"PRId64": (op_ret=%d, *statpre "
+ "{st_ino=%"PRIu64", st_mode=%o, st_uid=%d, "
+ "st_gid=%d, st_atime=%s, st_mtime=%s, "
+ "st_ctime=%s}, *statpost {st_ino=%"PRIu64", "
+ "st_mode=%o, st_uid=%d, st_gid=%d, st_atime=%s,"
+ " st_mtime=%s, st_ctime=%s})",
+ frame->root->unique, op_ret, statpre->st_ino,
+ statpre->st_mode, statpre->st_uid,
+ statpre->st_gid, atime_pre, mtime_pre,
+ ctime_pre, statpost->st_ino, statpost->st_mode,
+ statpost->st_uid, statpost->st_gid, atime_post,
+ mtime_post, ctime_post);
} else {
- gf_log (this->name, GF_LOG_NORMAL,
+ gf_log (this->name, GF_LOG_NORMAL,
"%"PRId64": (op_ret=%d, op_errno=%d)",
frame->root->unique, op_ret, op_errno);
}
}
- STACK_UNWIND (frame, op_ret, op_errno, buf);
+ STACK_UNWIND (frame, op_ret, op_errno, statpre, statpost);
return 0;
}
+
int32_t
trace_unlink_cbk (call_frame_t *frame,
void *cookie,
@@ -737,38 +722,6 @@ trace_truncate_cbk (call_frame_t *frame,
}
int32_t
-trace_utimens_cbk (call_frame_t *frame,
- void *cookie,
- xlator_t *this,
- int32_t op_ret,
- int32_t op_errno,
- struct stat *buf)
-{
- char atime_buf[256], mtime_buf[256], ctime_buf[256];
- ERR_EINVAL_NORETURN (!this );
-
- if (trace_fop_names[GF_FOP_UTIMENS].enabled) {
- if (op_ret >= 0) {
- strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime));
- strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime));
- strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime));
-
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (op_ret=%d, *buf {st_atime=%s, st_mtime=%s, "
- "st_ctime=%s})",
- frame->root->unique, op_ret, atime_buf, mtime_buf, ctime_buf);
- } else {
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
- }
- }
-
- STACK_UNWIND (frame, op_ret, op_errno, buf);
- return 0;
-}
-
-int32_t
trace_statfs_cbk (call_frame_t *frame,
void *cookie,
xlator_t *this,
@@ -1469,52 +1422,105 @@ trace_link (call_frame_t *frame,
return 0;
}
-int32_t
-trace_chmod (call_frame_t *frame,
- xlator_t *this,
- loc_t *loc,
- mode_t mode)
-{
- ERR_EINVAL_NORETURN (!this || !loc);
-
- if (trace_fop_names[GF_FOP_CHMOD].enabled) {
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, mode=%o)",
- frame->root->unique, loc->path, loc->inode->ino, mode);
+int32_t
+trace_setattr (call_frame_t *frame,
+ xlator_t *this,
+ loc_t *loc,
+ struct stat *stbuf,
+ int32_t valid)
+{
+ char actime_str[256] = {0,};
+ char modtime_str[256] = {0,};
+
+ ERR_EINVAL_NORETURN (!this || !loc || !stbuf);
+
+ if (trace_fop_names[GF_FOP_SETATTR].enabled) {
+ if (valid & GF_SET_ATTR_MODE) {
+ gf_log (this->name, GF_LOG_NORMAL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"},"
+ " mode=%o)", frame->root->unique, loc->path,
+ loc->inode->ino, stbuf->st_mode);
+ }
+
+ if (valid & (GF_SET_ATTR_UID | GF_SET_ATTR_GID)) {
+ gf_log (this->name, GF_LOG_NORMAL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"},"
+ " uid=%o, gid=%o)",
+ frame->root->unique, loc->path, loc->inode->ino,
+ stbuf->st_uid, stbuf->st_gid);
+ }
+
+ if (valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME)) {
+ strftime (actime_str, 256, "[%b %d %H:%M:%S]",
+ localtime (&stbuf->st_atime));
+ strftime (modtime_str, 256, "[%b %d %H:%M:%S]",
+ localtime (&stbuf->st_mtime));
+
+ gf_log (this->name, GF_LOG_NORMAL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, "
+ "*stbuf=%p {st_atime=%s, st_mtime=%s})",
+ frame->root->unique, loc->path, loc->inode->ino,
+ stbuf, actime_str, modtime_str);
+ }
}
- STACK_WIND (frame,
- trace_chmod_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->chmod,
+ STACK_WIND (frame,
+ trace_setattr_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->setattr,
loc,
- mode);
-
+ stbuf, valid);
+
return 0;
}
-int32_t
-trace_chown (call_frame_t *frame,
- xlator_t *this,
- loc_t *loc,
- uid_t uid,
- gid_t gid)
-{
- ERR_EINVAL_NORETURN (!this || !loc);
-
- if (trace_fop_names[GF_FOP_CHOWN].enabled) {
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, uid=%d, gid=%d)",
- frame->root->unique, loc->path, loc->inode->ino, uid, gid);
+int32_t
+trace_fsetattr (call_frame_t *frame,
+ xlator_t *this,
+ fd_t *fd,
+ struct stat *stbuf,
+ int32_t valid)
+{
+ char actime_str[256] = {0,};
+ char modtime_str[256] = {0,};
+
+ ERR_EINVAL_NORETURN (!this || !fd || !stbuf);
+
+ if (trace_fop_names[GF_FOP_FSETATTR].enabled) {
+ if (valid & GF_SET_ATTR_MODE) {
+ gf_log (this->name, GF_LOG_NORMAL,
+ "%"PRId64": (*fd=%p, mode=%o)",
+ frame->root->unique, fd,
+ stbuf->st_mode);
+ }
+
+ if (valid & (GF_SET_ATTR_UID | GF_SET_ATTR_GID)) {
+ gf_log (this->name, GF_LOG_NORMAL,
+ "%"PRId64": (*fd=%p, uid=%o, gid=%o)",
+ frame->root->unique, fd,
+ stbuf->st_uid, stbuf->st_gid);
+ }
+
+ if (valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME)) {
+ strftime (actime_str, 256, "[%b %d %H:%M:%S]",
+ localtime (&stbuf->st_atime));
+ strftime (modtime_str, 256, "[%b %d %H:%M:%S]",
+ localtime (&stbuf->st_mtime));
+
+ gf_log (this->name, GF_LOG_NORMAL,
+ "%"PRId64": (*fd=%p"
+ "*stbuf=%p {st_atime=%s, st_mtime=%s})",
+ frame->root->unique, fd, stbuf, actime_str,
+ modtime_str);
+ }
}
- STACK_WIND (frame,
- trace_chown_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->chown,
- loc,
- uid,
- gid);
+ STACK_WIND (frame,
+ trace_fsetattr_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->fsetattr,
+ fd,
+ stbuf, valid);
return 0;
}
@@ -1544,38 +1550,6 @@ trace_truncate (call_frame_t *frame,
}
int32_t
-trace_utimens (call_frame_t *frame,
- xlator_t *this,
- loc_t *loc,
- struct timespec tv[2])
-{
- char actime_str[256];
- char modtime_str[256];
-
- ERR_EINVAL_NORETURN (!this || !loc || !tv);
-
- if (trace_fop_names[GF_FOP_UTIMENS].enabled) {
- strftime (actime_str, 256, "[%b %d %H:%M:%S]", localtime (&tv[0].tv_sec));
- strftime (modtime_str, 256, "[%b %d %H:%M:%S]", localtime (&tv[1].tv_sec));
-
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, "
- "*tv=%p {actime=%s, modtime=%s})",
- frame->root->unique, loc->path, loc->inode->ino,
- tv, actime_str, modtime_str);
- }
-
- STACK_WIND (frame,
- trace_utimens_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->utimens,
- loc,
- tv);
-
- return 0;
-}
-
-int32_t
trace_open (call_frame_t *frame,
xlator_t *this,
loc_t *loc,
@@ -1972,54 +1946,6 @@ trace_ftruncate (call_frame_t *frame,
}
int32_t
-trace_fchown (call_frame_t *frame,
- xlator_t *this,
- fd_t *fd,
- uid_t uid,
- gid_t gid)
-{
- ERR_EINVAL_NORETURN (!this || !fd);
-
- if (trace_fop_names[GF_FOP_FCHOWN].enabled) {
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (*fd=%p, uid=%d, gid=%d)",
- frame->root->unique, fd, uid, gid);
- }
-
- STACK_WIND (frame,
- trace_fchown_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fchown,
- fd,
- uid,
- gid);
- return 0;
-}
-
-int32_t
-trace_fchmod (call_frame_t *frame,
- xlator_t *this,
- fd_t *fd,
- mode_t mode)
-{
- ERR_EINVAL_NORETURN (!this || !fd);
-
- if (trace_fop_names[GF_FOP_FCHMOD].enabled) {
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (mode=%o, *fd=%p)",
- frame->root->unique, mode, fd);
- }
-
- STACK_WIND (frame,
- trace_fchmod_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fchmod,
- fd,
- mode);
- return 0;
-}
-
-int32_t
trace_fstat (call_frame_t *frame,
xlator_t *this,
fd_t *fd)
@@ -2275,10 +2201,7 @@ struct xlator_fops fops = {
.symlink = trace_symlink,
.rename = trace_rename,
.link = trace_link,
- .chmod = trace_chmod,
- .chown = trace_chown,
.truncate = trace_truncate,
- .utimens = trace_utimens,
.open = trace_open,
.readv = trace_readv,
.writev = trace_writev,
@@ -2295,8 +2218,6 @@ struct xlator_fops fops = {
.ftruncate = trace_ftruncate,
.fstat = trace_fstat,
.create = trace_create,
- .fchown = trace_fchown,
- .fchmod = trace_fchmod,
.lk = trace_lk,
.inodelk = trace_inodelk,
.finodelk = trace_finodelk,
@@ -2307,6 +2228,8 @@ struct xlator_fops fops = {
.checksum = trace_checksum,
.xattrop = trace_xattrop,
.fxattrop = trace_fxattrop,
+ .setattr = trace_setattr,
+ .fsetattr = trace_fsetattr,
};
struct xlator_mops mops = {