snapshot.c (03d1cbe320211ee60588843abad92f30de1d5ffe) | snapshot.c (5e003f17ec518cd96f5d2ac23ce9e14144426235) |
---|---|
1/* 2 * Block layer snapshot related functions 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 403 unchanged lines hidden (view full) --- 412 AioContext *ctx = bdrv_get_aio_context(bs); 413 414 aio_context_acquire(ctx); 415 if (bdrv_is_inserted(bs) && !bdrv_is_read_only(bs)) { 416 ok = bdrv_can_snapshot(bs); 417 } 418 aio_context_release(ctx); 419 if (!ok) { | 1/* 2 * Block layer snapshot related functions 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 403 unchanged lines hidden (view full) --- 412 AioContext *ctx = bdrv_get_aio_context(bs); 413 414 aio_context_acquire(ctx); 415 if (bdrv_is_inserted(bs) && !bdrv_is_read_only(bs)) { 416 ok = bdrv_can_snapshot(bs); 417 } 418 aio_context_release(ctx); 419 if (!ok) { |
420 bdrv_next_cleanup(&it); |
|
420 goto fail; 421 } 422 } 423 424fail: 425 *first_bad_bs = bs; 426 return ok; 427} --- 11 unchanged lines hidden (view full) --- 439 440 aio_context_acquire(ctx); 441 if (bdrv_can_snapshot(bs) && 442 bdrv_snapshot_find(bs, snapshot, name) >= 0) { 443 ret = bdrv_snapshot_delete_by_id_or_name(bs, name, err); 444 } 445 aio_context_release(ctx); 446 if (ret < 0) { | 421 goto fail; 422 } 423 } 424 425fail: 426 *first_bad_bs = bs; 427 return ok; 428} --- 11 unchanged lines hidden (view full) --- 440 441 aio_context_acquire(ctx); 442 if (bdrv_can_snapshot(bs) && 443 bdrv_snapshot_find(bs, snapshot, name) >= 0) { 444 ret = bdrv_snapshot_delete_by_id_or_name(bs, name, err); 445 } 446 aio_context_release(ctx); 447 if (ret < 0) { |
448 bdrv_next_cleanup(&it); |
|
447 goto fail; 448 } 449 } 450 451fail: 452 *first_bad_bs = bs; 453 return ret; 454} --- 9 unchanged lines hidden (view full) --- 464 AioContext *ctx = bdrv_get_aio_context(bs); 465 466 aio_context_acquire(ctx); 467 if (bdrv_can_snapshot(bs)) { 468 err = bdrv_snapshot_goto(bs, name); 469 } 470 aio_context_release(ctx); 471 if (err < 0) { | 449 goto fail; 450 } 451 } 452 453fail: 454 *first_bad_bs = bs; 455 return ret; 456} --- 9 unchanged lines hidden (view full) --- 466 AioContext *ctx = bdrv_get_aio_context(bs); 467 468 aio_context_acquire(ctx); 469 if (bdrv_can_snapshot(bs)) { 470 err = bdrv_snapshot_goto(bs, name); 471 } 472 aio_context_release(ctx); 473 if (err < 0) { |
474 bdrv_next_cleanup(&it); |
|
472 goto fail; 473 } 474 } 475 476fail: 477 *first_bad_bs = bs; 478 return err; 479} --- 9 unchanged lines hidden (view full) --- 489 AioContext *ctx = bdrv_get_aio_context(bs); 490 491 aio_context_acquire(ctx); 492 if (bdrv_can_snapshot(bs)) { 493 err = bdrv_snapshot_find(bs, &sn, name); 494 } 495 aio_context_release(ctx); 496 if (err < 0) { | 475 goto fail; 476 } 477 } 478 479fail: 480 *first_bad_bs = bs; 481 return err; 482} --- 9 unchanged lines hidden (view full) --- 492 AioContext *ctx = bdrv_get_aio_context(bs); 493 494 aio_context_acquire(ctx); 495 if (bdrv_can_snapshot(bs)) { 496 err = bdrv_snapshot_find(bs, &sn, name); 497 } 498 aio_context_release(ctx); 499 if (err < 0) { |
500 bdrv_next_cleanup(&it); |
|
497 goto fail; 498 } 499 } 500 501fail: 502 *first_bad_bs = bs; 503 return err; 504} --- 15 unchanged lines hidden (view full) --- 520 sn->vm_state_size = vm_state_size; 521 err = bdrv_snapshot_create(bs, sn); 522 } else if (bdrv_can_snapshot(bs)) { 523 sn->vm_state_size = 0; 524 err = bdrv_snapshot_create(bs, sn); 525 } 526 aio_context_release(ctx); 527 if (err < 0) { | 501 goto fail; 502 } 503 } 504 505fail: 506 *first_bad_bs = bs; 507 return err; 508} --- 15 unchanged lines hidden (view full) --- 524 sn->vm_state_size = vm_state_size; 525 err = bdrv_snapshot_create(bs, sn); 526 } else if (bdrv_can_snapshot(bs)) { 527 sn->vm_state_size = 0; 528 err = bdrv_snapshot_create(bs, sn); 529 } 530 aio_context_release(ctx); 531 if (err < 0) { |
532 bdrv_next_cleanup(&it); |
|
528 goto fail; 529 } 530 } 531 532fail: 533 *first_bad_bs = bs; 534 return err; 535} --- 7 unchanged lines hidden (view full) --- 543 AioContext *ctx = bdrv_get_aio_context(bs); 544 bool found; 545 546 aio_context_acquire(ctx); 547 found = bdrv_can_snapshot(bs); 548 aio_context_release(ctx); 549 550 if (found) { | 533 goto fail; 534 } 535 } 536 537fail: 538 *first_bad_bs = bs; 539 return err; 540} --- 7 unchanged lines hidden (view full) --- 548 AioContext *ctx = bdrv_get_aio_context(bs); 549 bool found; 550 551 aio_context_acquire(ctx); 552 found = bdrv_can_snapshot(bs); 553 aio_context_release(ctx); 554 555 if (found) { |
556 bdrv_next_cleanup(&it); |
|
551 break; 552 } 553 } 554 return bs; 555} | 557 break; 558 } 559 } 560 return bs; 561} |