-
- /* n - 1 is first value left of n */
- for (i = n - 1; i >= 0; i--) {
- child_node_flag_ptr = &((struct cds_ja_inode_flag **) node->u.data)[i];
- child_node_flag = rcu_dereference(*child_node_flag_ptr);
- if (child_node_flag) {
- dbg_printf("ja_pigeon_node_get_left child_node_flag %p\n",
- child_node_flag);
- return child_node_flag;
+ assert(dir == JA_LEFT || dir == JA_RIGHT);
+
+ if (dir == JA_LEFT) {
+ /* n - 1 is first value left of n */
+ for (i = n - 1; i >= 0; i--) {
+ child_node_flag_ptr = &((struct cds_ja_inode_flag **) node->u.data)[i];
+ child_node_flag = rcu_dereference(*child_node_flag_ptr);
+ if (child_node_flag) {
+ dbg_printf("ja_pigeon_node_get_left child_node_flag %p\n",
+ child_node_flag);
+ return child_node_flag;
+ }
+ }
+ } else {
+ /* n + 1 is first value right of n */
+ for (i = n + 1; i < JA_ENTRY_PER_NODE; i++) {
+ child_node_flag_ptr = &((struct cds_ja_inode_flag **) node->u.data)[i];
+ child_node_flag = rcu_dereference(*child_node_flag_ptr);
+ if (child_node_flag) {
+ dbg_printf("ja_pigeon_node_get_right child_node_flag %p\n",
+ child_node_flag);
+ return child_node_flag;
+ }