Re: [Qemu-devel] [PATCH v2 2/2] sheepdog: implement .bdrv_co_is_allocated()

2013-04-22 Thread Liu Yuan
On 04/23/2013 04:46 AM, Stefan Hajnoczi wrote: > The first sector is included in nb_sectors. Mathematically the range > is defined as [sector_num, sector_num + nb_sectors). Notice the > half-open interval, sector_num + nb_sectors is excluded. The last > included sector is sector_num + nb_sectors

Re: [Qemu-devel] [PATCH v2 2/2] sheepdog: implement .bdrv_co_is_allocated()

2013-04-22 Thread Stefan Hajnoczi
On Mon, Apr 22, 2013 at 5:18 PM, Liu Yuan wrote: > On 04/22/2013 11:03 PM, Stefan Hajnoczi wrote: >> Imagine sector_num = 0 and nb_sectors = SD_DATA_OBJ_SIZE / BDRV_SECTOR_SIZE. >> >> start = 0 >> end = 1 >> >> You don't want object 1, only object 0. > > Hmm, math, ouch. So nb_sectors include sect

Re: [Qemu-devel] [PATCH v2 2/2] sheepdog: implement .bdrv_co_is_allocated()

2013-04-22 Thread Liu Yuan
On 04/22/2013 11:03 PM, Stefan Hajnoczi wrote: > Imagine sector_num = 0 and nb_sectors = SD_DATA_OBJ_SIZE / BDRV_SECTOR_SIZE. > > start = 0 > end = 1 > > You don't want object 1, only object 0. Hmm, math, ouch. So nb_sectors include sector_num? What I mean is If [start, end] mean a range of sec

Re: [Qemu-devel] [PATCH v2 2/2] sheepdog: implement .bdrv_co_is_allocated()

2013-04-22 Thread Stefan Hajnoczi
On Mon, Apr 22, 2013 at 08:10:58PM +0800, Liu Yuan wrote: > On 04/22/2013 08:00 PM, Stefan Hajnoczi wrote: > > On Mon, Apr 22, 2013 at 02:59:10PM +0800, Liu Yuan wrote: > >> +static coroutine_fn int > >> +sd_co_is_allocated(BlockDriverState *bs, int64_t sector_num, int > >> nb_sectors, > >> +

Re: [Qemu-devel] [PATCH v2 2/2] sheepdog: implement .bdrv_co_is_allocated()

2013-04-22 Thread Liu Yuan
On 04/22/2013 08:00 PM, Stefan Hajnoczi wrote: > On Mon, Apr 22, 2013 at 02:59:10PM +0800, Liu Yuan wrote: >> +static coroutine_fn int >> +sd_co_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, >> + int *pnum) >> +{ >> +BDRVSheepdogState *s = bs->opaque;

Re: [Qemu-devel] [PATCH v2 2/2] sheepdog: implement .bdrv_co_is_allocated()

2013-04-22 Thread Stefan Hajnoczi
On Mon, Apr 22, 2013 at 02:59:10PM +0800, Liu Yuan wrote: > +static coroutine_fn int > +sd_co_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, > + int *pnum) > +{ > +BDRVSheepdogState *s = bs->opaque; > +SheepdogInode *inode = &s->inode; > +unsign

[Qemu-devel] [PATCH v2 2/2] sheepdog: implement .bdrv_co_is_allocated()

2013-04-22 Thread Liu Yuan
From: Liu Yuan Cc: MORITA Kazutaka Cc: Kevin Wolf Cc: Stefan Hajnoczi Signed-off-by: Liu Yuan --- block/sheepdog.c | 36 1 file changed, 36 insertions(+) diff --git a/block/sheepdog.c b/block/sheepdog.c index 0b700a3..0dbf039 100644 --- a/block/sheepdo