Commit 84420b1e authored by Huaisheng Ye's avatar Huaisheng Ye Committed by Mike Snitzer

dm writecache: add unlikely for returned value of rb_next/prev

In functions writecache_discard() and writecache_find_entry() there is a
high probablity that the pointer of structure rb_node won't equal NULL.
Add unlikely for the pointer node NULL.
Signed-off-by: default avatarHuaisheng Ye <yehs1@lenovo.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 09f2d656
...@@ -571,7 +571,7 @@ static struct wc_entry *writecache_find_entry(struct dm_writecache *wc, ...@@ -571,7 +571,7 @@ static struct wc_entry *writecache_find_entry(struct dm_writecache *wc,
node = rb_prev(&e->rb_node); node = rb_prev(&e->rb_node);
else else
node = rb_next(&e->rb_node); node = rb_next(&e->rb_node);
if (!node) if (unlikely(!node))
return e; return e;
e2 = container_of(node, struct wc_entry, rb_node); e2 = container_of(node, struct wc_entry, rb_node);
if (read_original_sector(wc, e2) != block) if (read_original_sector(wc, e2) != block)
...@@ -804,7 +804,7 @@ static void writecache_discard(struct dm_writecache *wc, sector_t start, sector_ ...@@ -804,7 +804,7 @@ static void writecache_discard(struct dm_writecache *wc, sector_t start, sector_
writecache_free_entry(wc, e); writecache_free_entry(wc, e);
} }
if (!node) if (unlikely(!node))
break; break;
e = container_of(node, struct wc_entry, rb_node); e = container_of(node, struct wc_entry, rb_node);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment