|
|
9ae3a8 |
From 4f7481a9815ec6b879db9cb20be7dcc419274e11 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Asias He <asias@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 12 Sep 2013 07:39:32 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 12/29] gluster: Add image resize support
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Asias He <asias@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1378971575-22416-2-git-send-email-asias@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 54323
|
|
|
9ae3a8 |
O-Subject: [RHEL7.0 qemu-kvm PATCH 1/4] gluster: Add image resize support
|
|
|
9ae3a8 |
Bugzilla: 1007226
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1005052
|
|
|
9ae3a8 |
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6275752
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Implement .bdrv_truncate in GlusterFS block driver so that GlusterFS backend
|
|
|
9ae3a8 |
can support image resizing.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
|
|
|
9ae3a8 |
Tested-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
|
|
|
9ae3a8 |
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 42ec24e2851674e0899f71933e0d7d9125f31d76)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/gluster.c | 17 +++++++++++++++++
|
|
|
9ae3a8 |
1 file changed, 17 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/gluster.c | 17 +++++++++++++++++
|
|
|
9ae3a8 |
1 files changed, 17 insertions(+), 0 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block/gluster.c b/block/gluster.c
|
|
|
9ae3a8 |
index 61424bc..7b10e9c 100644
|
|
|
9ae3a8 |
--- a/block/gluster.c
|
|
|
9ae3a8 |
+++ b/block/gluster.c
|
|
|
9ae3a8 |
@@ -493,6 +493,19 @@ out:
|
|
|
9ae3a8 |
return NULL;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+static int qemu_gluster_truncate(BlockDriverState *bs, int64_t offset)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ int ret;
|
|
|
9ae3a8 |
+ BDRVGlusterState *s = bs->opaque;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ ret = glfs_ftruncate(s->fd, offset);
|
|
|
9ae3a8 |
+ if (ret < 0) {
|
|
|
9ae3a8 |
+ return -errno;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ return 0;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static BlockDriverAIOCB *qemu_gluster_aio_readv(BlockDriverState *bs,
|
|
|
9ae3a8 |
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
|
|
|
9ae3a8 |
BlockDriverCompletionFunc *cb, void *opaque)
|
|
|
9ae3a8 |
@@ -598,6 +611,7 @@ static BlockDriver bdrv_gluster = {
|
|
|
9ae3a8 |
.bdrv_create = qemu_gluster_create,
|
|
|
9ae3a8 |
.bdrv_getlength = qemu_gluster_getlength,
|
|
|
9ae3a8 |
.bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
|
|
|
9ae3a8 |
+ .bdrv_truncate = qemu_gluster_truncate,
|
|
|
9ae3a8 |
.bdrv_aio_readv = qemu_gluster_aio_readv,
|
|
|
9ae3a8 |
.bdrv_aio_writev = qemu_gluster_aio_writev,
|
|
|
9ae3a8 |
.bdrv_aio_flush = qemu_gluster_aio_flush,
|
|
|
9ae3a8 |
@@ -614,6 +628,7 @@ static BlockDriver bdrv_gluster_tcp = {
|
|
|
9ae3a8 |
.bdrv_create = qemu_gluster_create,
|
|
|
9ae3a8 |
.bdrv_getlength = qemu_gluster_getlength,
|
|
|
9ae3a8 |
.bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
|
|
|
9ae3a8 |
+ .bdrv_truncate = qemu_gluster_truncate,
|
|
|
9ae3a8 |
.bdrv_aio_readv = qemu_gluster_aio_readv,
|
|
|
9ae3a8 |
.bdrv_aio_writev = qemu_gluster_aio_writev,
|
|
|
9ae3a8 |
.bdrv_aio_flush = qemu_gluster_aio_flush,
|
|
|
9ae3a8 |
@@ -630,6 +645,7 @@ static BlockDriver bdrv_gluster_unix = {
|
|
|
9ae3a8 |
.bdrv_create = qemu_gluster_create,
|
|
|
9ae3a8 |
.bdrv_getlength = qemu_gluster_getlength,
|
|
|
9ae3a8 |
.bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
|
|
|
9ae3a8 |
+ .bdrv_truncate = qemu_gluster_truncate,
|
|
|
9ae3a8 |
.bdrv_aio_readv = qemu_gluster_aio_readv,
|
|
|
9ae3a8 |
.bdrv_aio_writev = qemu_gluster_aio_writev,
|
|
|
9ae3a8 |
.bdrv_aio_flush = qemu_gluster_aio_flush,
|
|
|
9ae3a8 |
@@ -646,6 +662,7 @@ static BlockDriver bdrv_gluster_rdma = {
|
|
|
9ae3a8 |
.bdrv_create = qemu_gluster_create,
|
|
|
9ae3a8 |
.bdrv_getlength = qemu_gluster_getlength,
|
|
|
9ae3a8 |
.bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
|
|
|
9ae3a8 |
+ .bdrv_truncate = qemu_gluster_truncate,
|
|
|
9ae3a8 |
.bdrv_aio_readv = qemu_gluster_aio_readv,
|
|
|
9ae3a8 |
.bdrv_aio_writev = qemu_gluster_aio_writev,
|
|
|
9ae3a8 |
.bdrv_aio_flush = qemu_gluster_aio_flush,
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|