This seems to be a duplicate of the code in do_osd_ops?