dm: abstract dm_in_flight function