preallocate.c (880953493386a69416d2e1cdc063c670585a03ac) preallocate.c (9a5a1c621ed72161abcf461d46c7b7b7f97938bf)
1/*
2 * preallocate filter driver
3 *
4 * The driver performs preallocate operation: it is injected above
5 * some node, and before each write over EOF it does additional preallocating
6 * write-zeroes request.
7 *
8 * Copyright (c) 2020 Virtuozzo International GmbH.

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

229static coroutine_fn int preallocate_co_preadv_part(
230 BlockDriverState *bs, int64_t offset, int64_t bytes,
231 QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags)
232{
233 return bdrv_co_preadv_part(bs->file, offset, bytes, qiov, qiov_offset,
234 flags);
235}
236
1/*
2 * preallocate filter driver
3 *
4 * The driver performs preallocate operation: it is injected above
5 * some node, and before each write over EOF it does additional preallocating
6 * write-zeroes request.
7 *
8 * Copyright (c) 2020 Virtuozzo International GmbH.

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

229static coroutine_fn int preallocate_co_preadv_part(
230 BlockDriverState *bs, int64_t offset, int64_t bytes,
231 QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags)
232{
233 return bdrv_co_preadv_part(bs->file, offset, bytes, qiov, qiov_offset,
234 flags);
235}
236
237static int coroutine_fn preallocate_co_pdiscard(BlockDriverState *bs,
238 int64_t offset, int64_t bytes)
237static int coroutine_fn GRAPH_RDLOCK
238preallocate_co_pdiscard(BlockDriverState *bs, int64_t offset, int64_t bytes)
239{
240 return bdrv_co_pdiscard(bs->file, offset, bytes);
241}
242
243static bool can_write_resize(uint64_t perm)
244{
245 return (perm & BLK_PERM_WRITE) && (perm & BLK_PERM_RESIZE);
246}

--- 322 unchanged lines hidden ---
239{
240 return bdrv_co_pdiscard(bs->file, offset, bytes);
241}
242
243static bool can_write_resize(uint64_t perm)
244{
245 return (perm & BLK_PERM_WRITE) && (perm & BLK_PERM_RESIZE);
246}

--- 322 unchanged lines hidden ---