block.c (727f005e6a5416ea903d0ccc2428cbdc663aa1d2) block.c (05c4af54c670f5143bd4ac5d79aa1ef53a9f31ca)
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 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

--- 999 unchanged lines hidden (view full) ---

1008 }
1009 bs->backing_hd = bs_rw;
1010 }
1011
1012 total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
1013 buf = g_malloc(COMMIT_BUF_SECTORS * BDRV_SECTOR_SIZE);
1014
1015 for (sector = 0; sector < total_sectors; sector += n) {
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 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

--- 999 unchanged lines hidden (view full) ---

1008 }
1009 bs->backing_hd = bs_rw;
1010 }
1011
1012 total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
1013 buf = g_malloc(COMMIT_BUF_SECTORS * BDRV_SECTOR_SIZE);
1014
1015 for (sector = 0; sector < total_sectors; sector += n) {
1016 if (drv->bdrv_is_allocated(bs, sector, COMMIT_BUF_SECTORS, &n)) {
1016 if (bdrv_is_allocated(bs, sector, COMMIT_BUF_SECTORS, &n)) {
1017
1018 if (bdrv_read(bs, sector, buf, n) != 0) {
1019 ret = -EIO;
1020 goto ro_cleanup;
1021 }
1022
1023 if (bdrv_write(bs->backing_hd, sector, buf, n) != 0) {
1024 ret = -EIO;

--- 2554 unchanged lines hidden ---
1017
1018 if (bdrv_read(bs, sector, buf, n) != 0) {
1019 ret = -EIO;
1020 goto ro_cleanup;
1021 }
1022
1023 if (bdrv_write(bs->backing_hd, sector, buf, n) != 0) {
1024 ret = -EIO;

--- 2554 unchanged lines hidden ---