enum btree_update_mode { #define x(n) BTREE_UPDATE_##n,
BTREE_UPDATE_MODES() #undef x
};
/* * Tracks an in progress split/rewrite of a btree node and the update to the * parent node: * * When we split/rewrite a node, we do all the updates in memory without * waiting for any writes to complete - we allocate the new node(s) and update * the parent node, possibly recursively up to the root. * * The end result is that we have one or more new nodes being written - * possibly several, if there were multiple splits - and then a write (updating * an interior node) which will make all these new nodes visible. * * Additionally, as we split/rewrite nodes we free the old nodes - but the old * nodes can't be freed (their space on disk can't be reclaimed) until the * update to the interior node that makes the new node visible completes - * until then, the old nodes are still reachable on disk. *
*/ struct btree_update { struct closure cl; struct bch_fs *c;
u64 start_time; unsignedlong ip_started;
/* * BTREE_UPDATE_node: * The update that made the new nodes visible was a regular update to an * existing interior node - @b. We can't write out the update to @b * until the new nodes we created are finished writing, so we block @b * from writing by putting this btree_interior update on the * @b->write_blocked list with @write_blocked_list:
*/ struct btree *b; struct list_head write_blocked_list;
/* * We may be freeing nodes that were dirty, and thus had journal entries * pinned: we need to transfer the oldest of those pins to the * btree_update operation, and release it when the new node(s) * are all persistent and reachable:
*/ struct journal_entry_pin journal;
/* Preallocated nodes we reserve when we start the update: */ struct prealloc_nodes { struct btree *b[BTREE_UPDATE_NODES_MAX]; unsigned nr;
} prealloc_nodes[2];
/* Only here to reduce stack usage on recursive splits: */ struct keylist parent_keys; /* * Enough room for btree_split's keys without realloc - btree node * pointers never have crc/compression info, so we only need to acount * for the pointers for three keys
*/
u64 inline_keys[BKEY_BTREE_PTR_U64s_MAX * 3];
};
/* * Number of nodes we might have to allocate in a worst case btree * split operation - we split all the way up to the root, then allocate * a new root, unless we're already at max depth:
*/ if (depth < BTREE_MAX_DEPTH) return (depth - b->c.level) * 2 + 1; else return (depth - b->c.level) * 2 - 1;
}
/* * write lock must be held on @b (else the dirty bset that we were going to * insert into could be written out from under us)
*/ staticinlinebool bch2_btree_node_insert_fits(struct btree *b, unsigned u64s)
{ if (unlikely(btree_node_need_rewrite(b))) returnfalse;
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.