summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-writecache.c
diff options
context:
space:
mode:
authorHuaisheng Ye <yehs1@lenovo.com>2019-08-25 09:24:32 +0200
committerMike Snitzer <snitzer@redhat.com>2019-08-26 16:54:41 +0200
commit62421b3880c71da7ecbf9c4072dc64ef3e65ad0a (patch)
tree596013152e369e21cd0d41e34a1522c1b0ca1852 /drivers/md/dm-writecache.c
parentdm writecache: remove unused member pointer in writeback_struct (diff)
downloadlinux-62421b3880c71da7ecbf9c4072dc64ef3e65ad0a.tar.xz
linux-62421b3880c71da7ecbf9c4072dc64ef3e65ad0a.zip
dm writecache: add unlikely for getting two block with same LBA
In function writecache_writeback, entries g and f has same original sector only happens at entry f has been committed, but entry g has NOT yet. The probability of this happening is very low in the following 256 blocks at most of entry e. Signed-off-by: Huaisheng Ye <yehs1@lenovo.com> Acked-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-writecache.c')
-rw-r--r--drivers/md/dm-writecache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index 5c7009d716d0..3643084f92e2 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -1628,8 +1628,8 @@ restart:
if (unlikely(!next_node))
break;
g = container_of(next_node, struct wc_entry, rb_node);
- if (read_original_sector(wc, g) ==
- read_original_sector(wc, f)) {
+ if (unlikely(read_original_sector(wc, g) ==
+ read_original_sector(wc, f))) {
f = g;
continue;
}