From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v4 --for 4.6 COLOPre 24/25] tools/libxl: move remus state into a seperate structure Date: Thu, 16 Jul 2015 11:37:24 +0100 Message-ID: <1437043044.32371.161.camel@citrix.com> References: <1436946351-21118-1-git-send-email-yanghy@cn.fujitsu.com> <1436946351-21118-25-git-send-email-yanghy@cn.fujitsu.com> <1436966922.32371.64.camel@citrix.com> <55A6650A.7090207@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <55A6650A.7090207@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Yang Hongyang , ian.jackson@eu.citrix.com Cc: wei.liu2@citrix.com, wency@cn.fujitsu.com, andrew.cooper3@citrix.com, yunhong.jiang@intel.com, eddie.dong@intel.com, xen-devel@lists.xen.org, guijianfeng@cn.fujitsu.com, rshriram@cs.ubc.ca List-Id: xen-devel@lists.xenproject.org On Wed, 2015-07-15 at 21:50 +0800, Yang Hongyang wrote: > > On 07/15/2015 09:28 PM, Ian Campbell wrote: > > On Wed, 2015-07-15 at 15:45 +0800, Yang Hongyang wrote: > >> @@ -2921,6 +2911,26 @@ _hidden void libxl__checkpoint_devices_preresume(libxl__egc *egc, > >> libxl__checkpoint_devices_state *cds); > >> _hidden void libxl__checkpoint_devices_commit(libxl__egc *egc, > >> libxl__checkpoint_devices_state *cds); > >> + > >> +/*----- Remus related state structure -----*/ > >> +typedef struct libxl__remus_state libxl__remus_state; > >> +struct libxl__remus_state { > >> + /* private */ > >> + libxl__ev_time checkpoint_timeout; /* used for Remus checkpoint */ > >> + int interval; /* checkpoint interval */ > >> + > >> + /* abstract layer */ > >> + libxl__checkpoint_devices_state cds; > > > > This mostly makes sense, I think, but this one field feels like it will > > be wanted by colo too. Does that mean we will end up with dss->rs.cds > > and dss->colo.cds doing effectively the same thing? > > Yes, checkpoint device is an abstract layer, used by both Remus & colo, > in the abstract layer, we do not aware of remus or colo, in Remus or colo, > we can use container of cds to retrive Remus/colo state. This is because the cds callbacks receive a libxl__checkpoint_devices_state * but are specific to either Remus of Colo? I think the usual way to solve that would be for the callback to take a void *data "closure" field, which is registered along with the callbacks and passed to all callbacks, or in this case perhaps you can get away with just including it in the cds itself. Ian, what do you think? Ian.