[Top][All Lists]

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

Re: [Qemu-devel] [PATCH v4 2/3] Extract code to nbd_setup function to be

From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v4 2/3] Extract code to nbd_setup function to be used for many purposes
Date: Tue, 06 Dec 2011 08:59:55 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1

On 12/06/2011 07:56 AM, Chunyan Liu wrote:

Currently, the nbd_setup needs parameters: device, srcpath, flags,
partition, dev_offset, nbdflags, sockpath, bindto, port, shared,
persistent, verbose, sigterm_rfd. More than 10 parameters. I still
didn't find a better way to reduce parameters. Making variables global
is a workaround to avoid nbd_setup taking too many parameters. Actually,
except for sigterm_rfd, all others are pared from command line options.

Reading again this patch, I am not sure why you are doing it this way.

There is no reason why bdrv_new/open/delete has to be redone for every /dev/nbdX we try (or if there is a reason, _that_ is what should be fixed first). Also the "tail" of nbd_setup, basically the select loop, should not be tried multiple times.

I do not understand why you cannot simply do it like this:

- in the server thread, do everything as it is now

- pass "device" to the client thread instead of opening it in main()

- in the client thread, either use "device" as it is or (if device == NULL, which implies find == 1) loop until nbd_init succeeds.

Am I just confused?


reply via email to

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