From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8nbH-0003kY-Oo for qemu-devel@nongnu.org; Tue, 04 Sep 2012 03:31:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T8nbD-0002aY-Lc for qemu-devel@nongnu.org; Tue, 04 Sep 2012 03:31:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8nbD-0002Zh-DQ for qemu-devel@nongnu.org; Tue, 04 Sep 2012 03:31:03 -0400 Message-ID: <5045ADF2.4040906@redhat.com> Date: Tue, 04 Sep 2012 09:29:54 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1346663926-20188-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1346663926-20188-2-git-send-email-xiawenc@linux.vnet.ibm.com> <5044B720.5080205@redhat.com> <5044B912.7020405@redhat.com> <5045A82D.2010200@linux.vnet.ibm.com> In-Reply-To: <5045A82D.2010200@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/6] libqblock APIs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: kwolf@redhat.com, stefanha@gmail.com, aliguori@us.ibm.com, Eric Blake , qemu-devel@nongnu.org Il 04/09/2012 09:05, Wenchao Xia ha scritto: >> That said, QEMU's internal bdrv_is_allocated function does have one not >> entirely appealing property: the block at start + *pnum might have the >> same state as the block at start + *pnum - 1, even if *pnum < length. >> We may want to work around this in libqblock, but we could also simply >> document it. >> >> Paolo >> > int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, > int nb_sectors,int *pnum) > will the issue happen when nb_sectors > *pnum? if so it seems a bug, > because caller is asking a range of sectors's allocation status, and > *pnum did not reflect the real status. Actually it does. bdrv_is_allocated says it didn't find out anything about sector start + *pnum and later. >>> Either way, I think you are supplying too >>> many parameters for how I envision checking for allocated sectors. >> > yes, it is a bit confusing, how about: > > int qb_check_allocate_status(struct QBroker *broker, > struct QBlockState *qbs, > offset sector_start, > size_t sector_number, > size_t *pnum, > int *status) > user input sector_start and sector_number to ask check it in this range, > following parameter receive the status, return indicate exception. That's ok too. But do not use size_t for sectors. Testing, or reading, or writing 2 TB with a single call is more than enough. Paolo