diff mbox

[qom-next,v3,12/15] nvme: Permit zero-length block devices

Message ID 1394648907-20096-13-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber March 12, 2014, 6:28 p.m. UTC
It may not be sensible for normal use cases, but it allows to use
/dev/null in QTest.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/block/nvme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Keith Busch March 12, 2014, 7:13 p.m. UTC | #1
On Wed, 12 Mar 2014, Andreas Färber wrote:
> It may not be sensible for normal use cases, but it allows to use
> /dev/null in QTest.

Thanks! Sounds useful despite not being usable as storage. :)

I applied to my nvme tree here:

http://git.infradead.org/users/kbusch/qemu-nvme.git

It's quite a bit ahead of the upstream on 'nvme features'. I often hear
from people in various orgs using this, so might be time I roll it into
a pull request.

> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
> hw/block/nvme.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> index 2882ffe..5fd8f89 100644
> --- a/hw/block/nvme.c
> +++ b/hw/block/nvme.c
> @@ -752,8 +752,8 @@ static int nvme_init(PCIDevice *pci_dev)
>         return -1;
>     }
>
> -    bs_size =  bdrv_getlength(n->conf.bs);
> -    if (bs_size <= 0) {
> +    bs_size = bdrv_getlength(n->conf.bs);
> +    if (bs_size < 0) {
>         return -1;
>     }
>
> -- 
> 1.8.4.5
>
>
Andreas Färber March 12, 2014, 7:20 p.m. UTC | #2
Am 12.03.2014 20:13, schrieb Keith Busch:
> On Wed, 12 Mar 2014, Andreas Färber wrote:
>> It may not be sensible for normal use cases, but it allows to use
>> /dev/null in QTest.
> 
> Thanks! Sounds useful despite not being usable as storage. :)

Thanks for the quick review!

> I applied to my nvme tree here:
> 
> http://git.infradead.org/users/kbusch/qemu-nvme.git
> 
> It's quite a bit ahead of the upstream on 'nvme features'. I often hear
> from people in various orgs using this, so might be time I roll it into
> a pull request.

Tonight is Hard Freeze for 2.0. If you could also review the matching
test case http://patchwork.ozlabs.org/patch/329627/ I would put both in
my pull. I guess you'll need to submit your queue for review first? Hard
to see in a non-rebased tree.

Thanks,
Andreas
diff mbox

Patch

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 2882ffe..5fd8f89 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -752,8 +752,8 @@  static int nvme_init(PCIDevice *pci_dev)
         return -1;
     }
 
-    bs_size =  bdrv_getlength(n->conf.bs);
-    if (bs_size <= 0) {
+    bs_size = bdrv_getlength(n->conf.bs);
+    if (bs_size < 0) {
         return -1;
     }