[PATCH] dm-bufio: break out of both loops when freeing data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

---
 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;
 }
 

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux