[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v14 3/5] qapi: introduce PreallocMode and new Pr
From: |
Hu Tao |
Subject: |
Re: [Qemu-devel] [PATCH v14 3/5] qapi: introduce PreallocMode and new PreallocModes full and falloc. |
Date: |
Wed, 10 Sep 2014 09:41:35 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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 <address@hidden>
> > Reviewed-by: Max Reitz <address@hidden>
> > Reviewed-by: Kevin Wolf <address@hidden>
> > ---
> > 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