On 05/11/2014 07:35 PM, Fam Zheng wrote: > Dropping intermediate could be useful both for commit and stream, and > BDS refcnt plus bdrv_swap could do most of the job nicely. It also needs > to work with op blockers. > > Signed-off-by: Fam Zheng <f...@redhat.com> > --- > block.c | 139 > ++++++++++++++++++++++++++++----------------------------- > block/commit.c | 2 +- > 2 files changed, 70 insertions(+), 71 deletions(-) >
> - > /* > - * Drops images above 'base' up to and including 'top', and sets the image > - * above 'top' to have base as its backing file. > + * Drops images above 'base' up to and including 'top', and sets new 'base' > as > + * backing_hd of top's overlay (the image orignally has 'top' as backing > file). > + * top's overlay may be NULL if 'top' is active, no such update needed. > + * Requires that the top's overlay to 'top' is opened r/w. > + * > + * 1) This will convert the following chain: > + * > + * ... <- base <- ... <- top <- overlay <-... <- active > * > - * Requires that the overlay to 'top' is opened r/w, so that the backing file > - * information in 'bs' can be properly updated. > + * to > + * > + * ... <- base <- overlay <- active Jeff is working on allowing the user full control over the string written into overlay; let's make sure these efforts are coordinated. https://lists.gnu.org/archive/html/qemu-devel/2014-05/msg02949.html > + * > + * 2) It is allowed for bottom==base, in which case it converts: > * > - * E.g., this will convert the following chain: > - * bottom <- base <- intermediate <- top <- active > + * base <- ... <- top <- overlay <- ... <- active > * > * to > * > - * bottom <- base <- active > + * base <- overlay <- active > * > - * It is allowed for bottom==base, in which case it converts: > + * 2) It also allows active==top, in which case it converts: Shouldn't this be 3) ? > * > - * base <- intermediate <- top <- active > + * ... <- base <- ... <- top (active) > * > * to > * > - * base <- active > + * ... <- base == active == top > + * > + * i.e. only base and lower remains: *top == *base when return. > + * > + * 3) If base==NULL, it will drop all the BDS below overlay and set its and 4) > + * backing_hd to NULL. I.e.: > * > - * Error conditions: > - * if active == top, that is considered an error > + * base(NULL) <- ... <- overlay <- ... <- active > + * > + * to > + * > + * overlay <- ... <- active > * > */ -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature