diff options
author | Max Reitz <mreitz@redhat.com> | 2018-02-13 14:03:53 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-02-13 16:18:35 +0100 |
commit | c3132aff174ea35dd78bc8828fd79c28f9bc9a65 (patch) | |
tree | 7b727f18bf30f3189cbed22c00a6fa21ecb55d7c /block | |
parent | f3a33f795cc7a3372d2372480d34f6b95a3b09b6 (diff) |
gluster: Add preallocated truncation
By using qemu_do_cluster_truncate() in qemu_cluster_truncate(), we now
automatically have preallocated truncation.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/gluster.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/block/gluster.c b/block/gluster.c index 806b894bc8..3f17b7819d 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -1122,23 +1122,8 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs, static int qemu_gluster_truncate(BlockDriverState *bs, int64_t offset, PreallocMode prealloc, Error **errp) { - int ret; BDRVGlusterState *s = bs->opaque; - - if (prealloc != PREALLOC_MODE_OFF) { - error_setg(errp, "Unsupported preallocation mode '%s'", - PreallocMode_str(prealloc)); - return -ENOTSUP; - } - - ret = glfs_ftruncate(s->fd, offset); - if (ret < 0) { - ret = -errno; - error_setg_errno(errp, -ret, "Failed to truncate file"); - return ret; - } - - return 0; + return qemu_gluster_do_truncate(s->fd, offset, prealloc, errp); } static coroutine_fn int qemu_gluster_co_readv(BlockDriverState *bs, |