block.c (d3faa13e5ffda779dcd58f39e8745370adb05d67) block.c (47fec59941a7182380bc8dde3faf17cfb05b770f)
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

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

3419
3420 assert(!(bs->open_flags & BDRV_O_INACTIVE));
3421
3422 ret = drv->bdrv_truncate(bs, offset, errp);
3423 if (ret == 0) {
3424 ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
3425 bdrv_dirty_bitmap_truncate(bs);
3426 bdrv_parent_cb_resize(bs);
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

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

3419
3420 assert(!(bs->open_flags & BDRV_O_INACTIVE));
3421
3422 ret = drv->bdrv_truncate(bs, offset, errp);
3423 if (ret == 0) {
3424 ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
3425 bdrv_dirty_bitmap_truncate(bs);
3426 bdrv_parent_cb_resize(bs);
3427 ++bs->write_gen;
3427 atomic_inc(&bs->write_gen);
3428 }
3429 return ret;
3430}
3431
3432/**
3433 * Length of a allocated file in bytes. Sparse files are counted by actual
3434 * allocated space. Return < 0 if error or unknown.
3435 */

--- 1498 unchanged lines hidden ---
3428 }
3429 return ret;
3430}
3431
3432/**
3433 * Length of a allocated file in bytes. Sparse files are counted by actual
3434 * allocated space. Return < 0 if error or unknown.
3435 */

--- 1498 unchanged lines hidden ---