diff options
author | Vikas Gorur <vikas@gluster.com> | 2009-12-28 06:07:48 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-12-28 04:39:24 -0800 |
commit | 3bcf8d4ce67654e2b5648ae11aaeb2e49dbcfa95 (patch) | |
tree | 3c2b0b8c706dd622ba50586da6446af71700be08 /xlators/cluster/afr/src/afr-self-heal-algorithm.h | |
parent | 9658e13bd91849f75d968376aae5b937aabec512 (diff) |
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 <vikas@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 320 (Improve self-heal performance)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=320
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-algorithm.h')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-algorithm.h | 12 |
1 files changed, 9 insertions, 3 deletions
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__ */ |