[Sheepdog] [PATCH] sheep: fix get_zones_nr_from for clusters with gateways
Christoph Hellwig
hch at infradead.org
Thu Apr 26 18:15:28 CEST 2012
Signed-off-by: Christoph Hellwig <hch at lst.de>
---
sheep/group.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
Index: sheepdog/sheep/group.c
===================================================================
--- sheepdog.orig/sheep/group.c 2012-04-26 17:56:56.200544896 +0200
+++ sheepdog/sheep/group.c 2012-04-26 18:03:55.660555635 +0200
@@ -119,15 +119,23 @@ int get_zones_nr_from(struct sd_node *no
uint32_t zones[SD_MAX_REDUNDANCY];
for (i = 0; i < nr_nodes; i++) {
+ /*
+ * Only count zones that actually store data, pure gateways
+ * don't contribute to the redundancy level.
+ */
+ if (!nodes[i].nr_vnodes)
+ continue;
+
for (j = 0; j < nr_zones; j++) {
if (nodes[i].zone == zones[j])
break;
}
- if (j == nr_zones)
- zones[nr_zones++] = nodes[i].zone;
- if (nr_zones == ARRAY_SIZE(zones))
- break;
+ if (j == nr_zones) {
+ zones[nr_zones] = nodes[i].zone;
+ if (++nr_zones == ARRAY_SIZE(zones))
+ break;
+ }
}
return nr_zones;
More information about the sheepdog
mailing list