From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUAjm-00007X-Q1 for qemu-devel@nongnu.org; Mon, 22 Apr 2013 03:00:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUAjl-0001vH-Aw for qemu-devel@nongnu.org; Mon, 22 Apr 2013 03:00:30 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:33753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUAjl-0001v4-3W for qemu-devel@nongnu.org; Mon, 22 Apr 2013 03:00:29 -0400 Received: by mail-pd0-f174.google.com with SMTP id y14so443625pdi.5 for ; Mon, 22 Apr 2013 00:00:28 -0700 (PDT) Message-ID: <5174E006.4090104@gmail.com> Date: Mon, 22 Apr 2013 15:00:22 +0800 From: Liu Yuan MIME-Version: 1.0 References: <1366285732-21694-1-git-send-email-namei.unix@gmail.com> <874nezf6ik.wl%morita.kazutaka@lab.ntt.co.jp> In-Reply-To: <874nezf6ik.wl%morita.kazutaka@lab.ntt.co.jp> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [sheepdog] [PATCH] sheepdog: implement .bdrv_co_is_allocated List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: MORITA Kazutaka Cc: Kevin Wolf , sheepdog@lists.wpkg.org, qemu-devel@nongnu.org, Stefan Hajnoczi On 04/22/2013 02:01 PM, MORITA Kazutaka wrote: > It looks better to use BDRV_SECTOR_SIZE . I'd suggest preparing > another patch to replace all the SECTOR_SIZE with BDRV_SECTOR_SIZE. > Okay >> > + end = start + (nb_sectors * SECTOR_SIZE) / SD_DATA_OBJ_SIZE; > Using 'start' to calculate 'end' is wrong because 'start' may be > rounded down. > Good catch. Will updated it in v2 >> > + >> > + for (idx = start; idx <= end; idx++) { >> > + if (inode->data_vdi_id[idx] == 0) { >> > + break; >> > + } >> > + } >> > + if (idx == start) { >> > + *pnum = SD_DATA_OBJ_SIZE / SECTOR_SIZE; > Isn't it better to set the longest length of the unallocated sectors? > Good idea. Thanks, Yuan