diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-11-22 13:39:47 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-12-03 15:26:49 +0100 |
commit | 7ce21016b69b512bf4777965a4292318f2bc7544 (patch) | |
tree | 5f79714c6bdb5996906ab6e8ebdbf262621e8d92 /block/raw-posix.c | |
parent | d5ef94d43da8c57a2d597efbdec3d9a54d97fdf7 (diff) | |
download | hqemu-7ce21016b69b512bf4777965a4292318f2bc7544.zip hqemu-7ce21016b69b512bf4777965a4292318f2bc7544.tar.gz |
block: handle ENOTSUP from discard in generic code
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 <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/raw-posix.c')
-rw-r--r-- | block/raw-posix.c | 12 |
1 files changed, 6 insertions, 6 deletions
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; } |