[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 32/54] Postcopy: Maintain sentmap and calcula
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Qemu-devel] [PATCH v8 32/54] Postcopy: Maintain sentmap and calculate discard |
Date: |
Mon, 2 Nov 2015 18:19:56 +0000 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
* Juan Quintela (address@hidden) wrote:
> > @@ -662,6 +672,24 @@ static int save_zero_page(QEMUFile *f, RAMBlock
> > *block, ram_addr_t offset,
> > }
> >
> > /**
> > + * ram_find_block_by_id: Find a ramblock by name.
> > + *
> > + * Returns: The RAMBlock with matching ID, or NULL.
> > + */
> > +static RAMBlock *ram_find_block_by_id(const char *id)
> > +{
> > + RAMBlock *block;
> > +
> > + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
> > + if (!strcmp(id, block->idstr)) {
> > + return block;
> > + }
> > + }
> > +
> > + return NULL;
> > +}
>
> We don't have this function already.....
>
> Once here, could we split it in its own patch and use it in ram_load?
>
>
> QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
> if (!strncmp(id, block->idstr, sizeof(id))) {
> if (length != block->used_length) {
> Error *local_err = NULL;
>
> ret = qemu_ram_resize(block->offset, length,
> &local_err);
> if (local_err) {
> error_report_err(local_err);
> }
> }
> ram_control_load_hook(f, RAM_CONTROL_BLOCK_REG,
> block->idstr);
> break;
> }
> }
>
> if (!block) {
> error_report("Unknown ramblock \"%s\", cannot "
> "accept migration", id);
> ret = -EINVAL;
> }
>
>
> We could also use it in:
>
> host_from_stream_offset
Done; replaced both uses and it's now called 'qemu_ram_block_by_name'
Dave
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK