All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] libceph: use RB_EMPTY_NODE() in the osd client
@ 2012-12-17 18:31 Alex Elder
  2012-12-17 18:33 ` [PATCH,v2 1/3] libceph: init osd->o_node in create_osd() Alex Elder
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alex Elder @ 2012-12-17 18:31 UTC (permalink / raw)
  To: ceph-devel

The first one of these is an update based on a previous post.
The other two are new, but basically address the same issue
in two other spots in the osd client code.

					-Alex

[PATCH 1/3] libceph: init osd->o_node in create_osd()
[PATCH 2/3] libceph: init event->node in ceph_osdc_create_event()
[PATCH 3/3] libceph: don't use rb_init_node() in

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH,v2 1/3] libceph: init osd->o_node in create_osd()
  2012-12-17 18:31 [PATCH 0/3] libceph: use RB_EMPTY_NODE() in the osd client Alex Elder
@ 2012-12-17 18:33 ` Alex Elder
  2012-12-17 18:33 ` [PATCH 2/3] libceph: init event->node in ceph_osdc_create_event() Alex Elder
  2012-12-17 18:33 ` [PATCH 3/3] libceph: don't use rb_init_node() in ceph_osdc_alloc_request() Alex Elder
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Elder @ 2012-12-17 18:33 UTC (permalink / raw)
  To: ceph-devel

The red-black node node in the ceph osd structure is not initialized
in create_osd().  Because this node can be the subject of a
RB_EMPTY_NODE() call later on, we should ensure the node is
initialized properly for that.  Add a call to RB_CLEAR_NODE()
initialize it.

Signed-off-by: Alex Elder <elder@inktank.com>
---
v2: use RB_CLEAR_NODE() instead of rb_init_node()

 net/ceph/osd_client.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 32bd696..a6dc6ac 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -642,6 +642,7 @@ static struct ceph_osd *create_osd(struct
ceph_osd_client *osdc, int onum)
 	atomic_set(&osd->o_ref, 1);
 	osd->o_osdc = osdc;
 	osd->o_osd = onum;
+	RB_CLEAR_NODE(&osd->o_node);
 	INIT_LIST_HEAD(&osd->o_requests);
 	INIT_LIST_HEAD(&osd->o_linger_requests);
 	INIT_LIST_HEAD(&osd->o_osd_lru);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] libceph: init event->node in ceph_osdc_create_event()
  2012-12-17 18:31 [PATCH 0/3] libceph: use RB_EMPTY_NODE() in the osd client Alex Elder
  2012-12-17 18:33 ` [PATCH,v2 1/3] libceph: init osd->o_node in create_osd() Alex Elder
@ 2012-12-17 18:33 ` Alex Elder
  2012-12-17 18:33 ` [PATCH 3/3] libceph: don't use rb_init_node() in ceph_osdc_alloc_request() Alex Elder
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Elder @ 2012-12-17 18:33 UTC (permalink / raw)
  To: ceph-devel

The red-black node node in the ceph osd event structure is not
initialized in create_osdc_create_event().  Because this node can
be the subject of a RB_EMPTY_NODE() call later on, we should ensure
the node is initialized properly for that.

Signed-off-by: Alex Elder <elder@inktank.com>
---
 net/ceph/osd_client.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index a6dc6ac..2bce3d4 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1563,6 +1563,7 @@ int ceph_osdc_create_event(struct ceph_osd_client
*osdc,
 	event->data = data;
 	event->osdc = osdc;
 	INIT_LIST_HEAD(&event->osd_node);
+	RB_CLEAR_NODE(&event->node);
 	kref_init(&event->kref);   /* one ref for us */
 	kref_get(&event->kref);    /* one ref for the caller */
 	init_completion(&event->completion);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] libceph: don't use rb_init_node() in ceph_osdc_alloc_request()
  2012-12-17 18:31 [PATCH 0/3] libceph: use RB_EMPTY_NODE() in the osd client Alex Elder
  2012-12-17 18:33 ` [PATCH,v2 1/3] libceph: init osd->o_node in create_osd() Alex Elder
  2012-12-17 18:33 ` [PATCH 2/3] libceph: init event->node in ceph_osdc_create_event() Alex Elder
@ 2012-12-17 18:33 ` Alex Elder
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Elder @ 2012-12-17 18:33 UTC (permalink / raw)
  To: ceph-devel

The red-black node in the ceph osd request structure is initialized
in ceph_osdc_alloc_request() using rbd_init_node().  We do need to
initialize this, because in __unregister_request() we call
RB_EMPTY_NODE(), which expects the node it's checking to have
been initialized.  But rb_init_node() is apparently overkill, and
may in fact be on its way out.  So use RB_CLEAR_NODE() instead.

For a little more background, see this commit:
    4c199a93 rbtree: empty nodes have no color"

Signed-off-by: Alex Elder <elder@inktank.com>
---
 net/ceph/osd_client.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 2bce3d4..7cd0a7f 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -221,7 +221,7 @@ struct ceph_osd_request
*ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
 	kref_init(&req->r_kref);
 	init_completion(&req->r_completion);
 	init_completion(&req->r_safe_completion);
-	rb_init_node(&req->r_node);
+	RB_CLEAR_NODE(&req->r_node);
 	INIT_LIST_HEAD(&req->r_unsafe_item);
 	INIT_LIST_HEAD(&req->r_linger_item);
 	INIT_LIST_HEAD(&req->r_linger_osd);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-17 18:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-17 18:31 [PATCH 0/3] libceph: use RB_EMPTY_NODE() in the osd client Alex Elder
2012-12-17 18:33 ` [PATCH,v2 1/3] libceph: init osd->o_node in create_osd() Alex Elder
2012-12-17 18:33 ` [PATCH 2/3] libceph: init event->node in ceph_osdc_create_event() Alex Elder
2012-12-17 18:33 ` [PATCH 3/3] libceph: don't use rb_init_node() in ceph_osdc_alloc_request() Alex Elder

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.