[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 20/25] block/nbd: Comment on discard/flush silently
From: |
Max Reitz |
Subject: |
[Qemu-block] [PATCH 20/25] block/nbd: Comment on discard/flush silently failing |
Date: |
Wed, 25 Feb 2015 13:08:33 -0500 |
If some operation cannot be performed by a block driver, it is normally
supposed to return an error. In these cases, however, it is fine to
pretend the operations were carried out successfully because if the NBD
block driver would not implement discard or flush in the first place,
this is exactly what the block layer would do.
Because this may not be obvious, add a comment for it.
Signed-off-by: Max Reitz <address@hidden>
---
block/nbd-client.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/nbd-client.c b/block/nbd-client.c
index be6803d..ab13607 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -315,6 +315,7 @@ int nbd_client_co_flush(BlockDriverState *bs)
ssize_t ret;
if (!(client->nbdflags & NBD_FLAG_SEND_FLUSH)) {
+ /* This mirrors the behavior of bdrv_co_flush() in block.c */
return 0;
}
@@ -350,6 +351,7 @@ int nbd_client_co_discard(BlockDriverState *bs, int64_t
sector_num,
ssize_t ret;
if (!(client->nbdflags & NBD_FLAG_SEND_TRIM)) {
+ /* This mirrors the behavior of bdrv_co_discard() in block.c */
return 0;
}
request.from = sector_num * 512;
--
2.1.0
- [Qemu-block] [PATCH 04/25] nbd: Fix response to invalid requests, (continued)
- [Qemu-block] [PATCH 04/25] nbd: Fix response to invalid requests, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 10/25] nbd: Fix potential signed overflow issues, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 01/25] util/uri: Add overflow check to rfc3986_parse_port, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 14/25] coroutine: Add co_yield_timeout(), Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 15/25] coroutine-io: Return -errno in case of error, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 07/25] nbd: Add "failed to open export" error message, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 13/25] nbd: Enforce sector alignment, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 12/25] nbd: Set block size to BDRV_SECTOR_SIZE, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 11/25] qemu-nbd: Fix and improve input verification, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 22/25] iotests: Add _timeout function, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 20/25] block/nbd: Comment on discard/flush silently failing,
Max Reitz <=
- [Qemu-block] [PATCH 16/25] coroutine-io: Add I/O functions with timeout, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 23/25] iotests: Add test for invalid qemu-nbd parameters, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 21/25] nbd: Drop unexpected data for NBD_OPT_LIST, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 25/25] iotests: Add test for a non-existing NBD export, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 19/25] nbd: Fix interpretation of the export flags, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 18/25] nbd: Fix nbd_receive_options(), Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 17/25] nbd: Employ timeouts, Max Reitz, 2015/02/25
- Re: [Qemu-block] [PATCH 00/25] nbd: Several fixes, Max Reitz, 2015/02/25
- [Qemu-block] [PATCH 24/25] iotests: Add test for issuing discard over NBD, Max Reitz, 2015/02/25