summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorVijaykumar M <vmallika@redhat.com>2014-01-03 12:11:19 +0530
committerAnand Avati <avati@redhat.com>2014-02-08 11:30:50 -0800
commit1e26f070bb470adafd0a316c18f2fb9e1b103f27 (patch)
tree1d04f49b423d579a3b1a2c7b1c2dfabadd3b7c4f /libglusterfs
parent8b5b2bfcda0dc95aa170b8752ad97d94701172f2 (diff)
glusterd: add volinfo to the list data structure in an order
Currently volinfo is added at the end of the list while creating a volume. On gluster restart, readdir will not provide the ordered list and the data is populated in the same order as readdir. Solution is to insert the volinfo to the list in an order Change-Id: I1716ac6abbd7dd301a7125425fc413c6833f7a48 BUG: 1039912 Signed-off-by: Vijaykumar M <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/6472 Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/list.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libglusterfs/src/list.h b/libglusterfs/src/list.h
index 7f3712b51b4..794586e35f6 100644
--- a/libglusterfs/src/list.h
+++ b/libglusterfs/src/list.h
@@ -46,6 +46,21 @@ list_add_tail (struct list_head *new, struct list_head *head)
static inline void
+list_add_order (struct list_head *new, struct list_head *head,
+ int (*compare)(struct list_head *, struct list_head *))
+{
+ struct list_head *pos = head->next;
+
+ while ( pos != head ) {
+ if (compare(new, pos) <= 0)
+ break;
+ pos = pos->next;
+ }
+
+ list_add_tail(new, pos);
+}
+
+static inline void
list_del (struct list_head *old)
{
old->prev->next = old->next;