[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V8 4/8] qcow2: return int for qcow2_free_clusters()
From: |
Wenchao Xia |
Subject: |
[Qemu-devel] [PATCH V8 4/8] qcow2: return int for qcow2_free_clusters() |
Date: |
Fri, 3 Jan 2014 11:08:48 +0800 |
The return value can help caller check whether error happens,
and it need not to have *errp since the return value already tip
what happend.
Signed-off-by: Wenchao Xia <address@hidden>
---
block/qcow2-refcount.c | 8 +++++---
block/qcow2.h | 6 +++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index c974abe..4eb413a 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -761,9 +761,9 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size)
return offset;
}
-void qcow2_free_clusters(BlockDriverState *bs,
- int64_t offset, int64_t size,
- enum qcow2_discard_type type)
+int qcow2_free_clusters(BlockDriverState *bs,
+ int64_t offset, int64_t size,
+ enum qcow2_discard_type type)
{
int ret;
@@ -773,6 +773,8 @@ void qcow2_free_clusters(BlockDriverState *bs,
fprintf(stderr, "qcow2_free_clusters failed: %s\n", strerror(-ret));
/* TODO Remember the clusters to free them later and avoid leaking */
}
+
+ return ret;
}
/*
diff --git a/block/qcow2.h b/block/qcow2.h
index c56a5b6..161549a 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -435,9 +435,9 @@ int64_t qcow2_alloc_clusters(BlockDriverState *bs, int64_t
size);
int qcow2_alloc_clusters_at(BlockDriverState *bs, uint64_t offset,
int nb_clusters);
int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size);
-void qcow2_free_clusters(BlockDriverState *bs,
- int64_t offset, int64_t size,
- enum qcow2_discard_type type);
+int qcow2_free_clusters(BlockDriverState *bs,
+ int64_t offset, int64_t size,
+ enum qcow2_discard_type type);
void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry,
int nb_clusters, enum qcow2_discard_type type);
--
1.7.1
- [Qemu-devel] [PATCH V8 0/8] qcow2: rollback the modification on fail in snapshot creation, Wenchao Xia, 2014/01/03
- [Qemu-devel] [PATCH V8 8/8] qemu-iotests: add test for qcow2 snapshot, Wenchao Xia, 2014/01/03
- [Qemu-devel] [PATCH V8 3/8] util: add error_append(), Wenchao Xia, 2014/01/03
- [Qemu-devel] [PATCH V8 4/8] qcow2: return int for qcow2_free_clusters(),
Wenchao Xia <=
- [Qemu-devel] [PATCH V8 2/8] qcow2: add error message in qcow2_write_snapshots(), Wenchao Xia, 2014/01/03
- [Qemu-devel] [PATCH V8 6/8] qcow2: rollback on fail in qcow2_snapshot_create(), Wenchao Xia, 2014/01/03
- [Qemu-devel] [PATCH V8 1/8] snapshot: add parameter *errp in snapshot create, Wenchao Xia, 2014/01/03
- [Qemu-devel] [PATCH V8 5/8] qcow2: full rollback on fail in qcow2_write_snapshots(), Wenchao Xia, 2014/01/03
- [Qemu-devel] [PATCH V8 7/8] blkdebug: add debug events for snapshot, Wenchao Xia, 2014/01/03
- Re: [Qemu-devel] [PATCH V8 0/8] qcow2: rollback the modification on fail in snapshot creation, Stefan Hajnoczi, 2014/01/06