2 * GlusterFS backend for QEMU
4 * Copyright (C) 2012 Bharata B Rao <bharata@linux.vnet.ibm.com>
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
11 #include "qemu/osdep.h"
12 #include <glusterfs/api/glfs.h>
13 #include "block/block_int.h"
14 #include "qapi/error.h"
15 #include "qapi/qmp/qdict.h"
16 #include "qapi/qmp/qerror.h"
18 #include "qemu/error-report.h"
19 #include "qemu/option.h"
20 #include "qemu/cutils.h"
22 #define GLUSTER_OPT_FILENAME "filename"
23 #define GLUSTER_OPT_VOLUME "volume"
24 #define GLUSTER_OPT_PATH "path"
25 #define GLUSTER_OPT_TYPE "type"
26 #define GLUSTER_OPT_SERVER_PATTERN "server."
27 #define GLUSTER_OPT_HOST "host"
28 #define GLUSTER_OPT_PORT "port"
29 #define GLUSTER_OPT_TO "to"
30 #define GLUSTER_OPT_IPV4 "ipv4"
31 #define GLUSTER_OPT_IPV6 "ipv6"
32 #define GLUSTER_OPT_SOCKET "socket"
33 #define GLUSTER_OPT_DEBUG "debug"
34 #define GLUSTER_DEFAULT_PORT 24007
35 #define GLUSTER_DEBUG_DEFAULT 4
36 #define GLUSTER_DEBUG_MAX 9
37 #define GLUSTER_OPT_LOGFILE "logfile"
38 #define GLUSTER_LOGFILE_DEFAULT "-" /* handled in libgfapi as /dev/stderr */
40 #define GERR_INDEX_HINT "hint: check in 'server' array index '%d'\n"
42 typedef struct GlusterAIOCB
{
46 AioContext
*aio_context
;
49 typedef struct BDRVGlusterState
{
53 bool supports_seek_data
;
57 typedef struct BDRVGlusterReopenState
{
60 } BDRVGlusterReopenState
;
63 typedef struct GlfsPreopened
{
69 typedef struct ListElement
{
70 QLIST_ENTRY(ListElement
) list
;
74 static QLIST_HEAD(glfs_list
, ListElement
) glfs_list
;
76 static QemuOptsList qemu_gluster_create_opts
= {
77 .name
= "qemu-gluster-create-opts",
78 .head
= QTAILQ_HEAD_INITIALIZER(qemu_gluster_create_opts
.head
),
81 .name
= BLOCK_OPT_SIZE
,
82 .type
= QEMU_OPT_SIZE
,
83 .help
= "Virtual disk size"
86 .name
= BLOCK_OPT_PREALLOC
,
87 .type
= QEMU_OPT_STRING
,
88 .help
= "Preallocation mode (allowed values: off, full)"
91 .name
= GLUSTER_OPT_DEBUG
,
92 .type
= QEMU_OPT_NUMBER
,
93 .help
= "Gluster log level, valid range is 0-9",
96 .name
= GLUSTER_OPT_LOGFILE
,
97 .type
= QEMU_OPT_STRING
,
98 .help
= "Logfile path of libgfapi",
100 { /* end of list */ }
104 static QemuOptsList runtime_opts
= {
106 .head
= QTAILQ_HEAD_INITIALIZER(runtime_opts
.head
),
109 .name
= GLUSTER_OPT_FILENAME
,
110 .type
= QEMU_OPT_STRING
,
111 .help
= "URL to the gluster image",
114 .name
= GLUSTER_OPT_DEBUG
,
115 .type
= QEMU_OPT_NUMBER
,
116 .help
= "Gluster log level, valid range is 0-9",
119 .name
= GLUSTER_OPT_LOGFILE
,
120 .type
= QEMU_OPT_STRING
,
121 .help
= "Logfile path of libgfapi",
123 { /* end of list */ }
127 static QemuOptsList runtime_json_opts
= {
128 .name
= "gluster_json",
129 .head
= QTAILQ_HEAD_INITIALIZER(runtime_json_opts
.head
),
132 .name
= GLUSTER_OPT_VOLUME
,
133 .type
= QEMU_OPT_STRING
,
134 .help
= "name of gluster volume where VM image resides",
137 .name
= GLUSTER_OPT_PATH
,
138 .type
= QEMU_OPT_STRING
,
139 .help
= "absolute path to image file in gluster volume",
142 .name
= GLUSTER_OPT_DEBUG
,
143 .type
= QEMU_OPT_NUMBER
,
144 .help
= "Gluster log level, valid range is 0-9",
146 { /* end of list */ }
150 static QemuOptsList runtime_type_opts
= {
151 .name
= "gluster_type",
152 .head
= QTAILQ_HEAD_INITIALIZER(runtime_type_opts
.head
),
155 .name
= GLUSTER_OPT_TYPE
,
156 .type
= QEMU_OPT_STRING
,
159 { /* end of list */ }
163 static QemuOptsList runtime_unix_opts
= {
164 .name
= "gluster_unix",
165 .head
= QTAILQ_HEAD_INITIALIZER(runtime_unix_opts
.head
),
168 .name
= GLUSTER_OPT_SOCKET
,
169 .type
= QEMU_OPT_STRING
,
170 .help
= "socket file path (legacy)",
173 .name
= GLUSTER_OPT_PATH
,
174 .type
= QEMU_OPT_STRING
,
175 .help
= "socket file path (QAPI)",
177 { /* end of list */ }
181 static QemuOptsList runtime_inet_opts
= {
182 .name
= "gluster_inet",
183 .head
= QTAILQ_HEAD_INITIALIZER(runtime_inet_opts
.head
),
186 .name
= GLUSTER_OPT_TYPE
,
187 .type
= QEMU_OPT_STRING
,
191 .name
= GLUSTER_OPT_HOST
,
192 .type
= QEMU_OPT_STRING
,
193 .help
= "host address (hostname/ipv4/ipv6 addresses)",
196 .name
= GLUSTER_OPT_PORT
,
197 .type
= QEMU_OPT_STRING
,
198 .help
= "port number on which glusterd is listening (default 24007)",
202 .type
= QEMU_OPT_NUMBER
,
203 .help
= "max port number, not supported by gluster",
207 .type
= QEMU_OPT_BOOL
,
208 .help
= "ipv4 bool value, not supported by gluster",
212 .type
= QEMU_OPT_BOOL
,
213 .help
= "ipv6 bool value, not supported by gluster",
215 { /* end of list */ }
219 static void glfs_set_preopened(const char *volume
, glfs_t
*fs
)
221 ListElement
*entry
= NULL
;
223 entry
= g_new(ListElement
, 1);
225 entry
->saved
.volume
= g_strdup(volume
);
227 entry
->saved
.fs
= fs
;
228 entry
->saved
.ref
= 1;
230 QLIST_INSERT_HEAD(&glfs_list
, entry
, list
);
233 static glfs_t
*glfs_find_preopened(const char *volume
)
235 ListElement
*entry
= NULL
;
237 QLIST_FOREACH(entry
, &glfs_list
, list
) {
238 if (strcmp(entry
->saved
.volume
, volume
) == 0) {
240 return entry
->saved
.fs
;
247 static void glfs_clear_preopened(glfs_t
*fs
)
249 ListElement
*entry
= NULL
;
256 QLIST_FOREACH_SAFE(entry
, &glfs_list
, list
, next
) {
257 if (entry
->saved
.fs
== fs
) {
258 if (--entry
->saved
.ref
) {
262 QLIST_REMOVE(entry
, list
);
264 glfs_fini(entry
->saved
.fs
);
265 g_free(entry
->saved
.volume
);
271 static int parse_volume_options(BlockdevOptionsGluster
*gconf
, char *path
)
280 p
= q
= path
+ strspn(path
, "/");
281 p
+= strcspn(p
, "/");
285 gconf
->volume
= g_strndup(q
, p
- q
);
292 gconf
->path
= g_strdup(p
);
297 * file=gluster[+transport]://[host[:port]]/volume/path[?socket=...]
299 * 'gluster' is the protocol.
301 * 'transport' specifies the transport type used to connect to gluster
302 * management daemon (glusterd). Valid transport types are
303 * tcp or unix. If a transport type isn't specified, then tcp type is assumed.
305 * 'host' specifies the host where the volume file specification for
306 * the given volume resides. This can be either hostname or ipv4 address.
307 * If transport type is 'unix', then 'host' field should not be specified.
308 * The 'socket' field needs to be populated with the path to unix domain
311 * 'port' is the port number on which glusterd is listening. This is optional
312 * and if not specified, QEMU will send 0 which will make gluster to use the
313 * default port. If the transport type is unix, then 'port' should not be
316 * 'volume' is the name of the gluster volume which contains the VM image.
318 * 'path' is the path to the actual VM image that resides on gluster volume.
322 * file=gluster://1.2.3.4/testvol/a.img
323 * file=gluster+tcp://1.2.3.4/testvol/a.img
324 * file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img
325 * file=gluster+tcp://host.domain.com:24007/testvol/dir/a.img
326 * file=gluster+unix:///testvol/dir/a.img?socket=/tmp/glusterd.socket
328 static int qemu_gluster_parse_uri(BlockdevOptionsGluster
*gconf
,
329 const char *filename
)
331 SocketAddress
*gsconf
;
333 QueryParams
*qp
= NULL
;
334 bool is_unix
= false;
337 uri
= uri_parse(filename
);
342 gconf
->server
= g_new0(SocketAddressList
, 1);
343 gconf
->server
->value
= gsconf
= g_new0(SocketAddress
, 1);
346 if (!uri
->scheme
|| !strcmp(uri
->scheme
, "gluster")) {
347 gsconf
->type
= SOCKET_ADDRESS_TYPE_INET
;
348 } else if (!strcmp(uri
->scheme
, "gluster+tcp")) {
349 gsconf
->type
= SOCKET_ADDRESS_TYPE_INET
;
350 } else if (!strcmp(uri
->scheme
, "gluster+unix")) {
351 gsconf
->type
= SOCKET_ADDRESS_TYPE_UNIX
;
353 } else if (!strcmp(uri
->scheme
, "gluster+rdma")) {
354 gsconf
->type
= SOCKET_ADDRESS_TYPE_INET
;
355 warn_report("rdma feature is not supported, falling back to tcp");
361 ret
= parse_volume_options(gconf
, uri
->path
);
366 qp
= query_params_parse(uri
->query
);
367 if (qp
->n
> 1 || (is_unix
&& !qp
->n
) || (!is_unix
&& qp
->n
)) {
373 if (uri
->server
|| uri
->port
) {
377 if (strcmp(qp
->p
[0].name
, "socket")) {
381 gsconf
->u
.q_unix
.path
= g_strdup(qp
->p
[0].value
);
383 gsconf
->u
.inet
.host
= g_strdup(uri
->server
? uri
->server
: "localhost");
385 gsconf
->u
.inet
.port
= g_strdup_printf("%d", uri
->port
);
387 gsconf
->u
.inet
.port
= g_strdup_printf("%d", GLUSTER_DEFAULT_PORT
);
393 query_params_free(qp
);
399 static struct glfs
*qemu_gluster_glfs_init(BlockdevOptionsGluster
*gconf
,
405 SocketAddressList
*server
;
406 unsigned long long port
;
408 glfs
= glfs_find_preopened(gconf
->volume
);
413 glfs
= glfs_new(gconf
->volume
);
418 glfs_set_preopened(gconf
->volume
, glfs
);
420 for (server
= gconf
->server
; server
; server
= server
->next
) {
421 switch (server
->value
->type
) {
422 case SOCKET_ADDRESS_TYPE_UNIX
:
423 ret
= glfs_set_volfile_server(glfs
, "unix",
424 server
->value
->u
.q_unix
.path
, 0);
426 case SOCKET_ADDRESS_TYPE_INET
:
427 if (parse_uint_full(server
->value
->u
.inet
.port
, &port
, 10) < 0 ||
429 error_setg(errp
, "'%s' is not a valid port number",
430 server
->value
->u
.inet
.port
);
434 ret
= glfs_set_volfile_server(glfs
, "tcp",
435 server
->value
->u
.inet
.host
,
438 case SOCKET_ADDRESS_TYPE_VSOCK
:
439 case SOCKET_ADDRESS_TYPE_FD
:
449 ret
= glfs_set_logging(glfs
, gconf
->logfile
, gconf
->debug
);
454 ret
= glfs_init(glfs
);
456 error_setg(errp
, "Gluster connection for volume %s, path %s failed"
457 " to connect", gconf
->volume
, gconf
->path
);
458 for (server
= gconf
->server
; server
; server
= server
->next
) {
459 if (server
->value
->type
== SOCKET_ADDRESS_TYPE_UNIX
) {
460 error_append_hint(errp
, "hint: failed on socket %s ",
461 server
->value
->u
.q_unix
.path
);
463 error_append_hint(errp
, "hint: failed on host %s and port %s ",
464 server
->value
->u
.inet
.host
,
465 server
->value
->u
.inet
.port
);
469 error_append_hint(errp
, "Please refer to gluster logs for more info\n");
471 /* glfs_init sometimes doesn't set errno although docs suggest that */
483 glfs_clear_preopened(glfs
);
490 * Convert the json formatted command line into qapi.
492 static int qemu_gluster_parse_json(BlockdevOptionsGluster
*gconf
,
493 QDict
*options
, Error
**errp
)
496 SocketAddress
*gsconf
= NULL
;
497 SocketAddressList
*curr
= NULL
;
498 QDict
*backing_options
= NULL
;
499 Error
*local_err
= NULL
;
502 int i
, type
, num_servers
;
504 /* create opts info from runtime_json_opts list */
505 opts
= qemu_opts_create(&runtime_json_opts
, NULL
, 0, &error_abort
);
506 qemu_opts_absorb_qdict(opts
, options
, &local_err
);
511 num_servers
= qdict_array_entries(options
, GLUSTER_OPT_SERVER_PATTERN
);
512 if (num_servers
< 1) {
513 error_setg(&local_err
, QERR_MISSING_PARAMETER
, "server");
517 ptr
= qemu_opt_get(opts
, GLUSTER_OPT_VOLUME
);
519 error_setg(&local_err
, QERR_MISSING_PARAMETER
, GLUSTER_OPT_VOLUME
);
522 gconf
->volume
= g_strdup(ptr
);
524 ptr
= qemu_opt_get(opts
, GLUSTER_OPT_PATH
);
526 error_setg(&local_err
, QERR_MISSING_PARAMETER
, GLUSTER_OPT_PATH
);
529 gconf
->path
= g_strdup(ptr
);
532 for (i
= 0; i
< num_servers
; i
++) {
533 str
= g_strdup_printf(GLUSTER_OPT_SERVER_PATTERN
"%d.", i
);
534 qdict_extract_subqdict(options
, &backing_options
, str
);
536 /* create opts info from runtime_type_opts list */
537 opts
= qemu_opts_create(&runtime_type_opts
, NULL
, 0, &error_abort
);
538 qemu_opts_absorb_qdict(opts
, backing_options
, &local_err
);
543 ptr
= qemu_opt_get(opts
, GLUSTER_OPT_TYPE
);
545 error_setg(&local_err
, QERR_MISSING_PARAMETER
, GLUSTER_OPT_TYPE
);
546 error_append_hint(&local_err
, GERR_INDEX_HINT
, i
);
550 gsconf
= g_new0(SocketAddress
, 1);
551 if (!strcmp(ptr
, "tcp")) {
552 ptr
= "inet"; /* accept legacy "tcp" */
554 type
= qapi_enum_parse(&SocketAddressType_lookup
, ptr
, -1, NULL
);
555 if (type
!= SOCKET_ADDRESS_TYPE_INET
556 && type
!= SOCKET_ADDRESS_TYPE_UNIX
) {
557 error_setg(&local_err
,
558 "Parameter '%s' may be 'inet' or 'unix'",
560 error_append_hint(&local_err
, GERR_INDEX_HINT
, i
);
566 if (gsconf
->type
== SOCKET_ADDRESS_TYPE_INET
) {
567 /* create opts info from runtime_inet_opts list */
568 opts
= qemu_opts_create(&runtime_inet_opts
, NULL
, 0, &error_abort
);
569 qemu_opts_absorb_qdict(opts
, backing_options
, &local_err
);
574 ptr
= qemu_opt_get(opts
, GLUSTER_OPT_HOST
);
576 error_setg(&local_err
, QERR_MISSING_PARAMETER
,
578 error_append_hint(&local_err
, GERR_INDEX_HINT
, i
);
581 gsconf
->u
.inet
.host
= g_strdup(ptr
);
582 ptr
= qemu_opt_get(opts
, GLUSTER_OPT_PORT
);
584 error_setg(&local_err
, QERR_MISSING_PARAMETER
,
586 error_append_hint(&local_err
, GERR_INDEX_HINT
, i
);
589 gsconf
->u
.inet
.port
= g_strdup(ptr
);
591 /* defend for unsupported fields in InetSocketAddress,
592 * i.e. @ipv4, @ipv6 and @to
594 ptr
= qemu_opt_get(opts
, GLUSTER_OPT_TO
);
596 gsconf
->u
.inet
.has_to
= true;
598 ptr
= qemu_opt_get(opts
, GLUSTER_OPT_IPV4
);
600 gsconf
->u
.inet
.has_ipv4
= true;
602 ptr
= qemu_opt_get(opts
, GLUSTER_OPT_IPV6
);
604 gsconf
->u
.inet
.has_ipv6
= true;
606 if (gsconf
->u
.inet
.has_to
) {
607 error_setg(&local_err
, "Parameter 'to' not supported");
610 if (gsconf
->u
.inet
.has_ipv4
|| gsconf
->u
.inet
.has_ipv6
) {
611 error_setg(&local_err
, "Parameters 'ipv4/ipv6' not supported");
616 /* create opts info from runtime_unix_opts list */
617 opts
= qemu_opts_create(&runtime_unix_opts
, NULL
, 0, &error_abort
);
618 qemu_opts_absorb_qdict(opts
, backing_options
, &local_err
);
623 ptr
= qemu_opt_get(opts
, GLUSTER_OPT_PATH
);
625 ptr
= qemu_opt_get(opts
, GLUSTER_OPT_SOCKET
);
626 } else if (qemu_opt_get(opts
, GLUSTER_OPT_SOCKET
)) {
627 error_setg(&local_err
,
628 "Conflicting parameters 'path' and 'socket'");
629 error_append_hint(&local_err
, GERR_INDEX_HINT
, i
);
633 error_setg(&local_err
, QERR_MISSING_PARAMETER
,
635 error_append_hint(&local_err
, GERR_INDEX_HINT
, i
);
638 gsconf
->u
.q_unix
.path
= g_strdup(ptr
);
642 if (gconf
->server
== NULL
) {
643 gconf
->server
= g_new0(SocketAddressList
, 1);
644 gconf
->server
->value
= gsconf
;
645 curr
= gconf
->server
;
647 curr
->next
= g_new0(SocketAddressList
, 1);
648 curr
->next
->value
= gsconf
;
653 qobject_unref(backing_options
);
654 backing_options
= NULL
;
662 error_propagate(errp
, local_err
);
663 qapi_free_SocketAddress(gsconf
);
666 qobject_unref(backing_options
);
671 /* Converts options given in @filename and the @options QDict into the QAPI
673 static int qemu_gluster_parse(BlockdevOptionsGluster
*gconf
,
674 const char *filename
,
675 QDict
*options
, Error
**errp
)
679 ret
= qemu_gluster_parse_uri(gconf
, filename
);
681 error_setg(errp
, "invalid URI %s", filename
);
682 error_append_hint(errp
, "Usage: file=gluster[+transport]://"
683 "[host[:port]]volume/path[?socket=...]"
685 "[,file.logfile=/path/filename.log]\n");
689 ret
= qemu_gluster_parse_json(gconf
, options
, errp
);
691 error_append_hint(errp
, "Usage: "
692 "-drive driver=qcow2,file.driver=gluster,"
693 "file.volume=testvol,file.path=/path/a.qcow2"
695 "[,file.logfile=/path/filename.log],"
696 "file.server.0.type=inet,"
697 "file.server.0.host=1.2.3.4,"
698 "file.server.0.port=24007,"
699 "file.server.1.transport=unix,"
700 "file.server.1.path=/var/run/glusterd.socket ..."
709 static struct glfs
*qemu_gluster_init(BlockdevOptionsGluster
*gconf
,
710 const char *filename
,
711 QDict
*options
, Error
**errp
)
715 ret
= qemu_gluster_parse(gconf
, filename
, options
, errp
);
721 return qemu_gluster_glfs_init(gconf
, errp
);
725 * AIO callback routine called from GlusterFS thread.
727 static void gluster_finish_aiocb(struct glfs_fd
*fd
, ssize_t ret
, void *arg
)
729 GlusterAIOCB
*acb
= (GlusterAIOCB
*)arg
;
731 if (!ret
|| ret
== acb
->size
) {
732 acb
->ret
= 0; /* Success */
733 } else if (ret
< 0) {
734 acb
->ret
= -errno
; /* Read/Write failed */
736 acb
->ret
= -EIO
; /* Partial read/write - fail it */
739 aio_co_schedule(acb
->aio_context
, acb
->coroutine
);
742 static void qemu_gluster_parse_flags(int bdrv_flags
, int *open_flags
)
744 assert(open_flags
!= NULL
);
746 *open_flags
|= O_BINARY
;
748 if (bdrv_flags
& BDRV_O_RDWR
) {
749 *open_flags
|= O_RDWR
;
751 *open_flags
|= O_RDONLY
;
754 if ((bdrv_flags
& BDRV_O_NOCACHE
)) {
755 *open_flags
|= O_DIRECT
;
760 * Do SEEK_DATA/HOLE to detect if it is functional. Older broken versions of
761 * gfapi incorrectly return the current offset when SEEK_DATA/HOLE is used.
762 * - Corrected versions return -1 and set errno to EINVAL.
763 * - Versions that support SEEK_DATA/HOLE correctly, will return -1 and set
764 * errno to ENXIO when SEEK_DATA is called with a position of EOF.
766 static bool qemu_gluster_test_seek(struct glfs_fd
*fd
)
770 #if defined SEEK_HOLE && defined SEEK_DATA
773 eof
= glfs_lseek(fd
, 0, SEEK_END
);
775 /* this should never occur */
779 /* this should always fail with ENXIO if SEEK_DATA is supported */
780 ret
= glfs_lseek(fd
, eof
, SEEK_DATA
);
783 return (ret
< 0) && (errno
== ENXIO
);
786 static int qemu_gluster_open(BlockDriverState
*bs
, QDict
*options
,
787 int bdrv_flags
, Error
**errp
)
789 BDRVGlusterState
*s
= bs
->opaque
;
792 BlockdevOptionsGluster
*gconf
= NULL
;
794 Error
*local_err
= NULL
;
795 const char *filename
, *logfile
;
797 opts
= qemu_opts_create(&runtime_opts
, NULL
, 0, &error_abort
);
798 qemu_opts_absorb_qdict(opts
, options
, &local_err
);
800 error_propagate(errp
, local_err
);
805 filename
= qemu_opt_get(opts
, GLUSTER_OPT_FILENAME
);
807 s
->debug
= qemu_opt_get_number(opts
, GLUSTER_OPT_DEBUG
,
808 GLUSTER_DEBUG_DEFAULT
);
811 } else if (s
->debug
> GLUSTER_DEBUG_MAX
) {
812 s
->debug
= GLUSTER_DEBUG_MAX
;
815 gconf
= g_new0(BlockdevOptionsGluster
, 1);
816 gconf
->debug
= s
->debug
;
817 gconf
->has_debug
= true;
819 logfile
= qemu_opt_get(opts
, GLUSTER_OPT_LOGFILE
);
820 s
->logfile
= g_strdup(logfile
? logfile
: GLUSTER_LOGFILE_DEFAULT
);
822 gconf
->logfile
= g_strdup(s
->logfile
);
823 gconf
->has_logfile
= true;
825 s
->glfs
= qemu_gluster_init(gconf
, filename
, options
, errp
);
831 #ifdef CONFIG_GLUSTERFS_XLATOR_OPT
832 /* Without this, if fsync fails for a recoverable reason (for instance,
833 * ENOSPC), gluster will dump its cache, preventing retries. This means
834 * almost certain data loss. Not all gluster versions support the
835 * 'resync-failed-syncs-after-fsync' key value, but there is no way to
836 * discover during runtime if it is supported (this api returns success for
837 * unknown key/value pairs) */
838 ret
= glfs_set_xlator_option(s
->glfs
, "*-write-behind",
839 "resync-failed-syncs-after-fsync",
842 error_setg_errno(errp
, errno
, "Unable to set xlator key/value pair");
848 qemu_gluster_parse_flags(bdrv_flags
, &open_flags
);
850 s
->fd
= glfs_open(s
->glfs
, gconf
->path
, open_flags
);
855 s
->supports_seek_data
= qemu_gluster_test_seek(s
->fd
);
859 qapi_free_BlockdevOptionsGluster(gconf
);
868 glfs_clear_preopened(s
->glfs
);
873 static int qemu_gluster_reopen_prepare(BDRVReopenState
*state
,
874 BlockReopenQueue
*queue
, Error
**errp
)
878 BDRVGlusterReopenState
*reop_s
;
879 BlockdevOptionsGluster
*gconf
;
882 assert(state
!= NULL
);
883 assert(state
->bs
!= NULL
);
885 s
= state
->bs
->opaque
;
887 state
->opaque
= g_new0(BDRVGlusterReopenState
, 1);
888 reop_s
= state
->opaque
;
890 qemu_gluster_parse_flags(state
->flags
, &open_flags
);
892 gconf
= g_new0(BlockdevOptionsGluster
, 1);
893 gconf
->debug
= s
->debug
;
894 gconf
->has_debug
= true;
895 gconf
->logfile
= g_strdup(s
->logfile
);
896 gconf
->has_logfile
= true;
897 reop_s
->glfs
= qemu_gluster_init(gconf
, state
->bs
->filename
, NULL
, errp
);
898 if (reop_s
->glfs
== NULL
) {
903 #ifdef CONFIG_GLUSTERFS_XLATOR_OPT
904 ret
= glfs_set_xlator_option(reop_s
->glfs
, "*-write-behind",
905 "resync-failed-syncs-after-fsync", "on");
907 error_setg_errno(errp
, errno
, "Unable to set xlator key/value pair");
913 reop_s
->fd
= glfs_open(reop_s
->glfs
, gconf
->path
, open_flags
);
914 if (reop_s
->fd
== NULL
) {
915 /* reops->glfs will be cleaned up in _abort */
921 /* state->opaque will be freed in either the _abort or _commit */
922 qapi_free_BlockdevOptionsGluster(gconf
);
926 static void qemu_gluster_reopen_commit(BDRVReopenState
*state
)
928 BDRVGlusterReopenState
*reop_s
= state
->opaque
;
929 BDRVGlusterState
*s
= state
->bs
->opaque
;
937 glfs_clear_preopened(s
->glfs
);
939 /* use the newly opened image / connection */
941 s
->glfs
= reop_s
->glfs
;
943 g_free(state
->opaque
);
944 state
->opaque
= NULL
;
950 static void qemu_gluster_reopen_abort(BDRVReopenState
*state
)
952 BDRVGlusterReopenState
*reop_s
= state
->opaque
;
954 if (reop_s
== NULL
) {
959 glfs_close(reop_s
->fd
);
962 glfs_clear_preopened(reop_s
->glfs
);
964 g_free(state
->opaque
);
965 state
->opaque
= NULL
;
970 #ifdef CONFIG_GLUSTERFS_ZEROFILL
971 static coroutine_fn
int qemu_gluster_co_pwrite_zeroes(BlockDriverState
*bs
,
974 BdrvRequestFlags flags
)
978 BDRVGlusterState
*s
= bs
->opaque
;
982 acb
.coroutine
= qemu_coroutine_self();
983 acb
.aio_context
= bdrv_get_aio_context(bs
);
985 ret
= glfs_zerofill_async(s
->fd
, offset
, size
, gluster_finish_aiocb
, &acb
);
990 qemu_coroutine_yield();
995 static int qemu_gluster_do_truncate(struct glfs_fd
*fd
, int64_t offset
,
996 PreallocMode prealloc
, Error
**errp
)
998 int64_t current_length
;
1000 current_length
= glfs_lseek(fd
, 0, SEEK_END
);
1001 if (current_length
< 0) {
1002 error_setg_errno(errp
, errno
, "Failed to determine current size");
1006 if (current_length
> offset
&& prealloc
!= PREALLOC_MODE_OFF
) {
1007 error_setg(errp
, "Cannot use preallocation for shrinking files");
1011 if (current_length
== offset
) {
1016 #ifdef CONFIG_GLUSTERFS_FALLOCATE
1017 case PREALLOC_MODE_FALLOC
:
1018 if (glfs_fallocate(fd
, 0, current_length
, offset
- current_length
)) {
1019 error_setg_errno(errp
, errno
, "Could not preallocate data");
1023 #endif /* CONFIG_GLUSTERFS_FALLOCATE */
1024 #ifdef CONFIG_GLUSTERFS_ZEROFILL
1025 case PREALLOC_MODE_FULL
:
1026 if (glfs_ftruncate(fd
, offset
)) {
1027 error_setg_errno(errp
, errno
, "Could not resize file");
1030 if (glfs_zerofill(fd
, current_length
, offset
- current_length
)) {
1031 error_setg_errno(errp
, errno
, "Could not zerofill the new area");
1035 #endif /* CONFIG_GLUSTERFS_ZEROFILL */
1036 case PREALLOC_MODE_OFF
:
1037 if (glfs_ftruncate(fd
, offset
)) {
1038 error_setg_errno(errp
, errno
, "Could not resize file");
1043 error_setg(errp
, "Unsupported preallocation mode: %s",
1044 PreallocMode_str(prealloc
));
1051 static int qemu_gluster_co_create(BlockdevCreateOptions
*options
,
1054 BlockdevCreateOptionsGluster
*opts
= &options
->u
.gluster
;
1056 struct glfs_fd
*fd
= NULL
;
1059 assert(options
->driver
== BLOCKDEV_DRIVER_GLUSTER
);
1061 glfs
= qemu_gluster_glfs_init(opts
->location
, errp
);
1067 fd
= glfs_creat(glfs
, opts
->location
->path
,
1068 O_WRONLY
| O_CREAT
| O_TRUNC
| O_BINARY
, S_IRUSR
| S_IWUSR
);
1074 ret
= qemu_gluster_do_truncate(fd
, opts
->size
, opts
->preallocation
, errp
);
1078 if (glfs_close(fd
) != 0 && ret
== 0) {
1082 glfs_clear_preopened(glfs
);
1086 static int coroutine_fn
qemu_gluster_co_create_opts(const char *filename
,
1090 BlockdevCreateOptions
*options
;
1091 BlockdevCreateOptionsGluster
*gopts
;
1092 BlockdevOptionsGluster
*gconf
;
1094 Error
*local_err
= NULL
;
1097 options
= g_new0(BlockdevCreateOptions
, 1);
1098 options
->driver
= BLOCKDEV_DRIVER_GLUSTER
;
1099 gopts
= &options
->u
.gluster
;
1101 gconf
= g_new0(BlockdevOptionsGluster
, 1);
1102 gopts
->location
= gconf
;
1104 gopts
->size
= ROUND_UP(qemu_opt_get_size_del(opts
, BLOCK_OPT_SIZE
, 0),
1107 tmp
= qemu_opt_get_del(opts
, BLOCK_OPT_PREALLOC
);
1108 gopts
->preallocation
= qapi_enum_parse(&PreallocMode_lookup
, tmp
,
1109 PREALLOC_MODE_OFF
, &local_err
);
1112 error_propagate(errp
, local_err
);
1117 gconf
->debug
= qemu_opt_get_number_del(opts
, GLUSTER_OPT_DEBUG
,
1118 GLUSTER_DEBUG_DEFAULT
);
1119 if (gconf
->debug
< 0) {
1121 } else if (gconf
->debug
> GLUSTER_DEBUG_MAX
) {
1122 gconf
->debug
= GLUSTER_DEBUG_MAX
;
1124 gconf
->has_debug
= true;
1126 gconf
->logfile
= qemu_opt_get_del(opts
, GLUSTER_OPT_LOGFILE
);
1127 if (!gconf
->logfile
) {
1128 gconf
->logfile
= g_strdup(GLUSTER_LOGFILE_DEFAULT
);
1130 gconf
->has_logfile
= true;
1132 ret
= qemu_gluster_parse(gconf
, filename
, NULL
, errp
);
1137 ret
= qemu_gluster_co_create(options
, errp
);
1144 qapi_free_BlockdevCreateOptions(options
);
1148 static coroutine_fn
int qemu_gluster_co_rw(BlockDriverState
*bs
,
1149 int64_t sector_num
, int nb_sectors
,
1150 QEMUIOVector
*qiov
, int write
)
1154 BDRVGlusterState
*s
= bs
->opaque
;
1155 size_t size
= nb_sectors
* BDRV_SECTOR_SIZE
;
1156 off_t offset
= sector_num
* BDRV_SECTOR_SIZE
;
1160 acb
.coroutine
= qemu_coroutine_self();
1161 acb
.aio_context
= bdrv_get_aio_context(bs
);
1164 ret
= glfs_pwritev_async(s
->fd
, qiov
->iov
, qiov
->niov
, offset
, 0,
1165 gluster_finish_aiocb
, &acb
);
1167 ret
= glfs_preadv_async(s
->fd
, qiov
->iov
, qiov
->niov
, offset
, 0,
1168 gluster_finish_aiocb
, &acb
);
1175 qemu_coroutine_yield();
1179 static int qemu_gluster_truncate(BlockDriverState
*bs
, int64_t offset
,
1180 PreallocMode prealloc
, Error
**errp
)
1182 BDRVGlusterState
*s
= bs
->opaque
;
1183 return qemu_gluster_do_truncate(s
->fd
, offset
, prealloc
, errp
);
1186 static coroutine_fn
int qemu_gluster_co_readv(BlockDriverState
*bs
,
1191 return qemu_gluster_co_rw(bs
, sector_num
, nb_sectors
, qiov
, 0);
1194 static coroutine_fn
int qemu_gluster_co_writev(BlockDriverState
*bs
,
1201 return qemu_gluster_co_rw(bs
, sector_num
, nb_sectors
, qiov
, 1);
1204 static void qemu_gluster_close(BlockDriverState
*bs
)
1206 BDRVGlusterState
*s
= bs
->opaque
;
1213 glfs_clear_preopened(s
->glfs
);
1216 static coroutine_fn
int qemu_gluster_co_flush_to_disk(BlockDriverState
*bs
)
1220 BDRVGlusterState
*s
= bs
->opaque
;
1224 acb
.coroutine
= qemu_coroutine_self();
1225 acb
.aio_context
= bdrv_get_aio_context(bs
);
1227 ret
= glfs_fsync_async(s
->fd
, gluster_finish_aiocb
, &acb
);
1233 qemu_coroutine_yield();
1242 /* Some versions of Gluster (3.5.6 -> 3.5.8?) will not retain its cache
1243 * after a fsync failure, so we have no way of allowing the guest to safely
1244 * continue. Gluster versions prior to 3.5.6 don't retain the cache
1245 * either, but will invalidate the fd on error, so this is again our only
1248 * The 'resync-failed-syncs-after-fsync' xlator option for the
1249 * write-behind cache will cause later gluster versions to retain its
1250 * cache after error, so long as the fd remains open. However, we
1251 * currently have no way of knowing if this option is supported.
1253 * TODO: Once gluster provides a way for us to determine if the option
1254 * is supported, bypass the closure and setting drv to NULL. */
1255 qemu_gluster_close(bs
);
1260 #ifdef CONFIG_GLUSTERFS_DISCARD
1261 static coroutine_fn
int qemu_gluster_co_pdiscard(BlockDriverState
*bs
,
1262 int64_t offset
, int size
)
1266 BDRVGlusterState
*s
= bs
->opaque
;
1270 acb
.coroutine
= qemu_coroutine_self();
1271 acb
.aio_context
= bdrv_get_aio_context(bs
);
1273 ret
= glfs_discard_async(s
->fd
, offset
, size
, gluster_finish_aiocb
, &acb
);
1278 qemu_coroutine_yield();
1283 static int64_t qemu_gluster_getlength(BlockDriverState
*bs
)
1285 BDRVGlusterState
*s
= bs
->opaque
;
1288 ret
= glfs_lseek(s
->fd
, 0, SEEK_END
);
1296 static int64_t qemu_gluster_allocated_file_size(BlockDriverState
*bs
)
1298 BDRVGlusterState
*s
= bs
->opaque
;
1302 ret
= glfs_fstat(s
->fd
, &st
);
1306 return st
.st_blocks
* 512;
1310 static int qemu_gluster_has_zero_init(BlockDriverState
*bs
)
1312 /* GlusterFS volume could be backed by a block device */
1317 * Find allocation range in @bs around offset @start.
1318 * May change underlying file descriptor's file offset.
1319 * If @start is not in a hole, store @start in @data, and the
1320 * beginning of the next hole in @hole, and return 0.
1321 * If @start is in a non-trailing hole, store @start in @hole and the
1322 * beginning of the next non-hole in @data, and return 0.
1323 * If @start is in a trailing hole or beyond EOF, return -ENXIO.
1324 * If we can't find out, return a negative errno other than -ENXIO.
1326 * (Shamefully copied from file-posix.c, only miniscule adaptions.)
1328 static int find_allocation(BlockDriverState
*bs
, off_t start
,
1329 off_t
*data
, off_t
*hole
)
1331 BDRVGlusterState
*s
= bs
->opaque
;
1333 if (!s
->supports_seek_data
) {
1337 #if defined SEEK_HOLE && defined SEEK_DATA
1342 * D1. offs == start: start is in data
1343 * D2. offs > start: start is in a hole, next data at offs
1344 * D3. offs < 0, errno = ENXIO: either start is in a trailing hole
1345 * or start is beyond EOF
1346 * If the latter happens, the file has been truncated behind
1347 * our back since we opened it. All bets are off then.
1348 * Treating like a trailing hole is simplest.
1349 * D4. offs < 0, errno != ENXIO: we learned nothing
1351 offs
= glfs_lseek(s
->fd
, start
, SEEK_DATA
);
1353 return -errno
; /* D3 or D4 */
1357 /* This is not a valid return by lseek(). We are safe to just return
1358 * -EIO in this case, and we'll treat it like D4. Unfortunately some
1359 * versions of gluster server will return offs < start, so an assert
1360 * here will unnecessarily abort QEMU. */
1365 /* D2: in hole, next data at offs */
1371 /* D1: in data, end not yet known */
1375 * H1. offs == start: start is in a hole
1376 * If this happens here, a hole has been dug behind our back
1377 * since the previous lseek().
1378 * H2. offs > start: either start is in data, next hole at offs,
1379 * or start is in trailing hole, EOF at offs
1380 * Linux treats trailing holes like any other hole: offs ==
1381 * start. Solaris seeks to EOF instead: offs > start (blech).
1382 * If that happens here, a hole has been dug behind our back
1383 * since the previous lseek().
1384 * H3. offs < 0, errno = ENXIO: start is beyond EOF
1385 * If this happens, the file has been truncated behind our
1386 * back since we opened it. Treat it like a trailing hole.
1387 * H4. offs < 0, errno != ENXIO: we learned nothing
1388 * Pretend we know nothing at all, i.e. "forget" about D1.
1390 offs
= glfs_lseek(s
->fd
, start
, SEEK_HOLE
);
1392 return -errno
; /* D1 and (H3 or H4) */
1396 /* This is not a valid return by lseek(). We are safe to just return
1397 * -EIO in this case, and we'll treat it like H4. Unfortunately some
1398 * versions of gluster server will return offs < start, so an assert
1399 * here will unnecessarily abort QEMU. */
1405 * D1 and H2: either in data, next hole at offs, or it was in
1406 * data but is now in a trailing hole. In the latter case,
1407 * all bets are off. Treating it as if it there was data all
1408 * the way to EOF is safe, so simply do that.
1424 * Returns the allocation status of the specified offset.
1426 * The block layer guarantees 'offset' and 'bytes' are within bounds.
1428 * 'pnum' is set to the number of bytes (including and immediately following
1429 * the specified offset) that are known to be in the same
1430 * allocated/unallocated state.
1432 * 'bytes' is the max value 'pnum' should be set to.
1434 * (Based on raw_co_block_status() from file-posix.c.)
1436 static int coroutine_fn
qemu_gluster_co_block_status(BlockDriverState
*bs
,
1442 BlockDriverState
**file
)
1444 BDRVGlusterState
*s
= bs
->opaque
;
1445 off_t data
= 0, hole
= 0;
1456 return BDRV_BLOCK_DATA
| BDRV_BLOCK_OFFSET_VALID
;
1459 ret
= find_allocation(bs
, offset
, &data
, &hole
);
1460 if (ret
== -ENXIO
) {
1463 ret
= BDRV_BLOCK_ZERO
;
1464 } else if (ret
< 0) {
1465 /* No info available, so pretend there are no holes */
1467 ret
= BDRV_BLOCK_DATA
;
1468 } else if (data
== offset
) {
1469 /* On a data extent, compute bytes to the end of the extent,
1470 * possibly including a partial sector at EOF. */
1471 *pnum
= MIN(bytes
, hole
- offset
);
1472 ret
= BDRV_BLOCK_DATA
;
1474 /* On a hole, compute bytes to the beginning of the next extent. */
1475 assert(hole
== offset
);
1476 *pnum
= MIN(bytes
, data
- offset
);
1477 ret
= BDRV_BLOCK_ZERO
;
1483 return ret
| BDRV_BLOCK_OFFSET_VALID
;
1487 static BlockDriver bdrv_gluster
= {
1488 .format_name
= "gluster",
1489 .protocol_name
= "gluster",
1490 .instance_size
= sizeof(BDRVGlusterState
),
1491 .bdrv_needs_filename
= false,
1492 .bdrv_file_open
= qemu_gluster_open
,
1493 .bdrv_reopen_prepare
= qemu_gluster_reopen_prepare
,
1494 .bdrv_reopen_commit
= qemu_gluster_reopen_commit
,
1495 .bdrv_reopen_abort
= qemu_gluster_reopen_abort
,
1496 .bdrv_close
= qemu_gluster_close
,
1497 .bdrv_co_create
= qemu_gluster_co_create
,
1498 .bdrv_co_create_opts
= qemu_gluster_co_create_opts
,
1499 .bdrv_getlength
= qemu_gluster_getlength
,
1500 .bdrv_get_allocated_file_size
= qemu_gluster_allocated_file_size
,
1501 .bdrv_truncate
= qemu_gluster_truncate
,
1502 .bdrv_co_readv
= qemu_gluster_co_readv
,
1503 .bdrv_co_writev
= qemu_gluster_co_writev
,
1504 .bdrv_co_flush_to_disk
= qemu_gluster_co_flush_to_disk
,
1505 .bdrv_has_zero_init
= qemu_gluster_has_zero_init
,
1506 #ifdef CONFIG_GLUSTERFS_DISCARD
1507 .bdrv_co_pdiscard
= qemu_gluster_co_pdiscard
,
1509 #ifdef CONFIG_GLUSTERFS_ZEROFILL
1510 .bdrv_co_pwrite_zeroes
= qemu_gluster_co_pwrite_zeroes
,
1512 .bdrv_co_block_status
= qemu_gluster_co_block_status
,
1513 .create_opts
= &qemu_gluster_create_opts
,
1516 static BlockDriver bdrv_gluster_tcp
= {
1517 .format_name
= "gluster",
1518 .protocol_name
= "gluster+tcp",
1519 .instance_size
= sizeof(BDRVGlusterState
),
1520 .bdrv_needs_filename
= false,
1521 .bdrv_file_open
= qemu_gluster_open
,
1522 .bdrv_reopen_prepare
= qemu_gluster_reopen_prepare
,
1523 .bdrv_reopen_commit
= qemu_gluster_reopen_commit
,
1524 .bdrv_reopen_abort
= qemu_gluster_reopen_abort
,
1525 .bdrv_close
= qemu_gluster_close
,
1526 .bdrv_co_create
= qemu_gluster_co_create
,
1527 .bdrv_co_create_opts
= qemu_gluster_co_create_opts
,
1528 .bdrv_getlength
= qemu_gluster_getlength
,
1529 .bdrv_get_allocated_file_size
= qemu_gluster_allocated_file_size
,
1530 .bdrv_truncate
= qemu_gluster_truncate
,
1531 .bdrv_co_readv
= qemu_gluster_co_readv
,
1532 .bdrv_co_writev
= qemu_gluster_co_writev
,
1533 .bdrv_co_flush_to_disk
= qemu_gluster_co_flush_to_disk
,
1534 .bdrv_has_zero_init
= qemu_gluster_has_zero_init
,
1535 #ifdef CONFIG_GLUSTERFS_DISCARD
1536 .bdrv_co_pdiscard
= qemu_gluster_co_pdiscard
,
1538 #ifdef CONFIG_GLUSTERFS_ZEROFILL
1539 .bdrv_co_pwrite_zeroes
= qemu_gluster_co_pwrite_zeroes
,
1541 .bdrv_co_block_status
= qemu_gluster_co_block_status
,
1542 .create_opts
= &qemu_gluster_create_opts
,
1545 static BlockDriver bdrv_gluster_unix
= {
1546 .format_name
= "gluster",
1547 .protocol_name
= "gluster+unix",
1548 .instance_size
= sizeof(BDRVGlusterState
),
1549 .bdrv_needs_filename
= true,
1550 .bdrv_file_open
= qemu_gluster_open
,
1551 .bdrv_reopen_prepare
= qemu_gluster_reopen_prepare
,
1552 .bdrv_reopen_commit
= qemu_gluster_reopen_commit
,
1553 .bdrv_reopen_abort
= qemu_gluster_reopen_abort
,
1554 .bdrv_close
= qemu_gluster_close
,
1555 .bdrv_co_create
= qemu_gluster_co_create
,
1556 .bdrv_co_create_opts
= qemu_gluster_co_create_opts
,
1557 .bdrv_getlength
= qemu_gluster_getlength
,
1558 .bdrv_get_allocated_file_size
= qemu_gluster_allocated_file_size
,
1559 .bdrv_truncate
= qemu_gluster_truncate
,
1560 .bdrv_co_readv
= qemu_gluster_co_readv
,
1561 .bdrv_co_writev
= qemu_gluster_co_writev
,
1562 .bdrv_co_flush_to_disk
= qemu_gluster_co_flush_to_disk
,
1563 .bdrv_has_zero_init
= qemu_gluster_has_zero_init
,
1564 #ifdef CONFIG_GLUSTERFS_DISCARD
1565 .bdrv_co_pdiscard
= qemu_gluster_co_pdiscard
,
1567 #ifdef CONFIG_GLUSTERFS_ZEROFILL
1568 .bdrv_co_pwrite_zeroes
= qemu_gluster_co_pwrite_zeroes
,
1570 .bdrv_co_block_status
= qemu_gluster_co_block_status
,
1571 .create_opts
= &qemu_gluster_create_opts
,
1574 /* rdma is deprecated (actually never supported for volfile fetch).
1575 * Let's maintain it for the protocol compatibility, to make sure things
1576 * won't break immediately. For now, gluster+rdma will fall back to gluster+tcp
1577 * protocol with a warning.
1578 * TODO: remove gluster+rdma interface support
1580 static BlockDriver bdrv_gluster_rdma
= {
1581 .format_name
= "gluster",
1582 .protocol_name
= "gluster+rdma",
1583 .instance_size
= sizeof(BDRVGlusterState
),
1584 .bdrv_needs_filename
= true,
1585 .bdrv_file_open
= qemu_gluster_open
,
1586 .bdrv_reopen_prepare
= qemu_gluster_reopen_prepare
,
1587 .bdrv_reopen_commit
= qemu_gluster_reopen_commit
,
1588 .bdrv_reopen_abort
= qemu_gluster_reopen_abort
,
1589 .bdrv_close
= qemu_gluster_close
,
1590 .bdrv_co_create
= qemu_gluster_co_create
,
1591 .bdrv_co_create_opts
= qemu_gluster_co_create_opts
,
1592 .bdrv_getlength
= qemu_gluster_getlength
,
1593 .bdrv_get_allocated_file_size
= qemu_gluster_allocated_file_size
,
1594 .bdrv_truncate
= qemu_gluster_truncate
,
1595 .bdrv_co_readv
= qemu_gluster_co_readv
,
1596 .bdrv_co_writev
= qemu_gluster_co_writev
,
1597 .bdrv_co_flush_to_disk
= qemu_gluster_co_flush_to_disk
,
1598 .bdrv_has_zero_init
= qemu_gluster_has_zero_init
,
1599 #ifdef CONFIG_GLUSTERFS_DISCARD
1600 .bdrv_co_pdiscard
= qemu_gluster_co_pdiscard
,
1602 #ifdef CONFIG_GLUSTERFS_ZEROFILL
1603 .bdrv_co_pwrite_zeroes
= qemu_gluster_co_pwrite_zeroes
,
1605 .bdrv_co_block_status
= qemu_gluster_co_block_status
,
1606 .create_opts
= &qemu_gluster_create_opts
,
1609 static void bdrv_gluster_init(void)
1611 bdrv_register(&bdrv_gluster_rdma
);
1612 bdrv_register(&bdrv_gluster_unix
);
1613 bdrv_register(&bdrv_gluster_tcp
);
1614 bdrv_register(&bdrv_gluster
);
1617 block_init(bdrv_gluster_init
);