Revision 0e69c543 block/vmdk.c
b/block/vmdk.c | ||
---|---|---|
514 | 514 |
/* 128 sectors * 512 bytes each = grain size 64KB */ |
515 | 515 |
uint8_t whole_grain[extent->cluster_sectors * 512]; |
516 | 516 |
|
517 |
// we will be here if it's first write on non-exist grain(cluster).
|
|
518 |
// try to read from parent image, if exist
|
|
517 |
/* we will be here if it's first write on non-exist grain(cluster).
|
|
518 |
* try to read from parent image, if exist */
|
|
519 | 519 |
if (bs->backing_hd) { |
520 | 520 |
int ret; |
521 | 521 |
|
522 | 522 |
if (!vmdk_is_cid_valid(bs)) |
523 | 523 |
return -1; |
524 | 524 |
|
525 |
/* floor offset to cluster */ |
|
526 |
offset -= offset % (extent->cluster_sectors * 512); |
|
525 | 527 |
ret = bdrv_read(bs->backing_hd, offset >> 9, whole_grain, |
526 | 528 |
extent->cluster_sectors); |
527 | 529 |
if (ret < 0) { |
528 | 530 |
return -1; |
529 | 531 |
} |
530 | 532 |
|
531 |
//Write grain only into the active image
|
|
533 |
/* Write grain only into the active image */
|
|
532 | 534 |
ret = bdrv_write(extent->file, cluster_offset, whole_grain, |
533 | 535 |
extent->cluster_sectors); |
534 | 536 |
if (ret < 0) { |
Also available in: Unified diff