libnvme icon indicating copy to clipboard operation
libnvme copied to clipboard

Strange passing of cb_fn in _nvme_ns_split_request

Open waddlesplash opened this issue 5 years ago • 2 comments

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.

waddlesplash avatar May 17 '20 21:05 waddlesplash

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?

waddlesplash avatar May 17 '20 21:05 waddlesplash

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?

waddlesplash avatar May 17 '20 21:05 waddlesplash