qcow2: Return the original error code in qcow2_co_pwrite_zeroes()
PATCH 1/1 qcow2: Return the original error code in qcow2_co_pwrite_zeroes()
This function checks the current status of a (sub)cluster in order to see if an unaligned 'write zeroes' request can be done efficiently by simply updating the L2 metadata and without having to write actual zeroes to disk.
If the situation does not allow using the fast path then the function returns -ENOTSUP and the caller falls back to writing zeroes.
If can happen however that the aforementioned check returns an actual error code so in this case we should pass it to the caller.
--- block/qcow2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/qcow2.c +1 -1
@@ -3916,7 +3916,7 @@ static coroutine_fn int qcow2_co_pwrite_zeroes(BlockDriverState *bs, type != QCOW2_SUBCLUSTER_ZERO_PLAIN && type != QCOW2_SUBCLUSTER_ZERO_ALLOC)) {qemu_co_mutex_unlock (&s->lock); -return -ENOTSUP ; +return ret <0 ? ret : -ENOTSUP ; } }else {qemu_co_mutex_lock (&s->lock);
Signature · 1 line
2.20.1
Quoted 8 lines · Alberto Garcia
This function checks the current status of a (sub)cluster in order to see if an unaligned 'write zeroes' request can be done efficiently by simply updating the L2 metadata and without having to write actual zeroes to disk.
If the situation does not allow using the fast path then the function returns
-ENOTSUPand the caller falls back to writing zeroes.
Quoted 7 lines
If can happen however that the aforementioned check returns an actual error code so in this case we should pass it to the caller.
Signed-off-by Alberto Garcia <[email protected]>--- block/qcow2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 22 lines · Alberto Garcia
This function checks the current status of a (sub)cluster in order to see if an unaligned 'write zeroes' request can be done efficiently by simply updating the L2 metadata and without having to write actual zeroes to disk.
If the situation does not allow using the fast path then the function returns
-ENOTSUPand the caller falls back to writing zeroes.If can happen however that the aforementioned check returns an actual error code so in this case we should pass it to the caller.
Signed-off-by Alberto Garcia <[email protected]>--- block/qcow2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)block/qcow2.c +0
-0
block/qcow2.c static coroutine_fn int qcow2_co_pwrite_zeroes(BlockDriverState *bs, · line 3922
Quoted 8 lines
block/qcow2.c +1
-1@@ -3916,7 +3916,7 @@ static coroutine_fn int qcow2_co_pwrite_zeroes(BlockDriverState *bs, type != QCOW2_SUBCLUSTER_ZERO_PLAIN && type != QCOW2_SUBCLUSTER_ZERO_ALLOC)) {qemu_co_mutex_unlock (&s->lock); -return -ENOTSUP ; +return ret <0 ? ret : -ENOTSUP ; } }else {qemu_co_mutex_lock (&s->lock);
Am 09.09.2020 um 14:37 hat Alberto Garcia geschrieben:
Quoted 5 lines
This function checks the current status of a (sub)cluster in order to see if an unaligned 'write zeroes' request can be done efficiently by simply updating the L2 metadata and without having to write actual zeroes to disk.
Quoted 7 lines
If the situation does not allow using the fast path then the function returns
-ENOTSUPand the caller falls back to writing zeroes.If can happen however that the aforementioned check returns an actual error code so in this case we should pass it to the caller.
Signed-off-by Alberto Garcia <[email protected]>
Max Reitz
AppliedQuoted 8 lines · Alberto Garcia
This function checks the current status of a (sub)cluster in order to see if an unaligned 'write zeroes' request can be done efficiently by simply updating the L2 metadata and without having to write actual zeroes to disk.
If the situation does not allow using the fast path then the function returns
-ENOTSUPand the caller falls back to writing zeroes.
Quoted 7 lines
If can happen however that the aforementioned check returns an actual error code so in this case we should pass it to the caller.
Signed-off-by Alberto Garcia <[email protected]>--- block/qcow2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, applied to my block branch: