qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 20/25] block/nbd: Comment on discard/flush silen


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH 20/25] block/nbd: Comment on discard/flush silently failing
Date: Mon, 16 Mar 2015 10:49:10 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 2015-03-16 at 10:44, Paolo Bonzini wrote:

On 16/03/2015 14:58, Max Reitz wrote:
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;
Should this return -EOPNOTSUPP instead?
That's what this patch is for. I asked myself the same thing, and it
turns out, the functions deliberately return 0 because bdrv_co_flush()
and bdrv_co_discard() do the same if the block driver does not support
these functions at all, so that's why I'm adding these comments.
Right, but a better model than block.c should be for example
block/raw-posix.c, which returns ENOTSUP (I checked now...).

Maybe we should catch ENOTSUP in bdrv_co_discard() and override it?

Max



reply via email to

[Prev in Thread] Current Thread [Next in Thread]