From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 5/7] rbd: simplify snap_by_name() interface
Date: Fri, 07 Sep 2012 12:41:51 -0700 [thread overview]
Message-ID: <504A4DFF.4000009@inktank.com> (raw)
In-Reply-To: <5049FA95.3040505@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
On 09/07/2012 06:45 AM, Alex Elder wrote:
> There is only one caller of snap_by_name(), and it passes two values
> to be assigned, both of which are found within an rbd device
> structure.
>
> Change the interface so it just passes the address of the rbd_dev,
> and make the assignments to its fields directly.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
> drivers/block/rbd.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 23fa962..46b8f8e 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -621,10 +621,10 @@ out_err:
> return -ENOMEM;
> }
>
> -static int snap_by_name(struct rbd_image_header *header, const char
> *snap_name,
> - u64 *seq, u64 *size)
> +static int snap_by_name(struct rbd_device *rbd_dev, const char *snap_name)
> {
> int i;
> + struct rbd_image_header *header = &rbd_dev->header;
> char *p = header->snap_names;
>
> rbd_assert(header->snapc != NULL);
> @@ -633,10 +633,9 @@ static int snap_by_name(struct rbd_image_header
> *header, const char *snap_name,
>
> /* Found it. Pass back its id and/or size */
>
> - if (seq)
> - *seq = header->snapc->snaps[i];
> - if (size)
> - *size = header->snap_sizes[i];
> + rbd_dev->mapping.snap_id = header->snapc->snaps[i];
> + rbd_dev->mapping.size = header->snap_sizes[i];
> +
> return i;
> }
> p += strlen(p) + 1; /* Skip ahead to the next name */
> @@ -657,9 +656,7 @@ static int rbd_header_set_snap(struct rbd_device
> *rbd_dev, char *snap_name)
> rbd_dev->mapping.snap_exists = false;
> rbd_dev->mapping.read_only = rbd_dev->rbd_opts.read_only;
> } else {
> - ret = snap_by_name(&rbd_dev->header, snap_name,
> - &rbd_dev->mapping.snap_id,
> - &rbd_dev->mapping.size);
> + ret = snap_by_name(rbd_dev, snap_name);
> if (ret < 0)
> goto done;
> rbd_dev->mapping.snap_exists = true;
>
next prev parent reply other threads:[~2012-09-07 19:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 13:40 [PATCH 0/7] rbd: isolate mapping info, rearrange init Alex Elder
2012-09-07 13:45 ` [PATCH 1/7] rbd: separate mapping info in rbd_dev Alex Elder
2012-09-07 18:58 ` Josh Durgin
2012-09-07 21:51 ` Alex Elder
2012-09-07 13:45 ` [PATCH 2/7] rbd: record mapped size Alex Elder
2012-09-07 19:10 ` Josh Durgin
2012-09-07 21:52 ` Alex Elder
2012-09-07 13:45 ` [PATCH 3/7] rbd: return snap name from rbd_add_parse_args() Alex Elder
2012-09-07 19:32 ` Josh Durgin
2012-09-07 13:45 ` [PATCH 4/7] rbd: set mapping name with the rest Alex Elder
2012-09-07 19:39 ` Josh Durgin
2012-09-07 13:45 ` [PATCH 5/7] rbd: simplify snap_by_name() interface Alex Elder
2012-09-07 19:41 ` Josh Durgin [this message]
2012-09-07 13:46 ` [PATCH 6/7] rbd: do some header initialization earlier Alex Elder
2012-09-07 20:32 ` Josh Durgin
2012-09-07 13:46 ` [PATCH 7/7] rbd: simplify rbd_init_disk() a bit Alex Elder
2012-09-07 20:32 ` Josh Durgin
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=504A4DFF.4000009@inktank.com \
--to=josh.durgin@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