summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/fd-lk.c
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-01-30 15:46:49 -0800
committerAnand Avati <avati@redhat.com>2013-01-30 23:41:16 -0800
commit12689595abd50d13711f855dddfb5cfe51f40455 (patch)
tree6ea2dd303cbdf022f23223b03753533eb9244e06 /libglusterfs/src/fd-lk.c
parente979c0de9dde14fe18d0ad7298c6da9cc878bbab (diff)
fd-lk: implement new method to check for empty fd_lk_ctx_t
to use this in fuse-bridge, to conditionally attempt lock migration to new graph. Change-Id: I9b10d5839c4ac6051c75e4c020371391cd886ac8 BUG: 808400 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/4455 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'libglusterfs/src/fd-lk.c')
-rw-r--r--libglusterfs/src/fd-lk.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libglusterfs/src/fd-lk.c b/libglusterfs/src/fd-lk.c
index 0c439fe6e93..fff4aa9966c 100644
--- a/libglusterfs/src/fd-lk.c
+++ b/libglusterfs/src/fd-lk.c
@@ -468,3 +468,21 @@ fd_lk_insert_and_merge (fd_t *fd, int32_t cmd,
out:
return ret;
}
+
+
+gf_boolean_t
+fd_lk_ctx_empty (fd_lk_ctx_t *lk_ctx)
+{
+ gf_boolean_t verdict = _gf_true;
+
+ if (!lk_ctx)
+ return _gf_true;
+
+ LOCK (&lk_ctx->lock);
+ {
+ verdict = list_empty (&lk_ctx->lk_list);
+ }
+ UNLOCK (&lk_ctx->lock);
+
+ return verdict;
+}