From 3bcf8d4ce67654e2b5648ae11aaeb2e49dbcfa95 Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Mon, 28 Dec 2009 06:07:48 +0000 Subject: cluster/afr: Allocate diff algorithm loop_state structures only once. Instead of CALLOC'ing a loop_state structure at the beginning of every loop, keep a table of allocated structures and reuse them. Signed-off-by: Vikas Gorur Signed-off-by: Anand V. Avati BUG: 320 (Improve self-heal performance) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=320 --- xlators/cluster/afr/src/afr-self-heal-algorithm.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'xlators/cluster/afr/src/afr-self-heal-algorithm.h') diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.h b/xlators/cluster/afr/src/afr-self-heal-algorithm.h index b9c58b5cb..0bdae3aa7 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.h +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.h @@ -37,10 +37,14 @@ typedef struct { off_t offset; } afr_sh_algo_full_private_t; -typedef struct { - uint8_t *checksum; /* array of MD5 checksums for each child - Each checksum is MD5_DIGEST_LEN bytes long */ +struct sh_diff_loop_state { + off_t offset; + unsigned char *write_needed; + uint8_t *checksum; + gf_boolean_t active; +}; +typedef struct { size_t block_size; gf_lock_t lock; @@ -49,6 +53,8 @@ typedef struct { int32_t total_blocks; int32_t diff_blocks; + + struct sh_diff_loop_state **loops; } afr_sh_algo_diff_private_t; #endif /* __AFR_SELF_HEAL_ALGORITHM_H__ */ -- cgit