Patchwork [PULL,21/42] cow: do not call bdrv_co_is_allocated

login
register
mail settings
Submitter Stefan Hajnoczi
Date Sept. 6, 2013, 3:38 p.m.
Message ID <1378481953-23099-22-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/273277/
State New
Headers show

Comments

Stefan Hajnoczi - Sept. 6, 2013, 3:38 p.m.
From: Paolo Bonzini <pbonzini@redhat.com>

As we change bdrv_is_allocated to gather more information from bs and
bs->file, it will become a bit slower.  It is still appropriate for online
jobs, but not for reads/writes.  Call the internal function instead.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/cow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/block/cow.c b/block/cow.c
index cd889e6..f4eca10 100644
--- a/block/cow.c
+++ b/block/cow.c
@@ -212,7 +212,7 @@  static int coroutine_fn cow_read(BlockDriverState *bs, int64_t sector_num,
     int ret, n;
 
     while (nb_sectors > 0) {
-        if (bdrv_co_is_allocated(bs, sector_num, nb_sectors, &n)) {
+        if (cow_co_is_allocated(bs, sector_num, nb_sectors, &n)) {
             ret = bdrv_pread(bs->file,
                         s->cow_sectors_offset + sector_num * 512,
                         buf, n * 512);