Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);