Re: [Qemu-devel] [PATCH v5 2/2] sheepdog: support user-defined redundancy option

2013-11-07 Thread Liu Yuan
On Wed, Nov 06, 2013 at 10:34:24AM +0100, Stefan Hajnoczi wrote: > On Tue, Nov 05, 2013 at 08:46:07AM -0700, Eric Blake wrote: > > On 11/05/2013 07:37 AM, Stefan Hajnoczi wrote: > > > > >> + > > >> +copy = strtol(n1, NULL, 10); > > >> +if (copy > SD_MAX_COPIES) { > > >> +return -EI

Re: [Qemu-devel] [PATCH v5 2/2] sheepdog: support user-defined redundancy option

2013-11-06 Thread Stefan Hajnoczi
On Tue, Nov 05, 2013 at 08:46:07AM -0700, Eric Blake wrote: > On 11/05/2013 07:37 AM, Stefan Hajnoczi wrote: > > >> + > >> +copy = strtol(n1, NULL, 10); > >> +if (copy > SD_MAX_COPIES) { > >> +return -EINVAL; > >> +} > > > > > The string manipulation can be simplified using s

Re: [Qemu-devel] [PATCH v5 2/2] sheepdog: support user-defined redundancy option

2013-11-05 Thread Eric Blake
On 11/05/2013 07:37 AM, Stefan Hajnoczi wrote: >> + >> +copy = strtol(n1, NULL, 10); >> +if (copy > SD_MAX_COPIES) { >> +return -EINVAL; >> +} > > The string manipulation can be simplified using sscanf(3) and > is_numeric() can be dropped: > > static int parse_redundancy(BDR

Re: [Qemu-devel] [PATCH v5 2/2] sheepdog: support user-defined redundancy option

2013-11-05 Thread Stefan Hajnoczi
On Fri, Nov 01, 2013 at 11:10:13PM +0800, Liu Yuan wrote: > diff --git a/block/sheepdog.c b/block/sheepdog.c > index 66b3ea8..a267d31 100644 > --- a/block/sheepdog.c > +++ b/block/sheepdog.c > @@ -91,6 +91,14 @@ > #define SD_NR_VDIS (1U << 24) > #define SD_DATA_OBJ_SIZE (UINT64_C(1) << 22) > #

[Qemu-devel] [PATCH v5 2/2] sheepdog: support user-defined redundancy option

2013-11-01 Thread Liu Yuan
Sheepdog support two kinds of redundancy, full replication and erasure coding. # create a fully replicated vdi with x copies -o redundancy=x (1 <= x <= SD_MAX_COPIES) # create a erasure coded vdi with x data strips and y parity strips -o redundancy=x:y (x must be one of {2,4,8,16} and 1 <= y <

[Qemu-devel] [PATCH v5 2/2] sheepdog: support user-defined redundancy option

2013-11-01 Thread Liu Yuan
Sheepdog support two kinds of redundancy, full replication and erasure coding. # create a fully replicated vdi with x copies -o redundancy=x (1 <= x <= SD_MAX_COPIES) # create a erasure coded vdi with x data strips and y parity strips -o redundancy=x:y (x must be one of {2,4,8,16} and 1 <= y <