On Tue, Sep 09, 2014 at 02:45:56PM +0200, Benoît Canet wrote:
> The Tuesday 09 Sep 2014 à 11:54:29 (+0800), Hu Tao wrote :
> > This patch prepares for the subsequent patches.
> > 
> > Signed-off-by: Hu Tao <hu...@cn.fujitsu.com>
> > Reviewed-by: Max Reitz <mre...@redhat.com>
> > Reviewed-by: Kevin Wolf <kw...@redhat.com>
> > ---
> >  block/qcow2.c              | 23 +++++++++++++++--------
> >  qapi/block-core.json       | 17 +++++++++++++++++
> >  tests/qemu-iotests/049.out |  2 +-
> >  3 files changed, 33 insertions(+), 9 deletions(-)
> > 
> > diff --git a/block/qcow2.c b/block/qcow2.c
> > index cf27c3f..94d1225 100644
> > --- a/block/qcow2.c
> > +++ b/block/qcow2.c
> > @@ -30,6 +30,7 @@
> >  #include "qemu/error-report.h"
> >  #include "qapi/qmp/qerror.h"
> >  #include "qapi/qmp/qbool.h"
> > +#include "qapi/util.h"
> >  #include "trace.h"
> >  #include "qemu/option_int.h"
> >  
> > @@ -1738,7 +1739,7 @@ static int preallocate(BlockDriverState *bs)
> >  
> >  static int qcow2_create2(const char *filename, int64_t total_size,
> >                           const char *backing_file, const char 
> > *backing_format,
> > -                         int flags, size_t cluster_size, int prealloc,
> > +                         int flags, size_t cluster_size, PreallocMode 
> > prealloc,
> >                           QemuOpts *opts, int version,
> >                           Error **errp)
> 
> below that.
> 
> Carefull study of the code tell us that here prealloc will be 0 or 1
> but i think you could prepare a bit sooner the next patch by doing:
> 
> -    if (prealloc) {                                                          
>    
> +    if (prealloc == PREALLOC_MODE_METADATA) {
>             BDRVQcowState *s = bs->opaque;
> 
> in the same qcow2_create2 function.
> 
> 
> If you do so someone who start reading the code at this precise commit will
> not have to lookup the declaration order of PreallocMode in the QAPI file.

Thanks for your suggestion, I think this makes much sense.

Regards,
Hu

Reply via email to