mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
o more tidy ups from Clausen.
This commit is contained in:
parent
e69ce84e34
commit
8784319622
@ -59,18 +59,13 @@ static uint int_log(ulong n, ulong base)
|
|||||||
*/
|
*/
|
||||||
static offset_t high(struct dm_table *t, int l, int n)
|
static offset_t high(struct dm_table *t, int l, int n)
|
||||||
{
|
{
|
||||||
while (1) {
|
for (; l < t->depth - 1; l++)
|
||||||
if (n >= t->counts[l])
|
|
||||||
return (offset_t) -1;
|
|
||||||
|
|
||||||
if (l == t->depth - 1)
|
|
||||||
return get_node(t, l, n)[KEYS_PER_NODE - 1];
|
|
||||||
|
|
||||||
l++;
|
|
||||||
n = get_child(n, CHILDREN_PER_NODE - 1);
|
n = get_child(n, CHILDREN_PER_NODE - 1);
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
if (n >= t->counts[l])
|
||||||
|
return (offset_t) -1;
|
||||||
|
|
||||||
|
return get_node(t, l, n)[KEYS_PER_NODE - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -79,17 +74,14 @@ static offset_t high(struct dm_table *t, int l, int n)
|
|||||||
*/
|
*/
|
||||||
static int setup_btree_index(int l, struct dm_table *t)
|
static int setup_btree_index(int l, struct dm_table *t)
|
||||||
{
|
{
|
||||||
int n, c, cn;
|
int n, k;
|
||||||
|
offset_t *node;
|
||||||
|
|
||||||
for (n = 0, cn = 0; n < t->counts[l]; n++) {
|
for (n = 0; n < t->counts[l]; n++) {
|
||||||
offset_t *node = get_node(t, l, n);
|
node = get_node(t, l, n);
|
||||||
|
|
||||||
for (c = 0; c < KEYS_PER_NODE; c++)
|
for (k = 0; k < KEYS_PER_NODE; k++)
|
||||||
node[c] = high(t, l + 1, cn++);
|
node[k] = high(t, l + 1, get_child(n, k));
|
||||||
|
|
||||||
/* one extra for the child that's greater
|
|
||||||
than all keys in the node */
|
|
||||||
cn++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user