Difference between revisions of "Documentation/DnodeSync"

Jump to navigation Jump to search
1,246 bytes added ,  23:57, 7 October 2013
Line 47: Line 47:
''free_children'' takes an indirect block (L1, L2, ...) in a dnode and a range of L0 blocks to be freed. At a high-level, it handles two cases. If the indirect block passed in is an L1 indirect, that means the block pointers contained point directly to data blocks, some or all of which we wish to free. If the indirect block passed in is higher than an L1, then we need to recursively process the next level of indirect blocks instead, while avoiding traversal of unnecessary blocks.
''free_children'' takes an indirect block (L1, L2, ...) in a dnode and a range of L0 blocks to be freed. At a high-level, it handles two cases. If the indirect block passed in is an L1 indirect, that means the block pointers contained point directly to data blocks, some or all of which we wish to free. If the indirect block passed in is higher than an L1, then we need to recursively process the next level of indirect blocks instead, while avoiding traversal of unnecessary blocks.


The first case, an L1 indirect block, is handled by a call to ''free_blocks'' which is directly passed an offset in to the in-memory copy of the current indirect block and the number of blocks to be freed beyond that. ''free_blocks'' iterates over the specified block pointers in the indirect block and frees each of them using a call to ''dsl_dataset_block_kill''. Discussing exactly how that is done is beyond the scope of this article, but it handles special cases for whether this block can have any other references to it (i.e. if it was born since the last snapshot on its enclosing dataset) and either frees it by running it through the appropriate ZIO pipeline or placing it in a list of blocks awaiting de-allocation.


The second case in ''free_children'', where the indirect block we are processing is > L1, is handled by recursive calls to ''free_children'' for child indirect blocks. Like ''free_blocks'', we iterate over the block pointers in the current indirect block which we know point to indirect blocks under which there are L0 data blocks to be freed, bring that sub-block into memory, and call ''free_children'' on it. In this manner, we will eventually recurse down to L1 indirect blocks which we can use ''free_blocks'' on.


== dbuf_sync_list ==
== dbuf_sync_list ==
Editor
90

edits

Navigation menu