From patchwork Wed Jan 16 17:31:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 212861 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3A9342C0040 for ; Thu, 17 Jan 2013 04:32:39 +1100 (EST) Received: from localhost ([::1]:36576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvWqr-0007vq-8D for incoming@patchwork.ozlabs.org; Wed, 16 Jan 2013 12:32:37 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvWqI-0007Et-NP for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:32:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvWqH-0000yF-0B for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:32:02 -0500 Received: from mail-ie0-f181.google.com ([209.85.223.181]:57354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvWqG-0000y9-SB for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:32:00 -0500 Received: by mail-ie0-f181.google.com with SMTP id 16so2991060iea.26 for ; Wed, 16 Jan 2013 09:32:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=5rqvs+xhWlfsnI5WmDqphnJ+yZDgwlV45DuVcDTb1Co=; b=hoRj3YVR6KJqjyuYIqBiEFQ5taIjFzepyeWFOi6p5Li1vEJ0En1bM8NW+YuQYn7bq0 a2a6kcKfnDheppcm7ZFuv9PNylWNYY2VFhP3n++Z/qKsL4nZQMZAjW8UaW0OsBY/uX85 WewbJWSa5f4YdpiW+qkLZog4ffrsLc56JbMy/8H4qJ7TF9PqKv7OyDH8AQmx1WkDF4eM dusTXafCmEnvzZUflMf52vagxfPlYe674ca8w1u/ja9CHYBC+suST27fxy/VrSrkU/RH 3XZ47C6BT5z2QI1vlSAauZ2W4gHmRtNdbkmWGI1UXtyL8j1aIHAviXiylGhVFo4XP47g 5tmw== X-Received: by 10.50.158.170 with SMTP id wv10mr1366618igb.75.1358357520424; Wed, 16 Jan 2013 09:32:00 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-179-137.ip50.fastwebnet.it. [93.34.179.137]) by mx.google.com with ESMTPS id xn10sm4810446igb.4.2013.01.16.09.31.58 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 16 Jan 2013 09:31:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 16 Jan 2013 18:31:11 +0100 Message-Id: <1358357479-7912-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1358357479-7912-1-git-send-email-pbonzini@redhat.com> References: <1358357479-7912-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.223.181 Cc: kwolf@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v2 04/12] block: make round_to_clusters public X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This is needed in the following patch. Reviewed-by: Laszlo Ersek Signed-off-by: Paolo Bonzini --- block.c | 16 ++++++++-------- include/block/block.h | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index e0ff736..4a4ab16 100644 --- a/block.c +++ b/block.c @@ -1673,10 +1673,10 @@ static void tracked_request_begin(BdrvTrackedRequest *req, /** * Round a region to cluster boundaries */ -static void round_to_clusters(BlockDriverState *bs, - int64_t sector_num, int nb_sectors, - int64_t *cluster_sector_num, - int *cluster_nb_sectors) +void bdrv_round_to_clusters(BlockDriverState *bs, + int64_t sector_num, int nb_sectors, + int64_t *cluster_sector_num, + int *cluster_nb_sectors) { BlockDriverInfo bdi; @@ -1718,8 +1718,8 @@ static void coroutine_fn wait_for_overlapping_requests(BlockDriverState *bs, * CoR read and write operations are atomic and guest writes cannot * interleave between them. */ - round_to_clusters(bs, sector_num, nb_sectors, - &cluster_sector_num, &cluster_nb_sectors); + bdrv_round_to_clusters(bs, sector_num, nb_sectors, + &cluster_sector_num, &cluster_nb_sectors); do { retry = false; @@ -2185,8 +2185,8 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BlockDriverState *bs, /* Cover entire cluster so no additional backing file I/O is required when * allocating cluster in the image file. */ - round_to_clusters(bs, sector_num, nb_sectors, - &cluster_sector_num, &cluster_nb_sectors); + bdrv_round_to_clusters(bs, sector_num, nb_sectors, + &cluster_sector_num, &cluster_nb_sectors); trace_bdrv_co_do_copy_on_readv(bs, sector_num, nb_sectors, cluster_sector_num, cluster_nb_sectors); diff --git a/include/block/block.h b/include/block/block.h index 678fc60..9ee9068 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -309,6 +309,10 @@ int bdrv_get_flags(BlockDriverState *bs); int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors); int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi); +void bdrv_round_to_clusters(BlockDriverState *bs, + int64_t sector_num, int nb_sectors, + int64_t *cluster_sector_num, + int *cluster_nb_sectors); const char *bdrv_get_encrypted_filename(BlockDriverState *bs); void bdrv_get_backing_filename(BlockDriverState *bs,