Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 25880
b: refs/heads/master
c: be3b075
h: refs/heads/master
v: v3
  • Loading branch information
OGAWA Hirofumi authored and Jens Axboe committed Apr 18, 2006
1 parent 6ee017b commit 7a39d51
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dbecf3ab40b5a6cc4499543778cd9f9682c0abad
refs/heads/master: be3b075354e170368a0d29558cae492205e80a64
19 changes: 12 additions & 7 deletions trunk/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1487,20 +1487,22 @@ cfq_cic_rb_lookup(struct cfq_data *cfqd, struct io_context *ioc)
{
struct rb_node *n;
struct cfq_io_context *cic;
void *key = cfqd;
void *k, *key = cfqd;

restart:
n = ioc->cic_root.rb_node;
while (n) {
cic = rb_entry(n, struct cfq_io_context, rb_node);
if (unlikely(!cic->key)) {
/* ->key must be copied to avoid race with cfq_exit_queue() */
k = cic->key;
if (unlikely(!k)) {
cfq_drop_dead_cic(ioc, cic);
goto restart;
}

if (key < cic->key)
if (key < k)
n = n->rb_left;
else if (key > cic->key)
else if (key > k)
n = n->rb_right;
else
return cic;
Expand All @@ -1516,6 +1518,7 @@ cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc,
struct rb_node **p;
struct rb_node *parent;
struct cfq_io_context *__cic;
void *k;

cic->ioc = ioc;
cic->key = cfqd;
Expand All @@ -1527,14 +1530,16 @@ cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc,
while (*p) {
parent = *p;
__cic = rb_entry(parent, struct cfq_io_context, rb_node);
if (unlikely(!__cic->key)) {
/* ->key must be copied to avoid race with cfq_exit_queue() */
k = __cic->key;
if (unlikely(!k)) {
cfq_drop_dead_cic(ioc, cic);
goto restart;
}

if (cic->key < __cic->key)
if (cic->key < k)
p = &(*p)->rb_left;
else if (cic->key > __cic->key)
else if (cic->key > k)
p = &(*p)->rb_right;
else
BUG();
Expand Down

0 comments on commit 7a39d51

Please sign in to comment.