Lines Matching +full:cs +full:- +full:0

1 // SPDX-License-Identifier: GPL-2.0
13 struct ceph_string *cs, *exist; in ceph_find_or_create_string() local
23 if (ret > 0) in ceph_find_or_create_string()
24 p = &(*p)->rb_left; in ceph_find_or_create_string()
25 else if (ret < 0) in ceph_find_or_create_string()
26 p = &(*p)->rb_right; in ceph_find_or_create_string()
31 if (exist && !kref_get_unless_zero(&exist->kref)) { in ceph_find_or_create_string()
32 rb_erase(&exist->node, &string_tree); in ceph_find_or_create_string()
33 RB_CLEAR_NODE(&exist->node); in ceph_find_or_create_string()
40 cs = kmalloc(sizeof(*cs) + len + 1, GFP_NOFS); in ceph_find_or_create_string()
41 if (!cs) in ceph_find_or_create_string()
44 kref_init(&cs->kref); in ceph_find_or_create_string()
45 cs->len = len; in ceph_find_or_create_string()
46 memcpy(cs->str, str, len); in ceph_find_or_create_string()
47 cs->str[len] = 0; in ceph_find_or_create_string()
58 if (ret > 0) in ceph_find_or_create_string()
59 p = &(*p)->rb_left; in ceph_find_or_create_string()
60 else if (ret < 0) in ceph_find_or_create_string()
61 p = &(*p)->rb_right; in ceph_find_or_create_string()
66 ret = 0; in ceph_find_or_create_string()
68 rb_link_node(&cs->node, parent, p); in ceph_find_or_create_string()
69 rb_insert_color(&cs->node, &string_tree); in ceph_find_or_create_string()
70 } else if (!kref_get_unless_zero(&exist->kref)) { in ceph_find_or_create_string()
71 rb_erase(&exist->node, &string_tree); in ceph_find_or_create_string()
72 RB_CLEAR_NODE(&exist->node); in ceph_find_or_create_string()
73 ret = -EAGAIN; in ceph_find_or_create_string()
76 if (ret == -EAGAIN) in ceph_find_or_create_string()
80 kfree(cs); in ceph_find_or_create_string()
81 cs = exist; in ceph_find_or_create_string()
84 return cs; in ceph_find_or_create_string()
90 struct ceph_string *cs = container_of(ref, struct ceph_string, kref); in ceph_release_string() local
93 if (!RB_EMPTY_NODE(&cs->node)) { in ceph_release_string()
94 rb_erase(&cs->node, &string_tree); in ceph_release_string()
95 RB_CLEAR_NODE(&cs->node); in ceph_release_string()
99 kfree_rcu(cs, rcu); in ceph_release_string()