mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
o added new constant CHILD_PER_NODE to make things clearer
This commit is contained in:
parent
5cdd74f2e9
commit
a612e52245
@ -67,7 +67,7 @@ static offset_t high(struct dm_table *t, int l, int n)
|
||||
return t->index[l][((n + 1) * KEYS_PER_NODE) - 1];
|
||||
|
||||
l++;
|
||||
n = (n + 1) * (KEYS_PER_NODE + 1) - 1;
|
||||
n = (n + 1) * CHILD_PER_NODE - 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -313,7 +313,7 @@ int dm_table_complete(struct dm_table *t)
|
||||
|
||||
/* how many indexes will the btree have ? */
|
||||
leaf_nodes = div_up(t->num_targets, KEYS_PER_NODE);
|
||||
t->depth = 1 + int_log(leaf_nodes, KEYS_PER_NODE + 1);
|
||||
t->depth = 1 + int_log(leaf_nodes, CHILD_PER_NODE);
|
||||
|
||||
/* leaf layer has already been set up */
|
||||
t->counts[t->depth - 1] = leaf_nodes;
|
||||
@ -321,7 +321,7 @@ int dm_table_complete(struct dm_table *t)
|
||||
|
||||
/* set up internal nodes, bottom-up */
|
||||
for (i = t->depth - 2; i >= 0; i--) {
|
||||
t->counts[i] = div_up(t->counts[i + 1], KEYS_PER_NODE + 1);
|
||||
t->counts[i] = div_up(t->counts[i + 1], CHILD_PER_NODE);
|
||||
t->index[i] = vmalloc(NODE_SIZE * t->counts[i]);
|
||||
setup_btree_index(i, t);
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ static inline int __find_node(struct dm_table *t, struct buffer_head *bh)
|
||||
offset_t *node;
|
||||
|
||||
for (l = 0; l < t->depth; l++) {
|
||||
r = ((KEYS_PER_NODE + 1) * r) + i;
|
||||
r = (CHILD_PER_NODE * r) + i;
|
||||
node = t->index[l] + (r * KEYS_PER_NODE);
|
||||
|
||||
for (i = 0; i < KEYS_PER_NODE; i++)
|
||||
|
@ -134,6 +134,7 @@
|
||||
#define MAX_DEPTH 16
|
||||
#define NODE_SIZE L1_CACHE_BYTES
|
||||
#define KEYS_PER_NODE (NODE_SIZE / sizeof(offset_t))
|
||||
#define CHILD_PER_NODE (KEYS_PER_NODE + 1)
|
||||
#define DM_NAME_LEN 64
|
||||
|
||||
enum {
|
||||
|
Loading…
Reference in New Issue
Block a user