diff options
author | Kotresh HR <khiremat@redhat.com> | 2018-05-05 00:05:09 -0400 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-05-06 07:09:19 +0530 |
commit | 17e3f617086da785a3678d7cfa8f68ebd1497023 (patch) | |
tree | 8694053a2076c9445b113ff48c57ffb4578b2ef0 /xlators/storage/posix/src/posix-metadata.c | |
parent | 99cba93daadd29967d26621d1deee842d94483a8 (diff) |
glusterd/ctime: Provide option to enable/disable ctime feature
Updates: #208
Change-Id: If6f52b9b1b5b823ad64faeed662e96ceb848c54c
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-metadata.c')
-rw-r--r-- | xlators/storage/posix/src/posix-metadata.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/xlators/storage/posix/src/posix-metadata.c b/xlators/storage/posix/src/posix-metadata.c index 90030ff28bd..fda8fb5eaec 100644 --- a/xlators/storage/posix/src/posix-metadata.c +++ b/xlators/storage/posix/src/posix-metadata.c @@ -487,7 +487,11 @@ posix_update_utime_in_mdata (xlator_t *this, const char *real_path, int fd, #endif posix_mdata_flag_t flag = {0, }; - if (inode && is_ctime_enabled()) { + struct posix_private *priv = NULL; + + priv = this->private; + + if (inode && priv->ctime) { if ((valid & GF_SET_ATTR_ATIME) == GF_SET_ATTR_ATIME) { tv.tv_sec = stbuf->ia_atime; SET_TIMESPEC_NSEC_OR_TIMEVAL_USEC(tv, stbuf->ia_atime_nsec); @@ -522,14 +526,6 @@ posix_update_utime_in_mdata (xlator_t *this, const char *real_path, int fd, return; } -gf_boolean_t -is_ctime_enabled () { - /* TODO: This gets implemented once glusterd changes are in place to - * * enable and disable ctime feature - * */ - return _gf_false; -} - static void posix_get_mdata_flag (uint64_t flags, posix_mdata_flag_t *flag) { @@ -572,8 +568,11 @@ posix_set_ctime (call_frame_t *frame, xlator_t *this, const char* real_path, { posix_mdata_flag_t flag = {0,}; int ret = 0; + struct posix_private *priv = NULL; + + priv = this->private; - if (inode && is_ctime_enabled()) { + if (inode && priv->ctime) { (void) posix_get_mdata_flag (frame->root->flags, &flag); ret = posix_set_mdata_xattr (this, real_path, fd, inode, &frame->root->ctime, stbuf, &flag); @@ -598,8 +597,11 @@ posix_set_parent_ctime (call_frame_t *frame, xlator_t *this, { posix_mdata_flag_t flag = {0,}; int ret = 0; + struct posix_private *priv = NULL; + + priv = this->private; - if (inode && is_ctime_enabled()) { + if (inode && priv->ctime) { (void) posix_get_parent_mdata_flag (frame->root->flags, &flag); ret = posix_set_mdata_xattr (this, real_path, fd, inode, &frame->root->ctime, stbuf, &flag); |