block: Clean up bdrv_snapshots()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Markus Armbruster 2010-07-01 09:30:38 +02:00 committed by Kevin Wolf
parent f9092b108f
commit 3ac906f771
1 changed files with 4 additions and 5 deletions

View File

@ -1789,19 +1789,18 @@ BlockDriverState *bdrv_snapshots(void)
{ {
BlockDriverState *bs; BlockDriverState *bs;
if (bs_snapshots) if (bs_snapshots) {
return bs_snapshots; return bs_snapshots;
}
bs = NULL; bs = NULL;
while ((bs = bdrv_next(bs))) { while ((bs = bdrv_next(bs))) {
if (bdrv_can_snapshot(bs)) { if (bdrv_can_snapshot(bs)) {
goto ok; bs_snapshots = bs;
return bs;
} }
} }
return NULL; return NULL;
ok:
bs_snapshots = bs;
return bs;
} }
int bdrv_snapshot_create(BlockDriverState *bs, int bdrv_snapshot_create(BlockDriverState *bs,