From: Olaf Hering <olaf@aepfle.de>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH v8 3/5] libxl: add support for vscsi
Date: Fri, 12 Feb 2016 19:24:59 +0100 [thread overview]
Message-ID: <20160212182459.GA28852@aepfle.de> (raw)
In-Reply-To: <20160212172748.GA8818@citrix.com>
On Fri, Feb 12, Wei Liu wrote:
> There seems to be a lot of places in this patch where the lines are
> longer than 80 characters. I'm not going to point them out one by one.
> Can you fix as many of those as you can where sensible?
Many lines are slightly longer than 80 chars already, as can be seen
with 'set colorcolumn=80'. I already wrapped most of them in my patch.
> Because VSCSI is similar to PVUSB and PVUSB has mostly been reviewed, I
> basically did a side by side comparison between these two. My goal is to
> keep them as close as possible.
Unfortnuately they are not comparable. While I have now split the logic
into ctrl and dev, the code using a ctrl is just the one doing the
xenstore device work.
> > + flexarray_append_pair(front, "backend-id", GCSPRINTF("%d", vscsi->backend_domid));
> > + flexarray_append_pair(front, "state", GCSPRINTF("%d", XenbusStateInitialising));
> Wrap long lines please.
Done. I dont like the result.
> > + if (libxl__xs_directory(gc, XBT_NULL, be_path, &be_dirs)) {
> > + rc = libxl__device_vscsi_reconfigure_add(egc, aodev, &vscsi_saved, &d_config, be_path);
> > + if (rc)
> > + goto out;
> > + /* Notify that this is done */
> > + aodev->callback(egc, aodev);
>
> Wouldn't it be better if you call aodev->callback unconditionally at the
> end of this function? BTW you seem to have forgotten to set aodev->rc.
I have to rework this code, its still using libxl__wait_for_backend.
This is already fixed in the detach case. Somehow I was only
concentrating on the detach case this week, and did not notice this.
> > +/* Remove vscsidev connected to vscsictrl */
> > +int libxl_device_vscsidev_remove(libxl_ctx *ctx, uint32_t domid,
> > + libxl_device_vscsidev *dev,
> > + const libxl_asyncop_how *ao_how)
> > + LIBXL_EXTERNAL_CALLERS_ONLY;
>
> Where is libxl_device_vscsidev_add?
This is done in scsi-attach, via libxl_device_vscsictrl_add. Its not
even, compared to the scsi-detach case. I will see if that can be
changed.
> > + libxl__add_vscsictrls(egc, ao, domid, d_config, &dcs->multidev);
>
> This is because you need vscsi disk early?
I think yes, DEFINE_DEVICES_ADD has to be used somewhere.
> > + case XenbusStateClosing:
> > + case XenbusStateClosed:
> > + LOG(DEBUG, "unexpected state in %s: %s", path, s);
> > + break;
> This doesn't seem useful in the context of this function.
A few lines up "state" is already printed. Looks like the whole state
checking can be removed.
> > + return true;
> > +}
> > +
> > +static bool libxl__vscsi_fill_ctrl(libxl__gc *gc,
> > + xs_transaction_t t,
> > + const char *fe_path,
> > + const char *dir,
> > + libxl_device_vscsictrl *ctrl)
> > +{
> > + libxl_device_vscsidev dev;
> > + char *tmp, *be_path, *devs_path;
> > + char **dev_dirs;
> > + unsigned int ndev_dirs, dev_dir;
> > + bool parsed_ok;
> > +
> > + ctrl->devid = atoi(dir);
> > +
> > + be_path = libxl__xs_read(gc, t, GCSPRINTF("%s/%s/backend", fe_path, dir));
> > + /* FIXME what if xenstore is broken? */
>
> I'm not sure what kind of "broken" you referred to, but it is most
> likely we can't recover from such state.
>
> It's reasonable to assume xenstore is robust.
I will remove the FIXME comments ...
> > + if (!be_path) {
> > + libxl_defbool_set(&ctrl->scsi_raw_cmds, false);
> > + return false;
> > + }
> > +
> > + tmp = libxl__xs_read(gc, t, GCSPRINTF("%s/%s/backend-id", fe_path, dir));
> > + /* FIXME what if xenstore is broken? */
... and I will return failure here as well.
> > + if (tmp)
> > + ctrl->backend_domid = atoi(tmp);
> > +int main_vscsiattach(int argc, char **argv);
> > +int main_vscsilist(int argc, char **argv);
> > +int main_vscsidetach(int argc, char **argv);
>
> What about other commands? Looking at PVUSB series:
>
> +int main_usbctrl_attach(int argc, char **argv);
> +int main_usbctrl_detach(int argc, char **argv);
> +int main_usbdev_attach(int argc, char **argv);
> +int main_usbdev_detach(int argc, char **argv);
> +int main_usblist(int argc, char **argv);
>
> so we should be able to attach / detach both controller and specific
> device?
There are no empty scsi controllers, just controllers with at least one
device. IMO its not useful to define empty controllers, what would be
the point? While toying around I noticed that removing all vscsidevs and
leaving the vscsictrl in xenstore the frontend preserved its SCSI
controller entry in sysfs.
Olaf
next prev parent reply other threads:[~2016-02-12 18:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-11 15:43 [PATCH v8 0/5] libbxl: add support for pvscsi, iteration 8 Olaf Hering
2016-02-11 15:43 ` [PATCH v8 1/5] vscsiif.h: fix WWN notation for p-dev property Olaf Hering
2016-02-12 17:28 ` Wei Liu
2016-02-11 15:43 ` [PATCH v8 2/5] docs: add vscsi to xenstore-paths.markdown Olaf Hering
2016-02-12 17:28 ` Wei Liu
2016-02-11 15:43 ` [PATCH v8 3/5] libxl: add support for vscsi Olaf Hering
2016-02-12 17:27 ` Wei Liu
2016-02-12 18:24 ` Olaf Hering [this message]
2016-02-15 15:16 ` Wei Liu
2016-02-15 15:24 ` Olaf Hering
2016-02-15 15:52 ` Wei Liu
2016-02-15 17:09 ` Ian Jackson
2016-02-16 15:23 ` Olaf Hering
2016-02-16 17:48 ` Ian Jackson
2016-02-17 11:17 ` Olaf Hering
2016-02-11 15:43 ` [PATCH v8 4/5] vscsiif.h: add some notes about xenstore layout Olaf Hering
2016-02-12 17:28 ` Wei Liu
2016-02-11 15:43 ` [PATCH v8 5/5] Scripts to create and delete xen-scsiback nodes in Linux target framework Olaf Hering
2016-02-12 17:28 ` Wei Liu
2016-02-12 18:36 ` Olaf Hering
2016-02-15 5:51 ` Juergen Gross
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=20160212182459.GA28852@aepfle.de \
--to=olaf@aepfle.de \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.