[CRIU] [PATCH] bfd: move the optimization in a proper place

Andrey Vagin avagin at openvz.org
Wed Sep 24 03:48:24 PDT 2014


Currently this optimization skips unscanned data
and doesn't work. Lets skip scanned data only.

Reported-by: Jenkins
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 bfd.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bfd.c b/bfd.c
index 1ced0b0..34030f5 100644
--- a/bfd.c
+++ b/bfd.c
@@ -141,16 +141,17 @@ again:
 		return b->pos;
 	}
 
-	/* no full line in the buffer -- refill one */
-	if (brefill(f))
-		return BREADERR;
-
 	/*
 	 * small optimization -- we've scanned b->bleft
 	 * symols already, no need to re-scan them after
 	 * the buffer refill.
 	 */
 	ss = b->bleft;
+
+	/* no full line in the buffer -- refill one */
+	if (brefill(f))
+		return BREADERR;
+
 	refilled = true;
 
 	goto again;
-- 
1.9.3



More information about the CRIU mailing list