From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHrFh-0007Ut-Ae for qemu-devel@nongnu.org; Tue, 28 Jun 2016 07:32:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHrFc-0004t3-Jc for qemu-devel@nongnu.org; Tue, 28 Jun 2016 07:32:24 -0400 Received: from mail-am1on0144.outbound.protection.outlook.com ([157.56.112.144]:27073 helo=emea01-am1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHrFc-0004ri-58 for qemu-devel@nongnu.org; Tue, 28 Jun 2016 07:32:20 -0400 References: <1464686130-12265-1-git-send-email-den@openvz.org> <1464686130-12265-2-git-send-email-den@openvz.org> <575EC1DC.5020501@redhat.com> <20160628105343.GA6800@noname.redhat.com> From: Pavel Butsykin Message-ID: <57726039.1080602@virtuozzo.com> Date: Tue, 28 Jun 2016 14:32:09 +0300 MIME-Version: 1.0 In-Reply-To: <20160628105343.GA6800@noname.redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 01/11] block: switch blk_write_compressed() to byte-based interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , Eric Blake Cc: "Denis V. Lunev" , qemu-devel@nongnu.org, Jeff Cody , Markus Armbruster , John Snow , Stefan Hajnoczi On 28.06.2016 13:53, Kevin Wolf wrote: > Am 13.06.2016 um 16:23 hat Eric Blake geschrieben: >> On 05/31/2016 03:15 AM, Denis V. Lunev wrote: >>> From: Pavel Butsykin >>> >>> This is a preparatory patch, which continues the general trend of the transition >>> to the byte-based interfaces. >>> >>> Signed-off-by: Pavel Butsykin >>> Signed-off-by: Denis V. Lunev >>> CC: Jeff Cody >>> CC: Markus Armbruster >>> CC: Eric Blake >>> CC: John Snow >>> CC: Stefan Hajnoczi >>> CC: Kevin Wolf > >>> -int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, >>> - const uint8_t *buf, int nb_sectors) >>> +int bdrv_pwrite_compressed(BlockDriverState *bs, int64_t offset, >>> + const void *buf, int count) >>> { >>> BlockDriver *drv = bs->drv; >>> int ret; >>> @@ -1791,14 +1791,15 @@ int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, >>> if (!drv->bdrv_write_compressed) { >>> return -ENOTSUP; >>> } >>> - ret = bdrv_check_request(bs, sector_num, nb_sectors); >>> + ret = bdrv_check_byte_request(bs, offset, count); >>> if (ret < 0) { >>> return ret; >>> } >>> >>> assert(QLIST_EMPTY(&bs->dirty_bitmaps)); >>> >>> - return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors); >>> + return drv->bdrv_write_compressed(bs, offset >> BDRV_SECTOR_BITS, buf, >>> + count >> BDRV_SECTOR_BITS); >> >> If you are going to shift right, you need to first assert that offset >> and count are aligned (and thus that our call to a sector interface >> isn't going to operate on the wrong data). See for example commit 166fe960. > > Yes, I would like to have these assertions at least. > > But I'm wondering what the point of converting the interface is when we > don't intend to actually support sub-sector requests and the sector > alignment is still required at the end of the series. Because at the time of sending patches, the format drivers still had the sector-based interfaces. In the end, the assertions are not necessary, because the interface format driver now also byte-based. > Kevin >