Project

General

Profile

Submit #2842 ยป 0001-sys-vfs-hammer-Don-t-ex-lock-all-children-on-interna.patch

tkusumi, 09/19/2015 04:08 PM

View differences:

sys/vfs/hammer/hammer.h
int depth);
void hammer_btree_lcache_free(hammer_mount_t hmp, hammer_node_lock_t lcache);
int hammer_btree_lock_children(hammer_cursor_t cursor, int depth,
int start_index,
hammer_node_lock_t parent,
hammer_node_lock_t lcache);
void hammer_btree_lock_copy(hammer_cursor_t cursor,
sys/vfs/hammer/hammer_btree.c
int i;
const int esize = sizeof(*elm);
hammer_node_lock_init(&lockroot, cursor->node);
error = hammer_btree_lock_children(cursor, 1, &lockroot, NULL);
if (error)
goto done;
if ((error = hammer_cursor_upgrade(cursor)) != 0)
goto done;
++hammer_stats_btree_splits;
return(error);
/*
* Calculate the split point. If the insertion point is at the
......
--split;
}
hammer_node_lock_init(&lockroot, cursor->node);
error = hammer_btree_lock_children(cursor, 1, split, &lockroot, NULL);
if (error)
goto done;
++hammer_stats_btree_splits;
/*
* If we are at the root of the filesystem, create a new root node
* with 1 element and split normally. Avoid making major
......
* is usually aliased from a cursor.
*/
int
hammer_btree_lock_children(hammer_cursor_t cursor, int depth,
hammer_btree_lock_children(hammer_cursor_t cursor, int depth, int start_index,
hammer_node_lock_t parent,
hammer_node_lock_t lcache)
{
......
* pre-get the children before trying to lock the mess. This is
* only done one-level deep for now.
*/
for (i = 0; i < ondisk->count; ++i) {
for (i = start_index; i < ondisk->count; ++i) {
++hammer_stats_btree_elements;
elm = &ondisk->elms[i];
child = hammer_get_node(cursor->trans,
......
/*
* Do it for real
*/
for (i = 0; error == 0 && i < ondisk->count; ++i) {
for (i = start_index; error == 0 && i < ondisk->count; ++i) {
++hammer_stats_btree_elements;
elm = &ondisk->elms[i];
......
error = hammer_btree_lock_children(
cursor,
depth - 1,
0,
item,
lcache);
}
sys/vfs/hammer/hammer_rebalance.c
error = hammer_cursor_upgrade(cursor);
if (error)
goto done;
error = hammer_btree_lock_children(cursor, 2, &lockroot, lcache);
error = hammer_btree_lock_children(cursor, 2, 0, &lockroot, lcache);
if (error)
goto done;
sys/vfs/hammer/hammer_reblock.c
int error;
hammer_node_lock_init(&lockroot, cursor->node);
error = hammer_btree_lock_children(cursor, 1, &lockroot, NULL);
error = hammer_btree_lock_children(cursor, 1, 0, &lockroot, NULL);
if (error)
goto done;
    (1-1/1)