From 8bd16cc88527584e91baa8773b4f01e7c44708c1 Mon Sep 17 00:00:00 2001 From: ajha Date: Fri, 30 Aug 2013 15:14:46 +0530 Subject: features/changelog : Improvement in changelog "encoding-change". change in encoding method of changelog was critical section for "fop dispatch thread", "roll-over thread" and "reconfigure dispatch thread". In this patch the "encoding-method" is changed by the reconfigure dispatch thread lazily during handle_change, which solves the concurrency among the racing threads. BUG: 1002940 Change-Id: I78c3e8887efa46d0fcc60755cdf4243031cfa3eb Signed-off-by: Ajeet Jha Reviewed-on: http://review.gluster.org/5844 Reviewed-by: Venky Shankar Tested-by: Gluster Build System Reviewed-by: Harshavardhana --- xlators/features/changelog/src/changelog-encoders.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'xlators/features/changelog/src/changelog-encoders.c') diff --git a/xlators/features/changelog/src/changelog-encoders.c b/xlators/features/changelog/src/changelog-encoders.c index c71ea9270b0..553eec85c30 100644 --- a/xlators/features/changelog/src/changelog-encoders.c +++ b/xlators/features/changelog/src/changelog-encoders.c @@ -154,3 +154,23 @@ changelog_encode_binary (xlator_t *this, changelog_log_data_t *cld) return changelog_write_change (priv, buffer, off); } + +static struct changelog_encoder +cb_encoder[] = { + [CHANGELOG_ENCODE_BINARY] = + { + .encoder = CHANGELOG_ENCODE_BINARY, + .encode = changelog_encode_binary, + }, + [CHANGELOG_ENCODE_ASCII] = + { + .encoder = CHANGELOG_ENCODE_ASCII, + .encode = changelog_encode_ascii, + }, +}; + +void +changelog_encode_change( changelog_priv_t * priv) +{ + priv->ce = &cb_encoder[priv->encode_mode]; +} -- cgit