qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Chunyan Liu <cyliu@suse.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>, qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <4EDDCB7B.3060300@redhat.com> (raw)
In-Reply-To: <CAERYnoZguEjQiHL8NTB5p+3VEWo89SHYyoZVRxh=VA5R5kb11Q@mail.gmail.com>

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?

Paolo

  reply	other threads:[~2011-12-06  8:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02 15:27 [Qemu-devel] [PATCH v4 1/3] Update ioctl order in nbd_init() to detect EBUSY Chunyan Liu
2011-12-02 15:27 ` [Qemu-devel] [PATCH v4 2/3] Extract code to nbd_setup function to be used for many purposes Chunyan Liu
2011-12-02 16:32   ` Paolo Bonzini
2011-12-05  5:46     ` Chunyan Liu
2011-12-05 13:16       ` Stefan Hajnoczi
2011-12-06  6:56         ` Chunyan Liu
2011-12-06  7:59           ` Paolo Bonzini [this message]
2011-12-06  8:42             ` Chunyan Liu
2011-12-06  8:44               ` Paolo Bonzini
2011-12-06  9:01                 ` Chunyan Liu
2011-12-07  4:23                   ` Chunyan Liu
2011-12-07  9:44                     ` Paolo Bonzini
2011-12-08 11:55                     ` Stefan Hajnoczi
2011-12-09  8:31                       ` Chunyan Liu
2011-12-09  9:36                         ` Stefan Hajnoczi
2011-12-02 15:27 ` [Qemu-devel] [PATCH v4 3/3] Add -f option to qemu-nbd Chunyan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EDDCB7B.3060300@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=cyliu@suse.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).