Il 09/04/2013 05:04, mrhi...@linux.vnet.ibm.com ha scritto: > > + if ((bytes_sent = save_rdma_page(f, block->offset, > + offset, cont, TARGET_PAGE_SIZE, zero)) >= 0) { > + acct_info.norm_pages++; > + qemu_file_update_position(f, bytes_sent); > + } else if (zero) {
I think this should become a new QEMUFileOps member, save_ram_page. If NULL it can return ENOTSUP. > +/* > + * Inform server to begin handling dynamic page registrations > + */ > +static void ram_registration_start(QEMUFile *f) > +{ > + if(qemu_file_ops_are(f, &rdma_write_ops)) { > + qemu_put_be64(f, RAM_SAVE_FLAG_RDMA); > + } > +} > + > +/* > + * Inform server that dynamic registrations are done for now. > + * First, flush writes, if any. > + */ > +static int ram_registration_stop(QEMUFile *f) > +{ > + int ret = 0; > + > + if (qemu_file_ops_are(f, &rdma_write_ops)) { > + ret = qemu_rdma_drain_cq(f); > + if(ret >= 0) > + ret = qemu_rdma_finish_registrations(f); > + } > + > + return ret; I think this should become two QEMUFileOps instead: before_ram_iterate and after_ram_iterate, or something like that. Again, if NULL they should just do nothing. Errors from the callback should be persisted in the QEMUFile with qemu_file_set_error. Then you do not need any checks in the caller. Paolo