qio: handle common case in trimblock()

front
cinap_lenrek 2019-03-03 05:26:09 +01:00
parent 5b972a9aea
commit a2c0e55e68
1 changed files with 4 additions and 1 deletions

View File

@ -243,7 +243,10 @@ trimblock(Block *bp, int offset, int len)
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;
}