From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfY85-00057H-LU for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:08:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfY7z-0005GP-Ct for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:08:05 -0400 Received: from mail-pz0-f45.google.com ([209.85.210.45]:49781) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfY7z-0004fx-22 for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:07:59 -0400 Received: by mail-pz0-f45.google.com with SMTP id n2so3246681dad.4 for ; Fri, 15 Jun 2012 08:07:58 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 15 Jun 2012 17:05:55 +0200 Message-Id: <1339772759-31004-33-git-send-email-pbonzini@redhat.com> In-Reply-To: <1339772759-31004-1-git-send-email-pbonzini@redhat.com> References: <1339772759-31004-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [RFC PATCH 32/36] block: make round_to_clusters public List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@linux.vnet.ibm.com, lcapitulino@redhat.com This is needed in the following patch. Signed-off-by: Paolo Bonzini --- block.c | 16 ++++++++-------- block.h | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index a105f9e..35ceed5 100644 --- a/block.c +++ b/block.c @@ -1456,10 +1456,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; @@ -1501,8 +1501,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; @@ -1811,8 +1811,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/block.h b/block.h index 0d8f21c..a79f26b 100644 --- a/block.h +++ b/block.h @@ -312,6 +312,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, -- 1.7.10.2