qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V3 2/2] Add -f option to qemu-nbd


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH V3 2/2] Add -f option to qemu-nbd
Date: Thu, 24 Nov 2011 08:59:31 +0000

On Thu, Nov 24, 2011 at 3:38 AM, Chunyan Liu <address@hidden> wrote:
>
>
> 2011/11/23 Stefan Hajnoczi <address@hidden>
>>
>> On Wed, Nov 23, 2011 at 10:14 AM, Chunyan Liu <address@hidden> wrote:
>> > V3:
>> > Remove file lock in main().
>> > Try to find new free nbd device and connect to it if connecting to the
>> > first
>> > first found free nbd device failed.
>> >
>> > Signed-off-by: Chunyan Liu <address@hidden>
>> > ---
>> >  qemu-nbd.c |   80
>> > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>> >  1 files changed, 79 insertions(+), 1 deletions(-)
>>
>> I not seeing the part where you adjusted the ioctl order.
>>
>> The /proc/partitions scanning is unnecessary since we can just loop
>> over /dev/ndb%d and try to initialize.  If a device is in use then
>> init will fail and we need to try the next one.  If a device is free
>> we can continue with normal operation.  I guess I'm saying that once
>> you fix the ioctl order then there's no need for another mechanism to
>> test whether or not a device is in use.
>
> The way of scanning /proc/partitions to find an unused nbd device first can
> borrow the code for "qemu-nbd -c" to do the left things. .
> The way of loop over /dev/nbd%d and try to initialize, from the first
> thought, needs do all things in the loop, including handling -v, nbd_init,
> nbd_client, etc. That part of code is quite similar to "qemu-nbd -c". I
> don't know if that is better?

This might be a chance to refactor the code slightly, that would also
avoid you having to introduce a goto retry.

Stefan



reply via email to

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