Difference between revisions of "Documentation/ZfsSend"

Jump to navigation Jump to search
no edit summary
Line 78: Line 78:
''dump_ioctl'' is where we transition from executing in user space inside the ZFS kernel module. Between ''dump_ioctl'' and the next piece of interesting logic there are several intermediate calls which perform error checking and data retrieval (''zfs_ioctl'', ''zfs_ioc_send'', ''dmu_send_obj'') but let’s focus a little farther down the stack at ''dmu_send_impl'' in 'dmu_send.c where it really gets interesting.
''dump_ioctl'' is where we transition from executing in user space inside the ZFS kernel module. Between ''dump_ioctl'' and the next piece of interesting logic there are several intermediate calls which perform error checking and data retrieval (''zfs_ioctl'', ''zfs_ioc_send'', ''dmu_send_obj'') but let’s focus a little farther down the stack at ''dmu_send_impl'' in 'dmu_send.c where it really gets interesting.


''dmu_send_impl'' is the first place where we begin writing to the actual ZFS send stream. For instance, ''dmu_send_impl'' passes the in-memory representation of the BEGIN and END records into ''dump_bytes'' for output to the ZFS send stream. The BEGIN record includes identifying info on the source and target snapshots in an incremental send, the name of the dataset being sent, and timestamp time on the target snapshot. The END record includes a checksum of the entire send stream and identifying info on the target snapshot. Even more important, ''dmu_send_impl'' also performs traversal of the current dataset by combining traverse_dataset with a callback, backup_cb.
''dmu_send_impl'' is the first place where we begin writing to the actual ZFS send stream. For instance, ''dmu_send_impl'' passes the in-memory representation of the BEGIN and END records into ''dump_bytes'' for output to the ZFS send stream. The BEGIN record includes identifying info on the source and target snapshots in an incremental send, the name of the dataset being sent, and timestamp time on the target snapshot. The END record includes a checksum of the entire send stream and identifying info on the target snapshot. Even more important, ''dmu_send_impl'' also performs traversal of the current dataset by combining ''traverse_dataset'' with a callback, ''backup_cb''.


traverse_dataset’s core functionality is implemented in traverse_visitbp. traverse_visitbp recursively visits all objects and blocks in the ZFS object it is passed (in this case the target snapshot of the ZFS send) and calls the callback function it is passed on each block. traverse_visitbp has special filtering on the blocks it visits that allows it to skip any ZFS blocks which were not modified after a certain transaction group (i.e. snapshot), which is useful for incremental sends.
''traverse_dataset''’s core functionality is implemented in ''traverse_visitbp''. ''traverse_visitbp'' recursively visits all objects and blocks in the ZFS object it is passed (in this case the target snapshot of the ZFS send) and calls the callback function it is passed on each block. ''traverse_visitbp'' has special filtering on the blocks it visits that allows it to skip any ZFS blocks which were not modified after a certain transaction group (i.e. snapshot), which is useful for incremental sends.


backup_cb, called by traverse_visitbp, handles writing ZFS send records for each ZFS block passed to it. backup_cb performs different actions for a number of different cases, including:
''backup_cb'', called by ''traverse_visitbp'', handles writing ZFS send records for each ZFS block passed to it. ''backup_cb'' performs different actions for a number of different cases, including:




Editor
90

edits

Navigation menu