shithub: riscv

Download patch

ref: 01b5ac14024a26f4f1771bc7027e146e86f9c2c3
parent: 3d12f4f408da568dcb9cb0ba802dc9824cbe26fd
author: cinap_lenrek <[email protected]>
date: Sun Jun 8 14:54:36 EDT 2014

iostats: add -C flag to enable mount cache

--- a/sys/man/4/iostats
+++ b/sys/man/4/iostats
@@ -5,8 +5,9 @@
 .B iostats
 [
 .B -d
-]
-[
+] [
+.B -C
+] [
 .B -f
 .I dbfile
 ]
@@ -55,6 +56,12 @@
 .I dbfile
 (default
 .BR iostats.out ).
+.PP
+The
+.B -C
+flag sets the MCACHE flag on the mount which allows
+the kernel to cache (see 
+.IR bind(1) ).
 .SH EXAMPLE
 Display summary of file I/O incurred by
 .IR ls (1):
--- a/sys/src/cmd/iostats/iostats.c
+++ b/sys/src/cmd/iostats/iostats.c
@@ -48,8 +48,9 @@
 	char *dbfile, *s;
 	char buf[128];
 	float brpsec, bwpsec, bppsec;
-	int type, cpid, fspid, n;
+	int type, cpid, fspid, n, mflag;
 
+	mflag = MREPL;
 	dbfile = DEBUGFILE;
 
 	ARGBEGIN{
@@ -59,6 +60,9 @@
 	case 'f':
 		dbfile = ARGF();
 		break;
+	case 'C':
+		mflag |= MCACHE;
+		break;
 	default:
 		usage();
 	}ARGEND
@@ -83,7 +87,7 @@
 			fatal("no working directory");
 
 		rfork(RFENVG|RFNAMEG|RFNOTEG);
-		if(mount(p[0], -1, "/", MREPL, "") < 0)
+		if(mount(p[0], -1, "/", mflag, "") < 0)
 			fatal("mount /");
 
 		bind("#c/pid", "/dev/pid", MREPL);