From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 4/6] rbd: rename __rbd_add_snap_dev()
Date: Fri, 26 Apr 2013 07:06:24 -0500 [thread overview]
Message-ID: <517A6DC0.7080005@inktank.com> (raw)
In-Reply-To: <517A6D39.80000@inktank.com>
Rename __rbd_add_snap_dev() to be rbd_snap_create(). We no longer
have devices for non-mapped snapshots, and we're not actually
"adding" it to the list in this function, just creating it.
Rename rbd_remove_snap_dev() to be rbd_snap_destroy() for reasons
similar to the above. Stop having this function delete the snapshot
from its list (to be symmetrical with its create counterpart) and do
that in the caller instead.
Signed-off-by: Alex Elder <elder@inktank.com>
---
drivers/block/rbd.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index e7d10d3..916741b 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -359,7 +359,7 @@ static int rbd_img_request_submit(struct
rbd_img_request *img_request);
static int rbd_dev_snaps_update(struct rbd_device *rbd_dev);
static void rbd_dev_release(struct device *dev);
-static void rbd_remove_snap_dev(struct rbd_snap *snap);
+static void rbd_snap_destroy(struct rbd_snap *snap);
static ssize_t rbd_add(struct bus_type *bus, const char *buf,
size_t count);
@@ -3010,8 +3010,10 @@ static void rbd_remove_all_snaps(struct
rbd_device *rbd_dev)
struct rbd_snap *snap;
struct rbd_snap *next;
- list_for_each_entry_safe(snap, next, &rbd_dev->snaps, node)
- rbd_remove_snap_dev(snap);
+ list_for_each_entry_safe(snap, next, &rbd_dev->snaps, node) {
+ list_del(&snap->node);
+ rbd_snap_destroy(snap);
+ }
}
static void rbd_update_mapping_size(struct rbd_device *rbd_dev)
@@ -3413,14 +3415,13 @@ static void rbd_dev_destroy(struct rbd_device
*rbd_dev)
kfree(rbd_dev);
}
-static void rbd_remove_snap_dev(struct rbd_snap *snap)
+static void rbd_snap_destroy(struct rbd_snap *snap)
{
- list_del(&snap->node);
kfree(snap->name);
kfree(snap);
}
-static struct rbd_snap *__rbd_add_snap_dev(struct rbd_device *rbd_dev,
+static struct rbd_snap *rbd_snap_create(struct rbd_device *rbd_dev,
const char *snap_name,
u64 snap_id, u64 snap_size,
u64 snap_features)
@@ -4070,7 +4071,9 @@ static int rbd_dev_snaps_update(struct rbd_device
*rbd_dev)
rbd_dev->spec->snap_id == snap->id ?
"mapped " : "",
(unsigned long long)snap->id);
- rbd_remove_snap_dev(snap);
+
+ list_del(&snap->node);
+ rbd_snap_destroy(snap);
/* Done with this list entry; advance */
@@ -4093,7 +4096,7 @@ static int rbd_dev_snaps_update(struct rbd_device
*rbd_dev)
/* We haven't seen this snapshot before */
- new_snap = __rbd_add_snap_dev(rbd_dev, snap_name,
+ new_snap = rbd_snap_create(rbd_dev, snap_name,
snap_id, snap_size, snap_features);
if (IS_ERR(new_snap)) {
ret = PTR_ERR(new_snap);
--
1.7.9.5
next prev parent reply other threads:[~2013-04-26 12:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 12:04 [PATCH 0/6] rbd: cleanup and plug leaks Alex Elder
2013-04-26 12:05 ` [PATCH 1/6] rbd: fix leak of snapshots during initial probe Alex Elder
2013-04-29 15:12 ` Josh Durgin
2013-04-26 12:05 ` [PATCH 2/6] rbd: make snap_size order parameter optional Alex Elder
2013-04-29 15:14 ` Josh Durgin
2013-04-26 12:06 ` [PATCH 3/6] rbd: only update values on snap_info success Alex Elder
2013-04-29 15:15 ` Josh Durgin
2013-04-26 12:06 ` Alex Elder [this message]
2013-04-29 15:15 ` [PATCH 4/6] rbd: rename __rbd_add_snap_dev() Josh Durgin
2013-04-26 12:06 ` [PATCH 5/6] rbd: fix leak of format 2 snapshot names Alex Elder
2013-04-26 17:40 ` [PATCH 5/6, v2] " Alex Elder
2013-04-29 15:16 ` [PATCH 5/6] " Josh Durgin
2013-04-29 15:18 ` Josh Durgin
2013-04-26 12:06 ` [PATCH 6/6] rbd: use rbd_obj_method_sync() return value Alex Elder
2013-04-29 15:22 ` 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=517A6DC0.7080005@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 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.