[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/48] block: handle ENOTSUP from discard in generic
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 08/48] block: handle ENOTSUP from discard in generic code |
Date: |
Fri, 6 Dec 2013 17:36:07 +0100 |
From: Paolo Bonzini <address@hidden>
Similar to write_zeroes, let the generic code receive a ENOTSUP for
discard operations. Since bdrv_discard has advisory semantics,
we can just swallow the error.
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Peter Lieven <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block.c | 2 +-
block/raw-posix.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/block.c b/block.c
index c491edf..9818052 100644
--- a/block.c
+++ b/block.c
@@ -4376,7 +4376,7 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs,
int64_t sector_num,
ret = co.ret;
}
}
- if (ret) {
+ if (ret && ret != -ENOTSUP) {
return ret;
}
diff --git a/block/raw-posix.c b/block/raw-posix.c
index f836c8e..cfa3162 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -323,10 +323,10 @@ static int raw_open_common(BlockDriverState *bs, QDict
*options,
}
#endif
- s->has_discard = 1;
+ s->has_discard = true;
#ifdef CONFIG_XFS
if (platform_test_xfs_fd(s->fd)) {
- s->is_xfs = 1;
+ s->is_xfs = true;
}
#endif
@@ -698,8 +698,8 @@ static ssize_t handle_aiocb_discard(RawPosixAIOData *aiocb)
int ret = -EOPNOTSUPP;
BDRVRawState *s = aiocb->bs->opaque;
- if (s->has_discard == 0) {
- return 0;
+ if (!s->has_discard) {
+ return -ENOTSUP;
}
if (aiocb->aio_type & QEMU_AIO_BLKDEV) {
@@ -734,8 +734,8 @@ static ssize_t handle_aiocb_discard(RawPosixAIOData *aiocb)
if (ret == -ENODEV || ret == -ENOSYS || ret == -EOPNOTSUPP ||
ret == -ENOTTY) {
- s->has_discard = 0;
- ret = 0;
+ s->has_discard = false;
+ ret = -ENOTSUP;
}
return ret;
}
--
1.8.4.2
- [Qemu-devel] [PULL 00/48] Block patches, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 04/48] block: generalize BlockLimits handling to cover bdrv_aio_discard too, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 02/48] coroutine: remove unused CoQueue AioContext, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 03/48] vmdk: Fix creating big description file, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 01/48] coroutine: remove qemu_co_queue_wait_insert_head, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 05/48] block: add flags to BlockRequest, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 06/48] block: add flags argument to bdrv_co_write_zeroes tracepoint, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 07/48] block: add bdrv_aio_write_zeroes, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 08/48] block: handle ENOTSUP from discard in generic code,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 09/48] block: make bdrv_co_do_write_zeroes stricter in producing aligned requests, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 10/48] vpc, vhdx: add get_info, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 11/48] block drivers: add discard/write_zeroes properties to bdrv_get_info implementation, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 12/48] block drivers: expose requirement for write same alignment from formats, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 15/48] block/iscsi: check WRITE SAME support differently depending on MAY_UNMAP, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 13/48] block/iscsi: remove .bdrv_has_zero_init, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 14/48] block/iscsi: updated copyright, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 16/48] raw-posix: implement write_zeroes with MAY_UNMAP for files, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 17/48] raw-posix: implement write_zeroes with MAY_UNMAP for block devices, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 18/48] raw-posix: add support for write_zeroes on XFS and block devices, Stefan Hajnoczi, 2013/12/06