Skip to content

When free bio #15173

Closed Answered by robn
yuanfangcc asked this question in Q&A
Aug 15, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

All you're testing is that the pointer isn't NULL, which says nothing about what, if anything, its pointing to.

As it is, the bio is handed to the kernel (vdev_submit_bio_impl -> submit_bio), which then takes ownership of it.

When the IO operation is complete, the kernel calls vdev_disk_io_flush_completion with the completed bio. This usually the bio that was passed in, but not necessarily - the kernel may modify it, split it or whatever it wants. Regardless, bio_put(bio) returns the bio to the kernel when we're done with it, and it will free it or reuse it as it likes.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yuanfangcc
Comment options

Answer selected by yuanfangcc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants