From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 4/7] rbd: set mapping name with the rest
Date: Fri, 07 Sep 2012 08:45:34 -0500 [thread overview]
Message-ID: <5049FA7E.7090305@inktank.com> (raw)
In-Reply-To: <5049F951.2030706@inktank.com>
With the exception of the snapshot name, all of the mapping-specific
fields in an rbd device structure are set in rbd_header_set_snap().
Pass the snapshot name to be assigned into rbd_header_set_snap()
to keep all of the mapping assignments together.
Signed-off-by: Alex Elder <elder@inktank.com>
---
drivers/block/rbd.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 1a64ba2..23fa962 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -644,21 +644,20 @@ static int snap_by_name(struct rbd_image_header
*header, const char *snap_name,
return -ENOENT;
}
-static int rbd_header_set_snap(struct rbd_device *rbd_dev)
+static int rbd_header_set_snap(struct rbd_device *rbd_dev, char *snap_name)
{
int ret;
down_write(&rbd_dev->header_rwsem);
- if (!memcmp(rbd_dev->mapping.snap_name, RBD_SNAP_HEAD_NAME,
+ if (!memcmp(snap_name, RBD_SNAP_HEAD_NAME,
sizeof (RBD_SNAP_HEAD_NAME))) {
rbd_dev->mapping.snap_id = CEPH_NOSNAP;
rbd_dev->mapping.size = rbd_dev->header.image_size;
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,
- rbd_dev->mapping.snap_name,
+ ret = snap_by_name(&rbd_dev->header, snap_name,
&rbd_dev->mapping.snap_id,
&rbd_dev->mapping.size);
if (ret < 0)
@@ -666,6 +665,7 @@ static int rbd_header_set_snap(struct rbd_device
*rbd_dev)
rbd_dev->mapping.snap_exists = true;
rbd_dev->mapping.read_only = true;
}
+ rbd_dev->mapping.snap_name = snap_name;
ret = 0;
done:
@@ -1888,7 +1888,7 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
if (rc)
return rc;
- rc = rbd_header_set_snap(rbd_dev);
+ rc = rbd_header_set_snap(rbd_dev, snap_name);
if (rc)
return rc;
@@ -2600,7 +2600,6 @@ static ssize_t rbd_add(struct bus_type *bus,
rc = PTR_ERR(snap_name);
goto err_put_id;
}
- rbd_dev->mapping.snap_name = snap_name;
rc = rbd_get_client(rbd_dev, mon_addrs, mon_addrs_size - 1, options);
if (rc < 0)
--
1.7.9.5
next prev parent reply other threads:[~2012-09-07 13:45 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 ` Alex Elder [this message]
2012-09-07 19:39 ` [PATCH 4/7] rbd: set mapping name with the rest 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
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=5049FA7E.7090305@inktank.com \
--to=elder@inktank.com \
--cc=ceph-devel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox