All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 5/7] rbd: make rbd_dev_destroy() match rbd_dev_create()
Date: Fri, 26 Apr 2013 13:00:48 -0500	[thread overview]
Message-ID: <517AC0D0.30708@inktank.com> (raw)
In-Reply-To: <517AC047.6060000@inktank.com>

Currently, rbd_dev_destroy() does more than just the inverse of what
rbd_dev_create() does.  Stop doing that, and move the two extra
things it does into the three call sites.

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 63040fd..0356bba 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3425,8 +3425,6 @@ static struct rbd_device *rbd_dev_create(struct
rbd_client *rbdc,

 static void rbd_dev_destroy(struct rbd_device *rbd_dev)
 {
-	rbd_spec_put(rbd_dev->parent_spec);
-	kfree(rbd_dev->header_name);
 	rbd_put_client(rbd_dev->rbd_client);
 	rbd_spec_put(rbd_dev->spec);
 	kfree(rbd_dev);
@@ -4784,6 +4782,8 @@ static int rbd_dev_probe_finish(struct rbd_device
*rbd_dev)
 	return ret;

 err_out_parent:
+	rbd_spec_put(rbd_dev->parent_spec);
+	kfree(rbd_dev->header_name);
 	rbd_dev_destroy(parent);
 err_out_spec:
 	rbd_spec_put(parent_spec);
@@ -4905,6 +4905,8 @@ static ssize_t rbd_add(struct bus_type *bus,

 	return count;
 err_out_rbd_dev:
+	rbd_spec_put(rbd_dev->parent_spec);
+	kfree(rbd_dev->header_name);
 	rbd_dev_destroy(rbd_dev);
 err_out_client:
 	rbd_put_client(rbdc);
@@ -4955,6 +4957,8 @@ static void rbd_dev_release(struct device *dev)
 	/* done with the id, and with the rbd_dev */
 	rbd_dev_id_put(rbd_dev);
 	rbd_assert(rbd_dev->rbd_client != NULL);
+	rbd_spec_put(rbd_dev->parent_spec);
+	kfree(rbd_dev->header_name);
 	rbd_dev_destroy(rbd_dev);

 	/* release module ref */
-- 
1.7.9.5


  parent reply	other threads:[~2013-04-26 18:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 17:58 [PATCH 0/7] rbd: miscellaneous cleanups Alex Elder
2013-04-26 17:59 ` [PATCH 1/7] rbd: make rbd spec names pointer to const Alex Elder
2013-04-29 15:34   ` Josh Durgin
2013-04-26 18:00 ` [PATCH 2/7] rbd: move stripe_unit and stripe_count into header Alex Elder
2013-04-29 15:35   ` Josh Durgin
2013-04-26 18:00 ` [PATCH 3/7] rbd: use rbd_warn(), not WARN_ON() Alex Elder
2013-04-29 15:36   ` Josh Durgin
2013-04-26 18:00 ` [PATCH 4/7] rbd: define rbd snap context routines Alex Elder
2013-04-29 15:55   ` Josh Durgin
2013-04-26 18:00 ` Alex Elder [this message]
2013-04-29 15:58   ` [PATCH 5/7] rbd: make rbd_dev_destroy() match rbd_dev_create() Josh Durgin
2013-04-26 18:01 ` [PATCH 6/7] rbd: rename rbd_dev_probe() Alex Elder
2013-04-29 15:59   ` Josh Durgin
2013-04-26 18:01 ` [PATCH 7/7] rbd: refactor rbd_dev_probe_update_spec() Alex Elder
2013-04-29 16:04   ` 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=517AC0D0.30708@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.