* [Qemu-devel] [PATCH v2] cow: use bdrv_co_is_allocated()
@ 2011-11-23 15:00 Stefan Hajnoczi
2011-11-23 16:08 ` Kevin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2011-11-23 15:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi
Now that bdrv_co_is_allocated() is available we can use it instead of
the synchronous bdrv_is_allocated() interface. This is a follow-up that
Kevin Wolf <kwolf@redhat.com> pointed out after applying the series that
introduces bdrv_co_is_allocated().
It is safe to make cow_read() a coroutine_fn because its only caller is
a coroutine_fn.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
block/cow.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/cow.c b/block/cow.c
index 7ae887b..586493c 100644
--- a/block/cow.c
+++ b/block/cow.c
@@ -171,14 +171,14 @@ static int cow_update_bitmap(BlockDriverState *bs, int64_t sector_num,
return error;
}
-static int cow_read(BlockDriverState *bs, int64_t sector_num,
- uint8_t *buf, int nb_sectors)
+static int coroutine_fn cow_read(BlockDriverState *bs, int64_t sector_num,
+ uint8_t *buf, int nb_sectors)
{
BDRVCowState *s = bs->opaque;
int ret, n;
while (nb_sectors > 0) {
- if (bdrv_is_allocated(bs, sector_num, nb_sectors, &n)) {
+ if (bdrv_co_is_allocated(bs, sector_num, nb_sectors, &n)) {
ret = bdrv_pread(bs->file,
s->cow_sectors_offset + sector_num * 512,
buf, n * 512);
--
1.7.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v2] cow: use bdrv_co_is_allocated()
2011-11-23 15:00 [Qemu-devel] [PATCH v2] cow: use bdrv_co_is_allocated() Stefan Hajnoczi
@ 2011-11-23 16:08 ` Kevin Wolf
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2011-11-23 16:08 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel
Am 23.11.2011 16:00, schrieb Stefan Hajnoczi:
> Now that bdrv_co_is_allocated() is available we can use it instead of
> the synchronous bdrv_is_allocated() interface. This is a follow-up that
> Kevin Wolf <kwolf@redhat.com> pointed out after applying the series that
> introduces bdrv_co_is_allocated().
>
> It is safe to make cow_read() a coroutine_fn because its only caller is
> a coroutine_fn.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Thanks, applied to the block branch (for 1.1)
Kevin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-23 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-23 15:00 [Qemu-devel] [PATCH v2] cow: use bdrv_co_is_allocated() Stefan Hajnoczi
2011-11-23 16:08 ` Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).