diff options
author | Joseph Fernandes <josferna@redhat.com> | 2015-11-08 15:33:15 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-11-15 13:47:48 -0800 |
commit | d4aaa00d77d7a10748a1ca9af82265ad9ac42598 (patch) | |
tree | 28c701f3e83fdda8c05b2434e18f24a691c91b23 /xlators/features/changetimerecorder/src/ctr-helper.h | |
parent | 4af4c1acc7b77d70af1b09964c7cbddb5c797214 (diff) | |
download | glusterfs-d4aaa00d77d7a10748a1ca9af82265ad9ac42598.tar.gz glusterfs-d4aaa00d77d7a10748a1ca9af82265ad9ac42598.tar.xz glusterfs-d4aaa00d77d7a10748a1ca9af82265ad9ac42598.zip |
tier/ctr: Providing option to record or ignore metadata heat
Currently we heat up a file for both data and metadata write.
Here we provide a ctr xlator option called "ctr-record-metadata-heat"
were the admin can decide on recording metadata heat i.e heatup a
file on metadata writes or not.
Metadata data operation are
a. setattr: explicit changing of atime/mtime using utimes,
changing of posix permissions of the file
b. rename: Renaming a file,
c. unlink, link: adding or deleting hardlinks
d. xattrs: setting or removal of xattrs.
NOTE: atime, mtime and ctime change through writev, readv, truncate, mknod
and create will not be considered here as these fops are data and primary
metadata fops.
Defaultly "ctr-record-metadata-heat" is off. Admin can
switch it on using gluster volume set command.
Change-Id: I91157509255dd5cb429cda2b6d4f64582e155e7b
BUG: 1279166
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Reviewed-on: http://review.gluster.org/12540
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/features/changetimerecorder/src/ctr-helper.h')
-rw-r--r-- | xlators/features/changetimerecorder/src/ctr-helper.h | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/xlators/features/changetimerecorder/src/ctr-helper.h b/xlators/features/changetimerecorder/src/ctr-helper.h index 5599bdd428..161fff2d77 100644 --- a/xlators/features/changetimerecorder/src/ctr-helper.h +++ b/xlators/features/changetimerecorder/src/ctr-helper.h @@ -45,6 +45,7 @@ typedef struct gf_ctr_private { gf_boolean_t ctr_record_wind; gf_boolean_t ctr_record_unwind; gf_boolean_t ctr_record_counter; + gf_boolean_t ctr_record_metadata_heat; gf_boolean_t ctr_link_consistency; gfdb_db_type_t gfdb_db_type; gfdb_sync_type_t gfdb_sync_type; @@ -78,7 +79,7 @@ typedef struct gf_ctr_local { gfdb_db_record_t gfdb_db_record; ia_type_t ia_inode_type; gf_boolean_t is_internal_fop; - gf_client_pid_t client_pid; + gf_client_pid_t client_pid; } gf_ctr_local_t; /* * Easy access of gfdb_db_record of ctr_local @@ -171,6 +172,8 @@ typedef struct gf_ctr_inode_context { gfdb_fop_type_t fop_type; gfdb_fop_path_t fop_path; gf_boolean_t is_internal_fop; + /* Indicating metadata fops */ + gf_boolean_t is_metadata_fop; } gf_ctr_inode_context_t; @@ -338,6 +341,19 @@ do {\ goto label;\ } while (0) +/* + * IS CTR record metadata heat is disabled then goto to label + * */ + #define CTR_RECORD_METADATA_HEAT_IS_DISABLED_THEN_GOTO(this, label)\ + do {\ + gf_ctr_private_t *_priv = NULL;\ + GF_ASSERT (this);\ + GF_ASSERT (this->private);\ + _priv = this->private;\ + if (!_priv->ctr_record_metadata_heat)\ + goto label;\ + } while (0) + int fill_db_record_for_unwind (xlator_t *this, gf_ctr_local_t *ctr_local, @@ -390,16 +406,41 @@ ctr_insert_wind (call_frame_t *frame, ctr_local->is_internal_fop = ctr_inode_cx->is_internal_fop; /* Decide whether to record counters or not */ - CTR_DB_REC(ctr_local).do_record_counters = - _priv->ctr_record_counter && - !(ctr_local->is_internal_fop); + CTR_DB_REC(ctr_local).do_record_counters = _gf_false; + /* If record counter is enabled */ + if (_priv->ctr_record_counter) { + /* If not a internal fop */ + if (!(ctr_local->is_internal_fop)) { + /* If its a metadata fop AND + * record metadata heat + * OR + * its NOT a metadata fop */ + if ((ctr_inode_cx->is_metadata_fop + && _priv->ctr_record_metadata_heat) + || + (!ctr_inode_cx->is_metadata_fop)) { + CTR_DB_REC(ctr_local).do_record_counters + = _gf_true; + } + } + } /* Decide whether to record times or not * For non internal FOPS record times as usual*/ + CTR_DB_REC(ctr_local).do_record_times = _gf_false; if (!ctr_local->is_internal_fop) { - CTR_DB_REC(ctr_local).do_record_times = - (_priv->ctr_record_wind - || _priv->ctr_record_unwind); + /* If its a metadata fop AND + * record metadata heat + * OR + * its NOT a metadata fop */ + if ((ctr_inode_cx->is_metadata_fop && + _priv->ctr_record_metadata_heat) + || + (!ctr_inode_cx->is_metadata_fop)) { + CTR_DB_REC(ctr_local).do_record_times = + (_priv->ctr_record_wind + || _priv->ctr_record_unwind); + } } /* when its a internal FOPS*/ else { |