path: root/xlators/cluster/afr/src/afr-common.c
diff options
authorPranith Kumar K <>2018-12-18 14:38:22 +0530
committerAmar Tumballi <>2018-12-28 10:46:00 +0000
commita12cadc1377ef51ad52defd1da91bf8f599e5786 (patch)
tree3380715fe1dd17255d75af1f9486e54a04a23bfb /xlators/cluster/afr/src/afr-common.c
parent8d38c5b7337e44ad9f282966c0aa2e99bd7da506 (diff)
cluster/afr: Refactor internal locking code to allow multiple inodelks
For implementing copy_file_range fop, AFR needs to perform two inodelks in the same transaction. This patch brings in the necessary structure to make it easier to do so. Entry-locks in AFR were already taking multiple entry-locks on different inodes with the respective basenames. This patch extends the logic in inodelks to use the same lockee_t structure. This lead to removal of quite a lot of duplicate code present in afr-lk-common.c as both the locks are doing same things except 'winding' part. updates: #536 Change-Id: Ibfce7e3f260bb27b18645152ec680c33866fe0ae Signed-off-by: Pranith Kumar K <>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
1 files changed, 1 insertions, 8 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 32fa634..0f77607 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -1794,11 +1794,9 @@ afr_local_transaction_cleanup(afr_local_t *local, xlator_t *this)
afr_matrix_cleanup(local->pending, priv->child_count);
- GF_FREE(local->internal_lock.locked_nodes);
- afr_entry_lockee_cleanup(&local->internal_lock);
+ afr_lockees_cleanup(&local->internal_lock);
@@ -5708,11 +5706,6 @@ afr_internal_lock_init(afr_internal_lock_t *lk, size_t child_count)
int ret = -ENOMEM;
- lk->locked_nodes = GF_CALLOC(sizeof(*lk->locked_nodes), child_count,
- gf_afr_mt_char);
- if (NULL == lk->locked_nodes)
- goto out;
lk->lower_locked_nodes = GF_CALLOC(sizeof(*lk->lower_locked_nodes),
child_count, gf_afr_mt_char);
if (NULL == lk->lower_locked_nodes)