libnvme
libnvme copied to clipboard
Strange passing of cb_fn in _nvme_ns_split_request
When the request is larger than the maximum IO size OR striping is enabled, _nvme_ns_split_request will be used to break the request up into multiple ones: https://github.com/hgst/libnvme/blob/master/lib/nvme/nvme_ns.c#L231
However, it just passes the cb_fn to each of these. So any consumer of this API will have the cb_fn called more than once, and it cannot be reasonably expected to keep track of how many sub-requests there are and when the last one has completed.
It appears SPDK still has this problem. So, is there some way to detect when the last request in a parent/child chain is completed that I am missing?
Ah, it appears I missed that nvme_request_cb_complete_child does handle this case. So the bug I am running into must be on my end.
It still seems strange, though, that the cb_fn is passed through during creation of the child request if it is not supposed to be called. So maybe this should be changed anyway?