I really hate doing extra iterations through the ops vector. :(
It's probably not a rational hatred, but did you think about just doing a check inside do_osd_ops instead?