[SCM] CTDB repository - branch master updated -
ctdb-1.0.57-29-g85f6032
Ronnie Sahlberg
sahlberg at samba.org
Wed Oct 1 00:12:02 GMT 2008
The branch, master has been updated
via 85f6032cbdb197f3a003d86f086afa2cee898a4d (commit)
from 647003da975d4823abe8ed2bfb46153d68ea0fb0 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 85f6032cbdb197f3a003d86f086afa2cee898a4d
Author: Andrew Tridgell <tridge at samba.org>
Date: Tue Sep 30 07:09:06 2008 -0700
merged a bugfix for the idtree code from the Linux kernel. This
matches commit 7aae6dd80e265aa9402ed507caaff4a5dba55069 in the kernel.
Many thanks to Jim Houston for pointing out this fix to us
-----------------------------------------------------------------------
Summary of changes:
lib/util/idtree.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/util/idtree.c b/lib/util/idtree.c
index 6fef3d1..1b69319 100644
--- a/lib/util/idtree.c
+++ b/lib/util/idtree.c
@@ -105,12 +105,13 @@ static int sub_alloc(struct idr_context *idp, void *ptr, int *starting_id)
int n, m, sh;
struct idr_layer *p, *new;
struct idr_layer *pa[MAX_LEVEL];
- int l, id;
+ int l, id, oid;
uint32_t bm;
memset(pa, 0, sizeof(pa));
id = *starting_id;
+restart:
p = idp->top;
l = idp->layers;
pa[l--] = NULL;
@@ -124,12 +125,23 @@ static int sub_alloc(struct idr_context *idp, void *ptr, int *starting_id)
if (m == IDR_SIZE) {
/* no space available go back to previous layer. */
l++;
+ oid = id;
id = (id | ((1 << (IDR_BITS*l))-1)) + 1;
+
+ /* if already at the top layer, we need to grow */
if (!(p = pa[l])) {
*starting_id = id;
return -2;
}
- continue;
+
+ /* If we need to go up one layer, continue the
+ * loop; otherwise, restart from the top.
+ */
+ sh = IDR_BITS * (l + 1);
+ if (oid >> sh == id >> sh)
+ continue;
+ else
+ goto restart;
}
if (m != n) {
sh = IDR_BITS*l;
--
CTDB repository
More information about the samba-cvs
mailing list