aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-03-23 12:49:17 +0100
committerKevin Wolf <kwolf@redhat.com>2010-04-23 16:08:46 +0200
commit79a31189d4e3d226c6c700d630476ec63bbc19a2 (patch)
treed6d3ed5f650db6724e3d90f877d485950122328f
parent50779cc264aa1abd75aa5afa34740d4fd8481f1d (diff)
qcow2: Return 0/-errno in write_l2_entries
Change write_l2_entries to return the real error code instead of -1. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/qcow2-cluster.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 8cb4b38d20..2f37acdb6b 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -627,12 +627,13 @@ static int write_l2_entries(BDRVQcowState *s, uint64_t *l2_table,
int start_offset = (8 * l2_index) & ~511;
int end_offset = (8 * (l2_index + num) + 511) & ~511;
size_t len = end_offset - start_offset;
+ int ret;
BLKDBG_EVENT(s->hd, BLKDBG_L2_UPDATE);
- if (bdrv_pwrite(s->hd, l2_offset + start_offset, &l2_table[l2_start_index],
- len) != len)
- {
- return -1;
+ ret = bdrv_pwrite(s->hd, l2_offset + start_offset,
+ &l2_table[l2_start_index], len);
+ if (ret < 0) {
+ return ret;
}
return 0;