summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/xlator.c16
-rw-r--r--libglusterfs/src/xlator.h1
-rw-r--r--xlators/cluster/afr/src/afr-lk-common.c15
3 files changed, 23 insertions, 9 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index d8997bc7d16..f9e5db67183 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -618,10 +618,12 @@ out:
return ret;
}
-char*
-loc_gfid_utoa (loc_t *loc)
+void
+loc_gfid (loc_t *loc, uuid_t gfid)
{
- uuid_t gfid={0};
+ if (!gfid)
+ goto out;
+ uuid_clear (gfid);
if (!loc)
goto out;
@@ -630,6 +632,14 @@ loc_gfid_utoa (loc_t *loc)
else if (loc->inode && (!uuid_is_null (loc->inode->gfid)))
uuid_copy (gfid, loc->inode->gfid);
out:
+ return;
+}
+
+char*
+loc_gfid_utoa (loc_t *loc)
+{
+ uuid_t gfid;
+ loc_gfid (loc, gfid);
return uuid_utoa (gfid);
}
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index 071a4bdb789..43fd063884a 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -886,6 +886,7 @@ int loc_copy (loc_t *dst, loc_t *src);
#define loc_dup(src, dst) loc_copy(dst, src)
void loc_wipe (loc_t *loc);
int loc_path (loc_t *loc, const char *bname);
+void loc_gfid (loc_t *loc, uuid_t gfid);
char* loc_gfid_utoa (loc_t *loc);
int xlator_mem_acct_init (xlator_t *xl, int num_types);
int is_gf_log_command (xlator_t *trans, const char *name, char *value);
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c
index e091a7939fe..812609819f5 100644
--- a/xlators/cluster/afr/src/afr-lk-common.c
+++ b/xlators/cluster/afr/src/afr-lk-common.c
@@ -57,11 +57,15 @@
int
afr_entry_lockee_cmp (const void *l1, const void *l2)
{
- const afr_entry_lockee_t *r1 = l1;
- const afr_entry_lockee_t *r2 = l2;
- int ret = 0;
-
- ret = uuid_compare (r1->loc.gfid, r2->loc.gfid);
+ const afr_entry_lockee_t *r1 = l1;
+ const afr_entry_lockee_t *r2 = l2;
+ int ret = 0;
+ uuid_t gfid1 = {0};
+ uuid_t gfid2 = {0};
+
+ loc_gfid ((loc_t*)&r1->loc, gfid1);
+ loc_gfid ((loc_t*)&r2->loc, gfid2);
+ ret = uuid_compare (gfid1, gfid2);
/*Entrylks with NULL basename are the 'smallest'*/
if (ret == 0) {
if (!r1->basename)
@@ -75,7 +79,6 @@ afr_entry_lockee_cmp (const void *l1, const void *l2)
return -1;
else
return 1;
-
}
int afr_lock_blocking (call_frame_t *frame, xlator_t *this, int child_index);