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: Huaisheng Ye <yehs1@lenovo.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
09f2d65630
commit
84420b1e5d
|
@ -571,7 +571,7 @@ static struct wc_entry *writecache_find_entry(struct dm_writecache *wc,
|
|||
node = rb_prev(&e->rb_node);
|
||||
else
|
||||
node = rb_next(&e->rb_node);
|
||||
if (!node)
|
||||
if (unlikely(!node))
|
||||
return e;
|
||||
e2 = container_of(node, struct wc_entry, rb_node);
|
||||
if (read_original_sector(wc, e2) != block)
|
||||
|
@ -804,7 +804,7 @@ static void writecache_discard(struct dm_writecache *wc, sector_t start, sector_
|
|||
writecache_free_entry(wc, e);
|
||||
}
|
||||
|
||||
if (!node)
|
||||
if (unlikely(!node))
|
||||
break;
|
||||
|
||||
e = container_of(node, struct wc_entry, rb_node);
|
||||
|
|
Loading…
Reference in New Issue