From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlHeW-0001ym-Jm for qemu-devel@nongnu.org; Sun, 01 Jul 2012 06:45:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SlHeU-0006Mw-Rb for qemu-devel@nongnu.org; Sun, 01 Jul 2012 06:45:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlHeU-0006Lc-JU for qemu-devel@nongnu.org; Sun, 01 Jul 2012 06:45:14 -0400 From: Juan Quintela In-Reply-To: <4FEF7C5F.5010700@gmail.com> (Igor Mitsyanko's message of "Sun, 01 Jul 2012 02:23:27 +0400") References: <1e9e8749f384425d04c74bc76fc502621e226352.1340910651.git.quintela@redhat.com> <4FEF7C5F.5010700@gmail.com> Date: Sun, 01 Jul 2012 12:44:48 +0200 Message-ID: <87k3ynu5en.fsf@elfo.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 06/12] savevm: introduce is_active method Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mitsyanko Cc: owasserm@redhat.com, qemu-devel@nongnu.org Igor Mitsyanko wrote: > On 6/28/2012 11:22 PM, Juan Quintela wrote: >> Enable the creation of a method to tell migration if that section is >> active and should be migrate. We use it for blk-migration, that is >> normally not active. We don't create the method for RAM, as setups >> without RAM are very strange O:-) >> >> Signed-off-by: Juan Quintela >> @@ -1576,6 +1576,11 @@ int qemu_savevm_state_begin(QEMUFile *f, >> if (!se->ops || !se->ops->save_live_state) { >> continue; >> } >> + if (se->ops && se->ops->is_active) { >> + if (!se->ops->is_active(se->opaque)) { > > If we got here then we know for sure that se->ops != NULL,and then > nested condition could be simplified to if (se->ops->is_active && > !se->ops->is_active(se->opaque)). Same for qemu_savevm_state_iterate() > amd qemu_savevm_state_complete() I tried to maintain consistency with the previous test, i.e. all have the same structure. I am still not sure which one is better :-() The approach that I did put the things in the same order, yours, remove two lines and one && operand. Will think about that one, thanks. Later, Juan.