From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 5/8] migration: move calling control_save_page to the common place Date: Fri, 16 Mar 2018 16:59:26 +0800 Message-ID: <5aa7923b-2b4c-4d44-7861-63c05e25c75f@gmail.com> References: <20180313075739.11194-1-xiaoguangrong@tencent.com> <20180313075739.11194-6-xiaoguangrong@tencent.com> <20180315114715.GE3062@work-vm> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mst@redhat.com, mtosatti@redhat.com, Xiao Guangrong , qemu-devel@nongnu.org, pbonzini@redhat.com To: "Dr. David Alan Gilbert" Return-path: In-Reply-To: <20180315114715.GE3062@work-vm> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel2=m.gmane.org@nongnu.org Sender: "Qemu-devel" List-Id: kvm.vger.kernel.org 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? :)