Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 340e01248478ba8b78a6d4d1809b1eff > files > 662

kvm-83-270.el5_11.src.rpm

From 55004baf563ac5ecce0f4ba55941330769baeced Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Fri, 18 Jun 2010 15:22:23 -0300
Subject: [PATCH 05/18] qcow2: Return 0/-errno in write_l1_entry

RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <1276874554-9820-6-git-send-email-kwolf@redhat.com>
Patchwork-id: 9980
O-Subject: [RHEL-5.6 KVM PATCH 05/16] qcow2: Return 0/-errno in write_l1_entry
Bugzilla: 605701
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Christoph Hellwig <chellwig@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>

Bugzilla: 605701
Upstream commit: f7defcb62792eff05fa8a7ffec6a927a88087b83

Change write_l1_entry to return the real error code instead of -1.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu/block-qcow2.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu/block-qcow2.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/qemu/block-qcow2.c b/qemu/block-qcow2.c
index a594364..cd5a927 100644
--- a/qemu/block-qcow2.c
+++ b/qemu/block-qcow2.c
@@ -666,17 +666,17 @@ static int write_l1_entry(BDRVQcowState *s, int l1_index)
 {
     uint64_t buf[L1_ENTRIES_PER_SECTOR];
     int l1_start_index;
-    int i;
+    int i, ret;
 
     l1_start_index = l1_index & ~(L1_ENTRIES_PER_SECTOR - 1);
     for (i = 0; i < L1_ENTRIES_PER_SECTOR; i++) {
         buf[i] = cpu_to_be64(s->l1_table[l1_start_index + i]);
     }
 
-    if (bdrv_pwrite(s->hd, s->l1_table_offset + 8 * l1_start_index,
-        buf, sizeof(buf)) != sizeof(buf))
-    {
-        return -1;
+    ret = bdrv_pwrite(s->hd, s->l1_table_offset + 8 * l1_start_index,
+        buf, sizeof(buf));
+    if (ret < 0) {
+        return ret;
     }
 
     return 0;
-- 
1.7.0.3