[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/14] block: add gluster ifdef guard checks for SEEK
From: |
Jeff Cody |
Subject: |
[Qemu-devel] [PULL 03/14] block: add gluster ifdef guard checks for SEEK_DATA/SEEK_HOLE support |
Date: |
Mon, 31 Oct 2016 15:22:50 -0400 |
Add checks to see if the system compiling QEMU has support for
SEEK_HOLE/SEEK_DATA. If the system does not, we will flag that seek
data is unsupported in gluster.
Note: this is not a check on whether the gluster server itself supports
SEEK_DATA (that is already done during runtime), but rather if the
compilation environment supports SEEK_DATA.
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Jeff Cody <address@hidden>
Tested-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Jeff Cody <address@hidden>
---
block/gluster.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/block/gluster.c b/block/gluster.c
index af76d7d..1735d12 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -668,7 +668,10 @@ static void qemu_gluster_parse_flags(int bdrv_flags, int
*open_flags)
*/
static bool qemu_gluster_test_seek(struct glfs_fd *fd)
{
- off_t ret, eof;
+ off_t ret = 0;
+
+#if defined SEEK_HOLE && defined SEEK_DATA
+ off_t eof;
eof = glfs_lseek(fd, 0, SEEK_END);
if (eof < 0) {
@@ -678,6 +681,8 @@ static bool qemu_gluster_test_seek(struct glfs_fd *fd)
/* this should always fail with ENXIO if SEEK_DATA is supported */
ret = glfs_lseek(fd, eof, SEEK_DATA);
+#endif
+
return (ret < 0) && (errno == ENXIO);
}
@@ -1178,12 +1183,14 @@ static int find_allocation(BlockDriverState *bs, off_t
start,
off_t *data, off_t *hole)
{
BDRVGlusterState *s = bs->opaque;
- off_t offs;
if (!s->supports_seek_data) {
- return -ENOTSUP;
+ goto exit;
}
+#if defined SEEK_HOLE && defined SEEK_DATA
+ off_t offs;
+
/*
* SEEK_DATA cases:
* D1. offs == start: start is in data
@@ -1247,6 +1254,10 @@ static int find_allocation(BlockDriverState *bs, off_t
start,
/* D1 and H1 */
return -EBUSY;
+#endif
+
+exit:
+ return -ENOTSUP;
}
/*
--
2.7.4
- [Qemu-devel] [PULL 00/14] Block patches for 2.8, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 01/14] qapi: add release designator to gluster logfile option, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 02/14] rbd: make the code more readable, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 03/14] block: add gluster ifdef guard checks for SEEK_DATA/SEEK_HOLE support,
Jeff Cody <=
- [Qemu-devel] [PULL 04/14] block/gluster: memory usage: use one glfs instance per volume, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 07/14] block/gluster: fix port type in the QAPI options list, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 06/14] block/gluster: improve defense over string to int conversion, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 05/14] block: Turn on "unmap" in active commit, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 08/14] blockjobs: hide internal jobs from management API, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 09/14] blockjobs: Allow creating internal jobs, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 10/14] Replication/Blockjobs: Create replication jobs as internal, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 12/14] Blockjobs: Internalize user_pause logic, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 11/14] blockjob: centralize QMP event emissions, Jeff Cody, 2016/10/31
- [Qemu-devel] [PULL 14/14] blockjobs: fix documentation, Jeff Cody, 2016/10/31