[dm-devel] [PATCH] dm-bufio: break out of both loops when freeing data
Mikulas Patocka
mpatocka at redhat.com
Wed Oct 1 17:29:48 UTC 2014
When we free the required number of entries (nr_to_scan becomes zero), we
must break out of both loops. The code exited only the inner loop and
continued in the outer loop.
Also, move dm_bufio_cond_resched to the inner loop, so that scanning the
list doesn't result in scheduling latency.
Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
---
drivers/md/dm-bufio.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: linux-3.17-rc7/drivers/md/dm-bufio.c
===================================================================
--- linux-3.17-rc7.orig/drivers/md/dm-bufio.c 2014-10-01 19:20:36.000000000 +0200
+++ linux-3.17-rc7/drivers/md/dm-bufio.c 2014-10-01 19:22:50.000000000 +0200
@@ -1473,10 +1473,12 @@ static long __scan(struct dm_bufio_clien
list_for_each_entry_safe_reverse(b, tmp, &c->lru[l], lru_list) {
freed += __cleanup_old_buffer(b, gfp_mask, 0);
if (!--nr_to_scan)
- break;
+ goto brk;
+ dm_bufio_cond_resched();
}
- dm_bufio_cond_resched();
}
+
+brk:
return freed;
}
More information about the dm-devel
mailing list