shithub: riscv

Download patch

ref: b431b6c169c20955a2eb53016a2eefd5ecc36847
parent: 32dfbc7c50873ea4167a7e5352e2fd29f6304d37
author: cinap_lenrek <[email protected]>
date: Mon Nov 7 19:38:07 EST 2016

kernel/qio: fix comments, fix qiwrite() on close queue, remove debug setmalloctag() call in qwrite()

--- a/sys/src/9/port/qio.c
+++ b/sys/src/9/port/qio.c
@@ -1192,7 +1192,6 @@
 			n = Maxatomic;
 
 		b = allocb(n);
-		setmalloctag(b, (up->text[0]<<24)|(up->text[1]<<16)|(up->text[2]<<8)|up->text[3]);
 		if(waserror()){
 			freeb(b);
 			nexterror();
@@ -1201,9 +1200,7 @@
 		poperror();
 		b->wp += n;
 
-		qbwrite(q, b);
-
-		sofar += n;
+		sofar += qbwrite(q, b);
 	} while(sofar < len && (q->state & Qmsg) == 0);
 
 	return len;
@@ -1212,9 +1209,6 @@
 /*
  *  used by print() to write to a queue.  Since we may be splhi or not in
  *  a process, don't qlock.
- *
- *  this routine merges adjacent blocks if block n+1 will fit into
- *  the free space of block n.
  */
 int
 qiwrite(Queue *q, void *vp, int len)
@@ -1242,7 +1236,7 @@
 		/* we use an artificially high limit for kernel prints since anything
 		 * over the limit gets dropped
 		 */
-		if(q->dlen >= 16*1024){
+		if((q->state & Qclosed) != 0 || q->len/2 >= q->limit){
 			iunlock(q);
 			freeb(b);
 			break;
@@ -1424,7 +1418,7 @@
 	/* free queued blocks */
 	freeblist(bfirst);
 
-	/* wake up readers/writers */
+	/* wake up writers */
 	wakeup(&q->wr);
 }