From patchwork Wed Dec 12 13:46:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 205517 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 D36902C008D for ; Thu, 13 Dec 2012 00:47:46 +1100 (EST) Received: from localhost ([::1]:47152 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Timf3-0007X5-0A for incoming@patchwork.ozlabs.org; Wed, 12 Dec 2012 08:47:45 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Timea-0007Bi-BE for qemu-devel@nongnu.org; Wed, 12 Dec 2012 08:47:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TimeU-0003il-DX for qemu-devel@nongnu.org; Wed, 12 Dec 2012 08:47:16 -0500 Received: from mail-ie0-f180.google.com ([209.85.223.180]:63673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TimeU-0003ih-8F for qemu-devel@nongnu.org; Wed, 12 Dec 2012 08:47:10 -0500 Received: by mail-ie0-f180.google.com with SMTP id c10so1953851ieb.39 for ; Wed, 12 Dec 2012 05:47:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=G1KI+ahrnE1Y2LKrUVY7+PPISmn/s95HWlwAL6oCTmQ=; b=hYqzv069U0Gc/f6uMY+WH9eGtazyklMUyXYp8X9q0HExU/16ScqRKyKsOX6InNVD/U u2ason8kN/VhwpsL6Vz3lura1lW3Ns84k6us1ZRQC54xdeyZZsOcaiaR1lPSDy1CsGK0 2o1Wc0tRu+Urys+kXLvw707FNm3E6LuokHEfR3OJw53U+MNZ1WwU9xDxVjlyAf3/C42E UXg1xh9Z9VYokxe/1wRZZNFuVK9sdlmCoa5a7Sl4VfJKeJZ+u390CB91dG+dqzZsW8Ni IsOD4YnRARaxGUHgcFjARB0ySq0vq8OnE5LXWDiiKUyVs5FXvftRPlDY0RPPEEXcjqXc bgUQ== Received: by 10.50.202.104 with SMTP id kh8mr13168372igc.21.1355320029561; Wed, 12 Dec 2012 05:47:09 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-219-150.ip51.fastwebnet.it. [93.34.219.150]) by mx.google.com with ESMTPS id fv6sm1786818igc.17.2012.12.12.05.47.05 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Dec 2012 05:47:07 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2012 14:46:23 +0100 Message-Id: <1355319999-30627-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.0.1 In-Reply-To: <1355319999-30627-1-git-send-email-pbonzini@redhat.com> References: <1355319999-30627-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.180 Cc: kwolf@redhat.com, jcody@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH 04/20] 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 Reviewed-by: Eric Blake --- block.c | 16 ++++++++-------- block.h | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index f033c1e..d93c386 100644 --- a/block.c +++ b/block.c @@ -1660,10 +1660,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; @@ -1705,8 +1705,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; @@ -2172,8 +2172,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 6a84350..1418915 100644 --- a/block.h +++ b/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,