shithub: riscv

Download patch

ref: a2c0e55e6885fde0d135831a77d227bc933d89e7
parent: 5b972a9aea9383fbb66142a6a9958e01f7028a89
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Mar 3 00:26:09 EST 2019

qio: handle common case in trimblock()

--- a/sys/src/9/port/qio.c
+++ b/sys/src/9/port/qio.c
@@ -243,7 +243,10 @@
 	Block *nb, *startb;
 
 	QDEBUG checkb(bp, "trimblock 1");
-	if(blocklen(bp) < offset+len) {
+	l = blocklen(bp);
+	if(offset == 0 && len == l)
+		return bp;
+	if(l < offset+len) {
 		freeblist(bp);
 		return nil;
 	}