CEPH filesystem development
 help / color / mirror / Atom feed
From: Dan Mick <dan.mick@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: ceph-devel <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH 4/4] rbd: kill rbd_device->rbd_opts
Date: Wed, 24 Oct 2012 15:37:26 -0700	[thread overview]
Message-ID: <50886DA6.4030508@inktank.com> (raw)
In-Reply-To: <508579A5.7070008@inktank.com>

Reviewed-by: Dan Mick <dan.mick@inktank.com>

On 10/22/2012 09:51 AM, Alex Elder wrote:
> The rbd_device structure has an embedded rbd_options structure.
> Such a structure is needed to work with the generic ceph argument
> parsing code, but there's no need to keep it around once argument
> parsing is done.
>
> Use a local variable to hold the rbd options used in parsing in
> rbd_get_client(), and just transfer its content (it's just a
> read_only flag) into the field in the rbd_mapping sub-structure
> that requires that information.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |   14 +++++++++-----
>   1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 4ccce4d..3c131ab 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -184,7 +184,6 @@ struct rbd_device {
>   	struct gendisk		*disk;		/* blkdev's gendisk and rq */
>
>   	u32			image_format;	/* Either 1 or 2 */
> -	struct rbd_options	rbd_opts;
>   	struct rbd_client	*rbd_client;
>
>   	char			name[DEV_NAME_LEN]; /* blkdev name, e.g. rbd3 */
> @@ -456,18 +455,24 @@ static int parse_rbd_opts_token(char *c, void
> *private)
>   static int rbd_get_client(struct rbd_device *rbd_dev, const char *mon_addr,
>   				size_t mon_addr_len, char *options)
>   {
> -	struct rbd_options *rbd_opts = &rbd_dev->rbd_opts;
> +	struct rbd_options rbd_opts;
>   	struct ceph_options *ceph_opts;
>   	struct rbd_client *rbdc;
>
> -	rbd_opts->read_only = RBD_READ_ONLY_DEFAULT;
> +	/* Initialize all rbd options to the defaults */
> +
> +	rbd_opts.read_only = RBD_READ_ONLY_DEFAULT;
>
>   	ceph_opts = ceph_parse_options(options, mon_addr,
>   					mon_addr + mon_addr_len,
> -					parse_rbd_opts_token, rbd_opts);
> +					parse_rbd_opts_token, &rbd_opts);
>   	if (IS_ERR(ceph_opts))
>   		return PTR_ERR(ceph_opts);
>
> +	/* Record the parsed rbd options */
> +
> +	rbd_dev->mapping.read_only = rbd_opts.read_only;
> +
>   	rbdc = rbd_client_find(ceph_opts);
>   	if (rbdc) {
>   		/* using an existing client */
> @@ -685,7 +690,6 @@ static int rbd_dev_set_mapping(struct rbd_device
> *rbd_dev, char *snap_name)
>   		rbd_dev->mapping.size = rbd_dev->header.image_size;
>   		rbd_dev->mapping.features = rbd_dev->header.features;
>   		rbd_dev->mapping.snap_exists = false;
> -		rbd_dev->mapping.read_only = rbd_dev->rbd_opts.read_only;
>   		ret = 0;
>   	} else {
>   		ret = snap_by_name(rbd_dev, snap_name);
>

      parent reply	other threads:[~2012-10-24 22:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 16:49 [PATCH 0/4] rbd: four minor changes Alex Elder
2012-10-22 16:51 ` [PATCH 1/4] rbd: verify rbd image order value Alex Elder
2012-10-22 22:43   ` Dan Mick
2012-10-24 18:02   ` Josh Durgin
2012-10-26 22:06     ` Alex Elder
2012-10-22 16:51 ` [PATCH 2/4] rbd: increase maximum snapshot name length Alex Elder
2012-10-24 19:01   ` Josh Durgin
2012-10-24 21:05   ` Dan Mick
2012-10-22 16:51 ` [PATCH 3/4] rbd: simplify rbd_merge_bvec() Alex Elder
2012-10-24 22:23   ` Dan Mick
2012-10-24 22:31     ` Josh Durgin
2012-10-22 16:51 ` [PATCH 4/4] rbd: kill rbd_device->rbd_opts Alex Elder
2012-10-24 22:30   ` Josh Durgin
2012-10-24 22:37   ` Dan Mick [this message]

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=50886DA6.4030508@inktank.com \
    --to=dan.mick@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=elder@inktank.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