[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/8] migration: move calling control_save_page t
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Qemu-devel] [PATCH 5/8] migration: move calling control_save_page to the common place |
Date: |
Mon, 19 Mar 2018 13:15:59 +0000 |
User-agent: |
Mutt/1.9.2 (2017-12-15) |
* Xiao Guangrong (address@hidden) wrote:
>
>
> On 03/15/2018 07:47 PM, Dr. David Alan Gilbert wrote:
>
> > > /* Check the pages is dirty and if it is send it */
> > > if (migration_bitmap_clear_dirty(rs, pss->block, pss->page)) {
> > > + RAMBlock *block = pss->block;
> > > + ram_addr_t offset = pss->page << TARGET_PAGE_BITS;
> > > +
> > > + if (control_save_page(rs, block, offset, &res)) {
> > > + goto page_saved;
> >
> > OK, but I'd prefer if you avoided this forward goto; we do use goto but
> > we tend to keep it just for error cases.
> >
>
> There is a common operation, clearing unsentmap, for save_control,
> save_zero, save_compressed and save_normal, if we do not use 'goto',
> the operation would to be duplicated several times or we will have
> big if...elseif...elseif... section.
>
> So it may be not too bad to have 'goto' under this case? :)
The problem is it always tends to creep a bit, and then you soon have
a knot of goto's.
I suggest you add a 'page_saved' bool, set it instead of taking the
goto, and then add a if (!page_saved) around the next section.
It doesn't need to nest for the last section; you just do another
if (!page_saved) if around that.
Dave
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK
- Re: [Qemu-devel] [PATCH 3/8] migration: support to detect compression and decompression errors, (continued)
[Qemu-devel] [PATCH 4/8] migration: introduce control_save_page(), guangrong . xiao, 2018/03/13
[Qemu-devel] [PATCH 5/8] migration: move calling control_save_page to the common place, guangrong . xiao, 2018/03/13
Re: [Qemu-devel] [PATCH 5/8] migration: move calling control_save_page to the common place, Peter Xu, 2018/03/27
[Qemu-devel] [PATCH 6/8] migration: move calling save_zero_page to the common place, guangrong . xiao, 2018/03/13
[Qemu-devel] [PATCH 7/8] migration: introduce save_normal_page(), guangrong . xiao, 2018/03/13
[Qemu-devel] [PATCH 8/8] migration: remove ram_save_compressed_page(), guangrong . xiao, 2018/03/13