Subject: RFC: MSDOS write performance fixup (upto 6x)
To: None <tech-kern@NetBSD.org>
From: Reinoud Zandijk <reinoud@NetBSD.org>
List: tech-kern
Date: 10/25/2007 22:38:28
--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Dear folks,
it came to my attention that the buffer cache has been tweaked by yamt
(AFAIR) to better anticipate on write actions. FFS has been taken care of i
noticed but msdosfs wasn't.
Attached are the patches i made and tested for msdosfs and a simple
bonnie++ testrun though it test size should have been much higher on this
machine...
anyway, please review this patch and look at the attached bonnie output. I
did check if there were corruptions, but i couldn't find any.
With regards,
Reinoud
--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="msdosfs.patch"
> cvs -q diff -up sys/fs/msdosfs/
Index: sys/fs/msdosfs/msdosfs_denode.c
===================================================================
RCS file: /cvsroot/src/sys/fs/msdosfs/msdosfs_denode.c,v
retrieving revision 1.26
diff -u -p -r1.26 msdosfs_denode.c
--- sys/fs/msdosfs/msdosfs_denode.c 10 Oct 2007 20:42:23 -0000 1.26
+++ sys/fs/msdosfs/msdosfs_denode.c 25 Oct 2007 20:33:31 -0000
@@ -563,7 +563,7 @@ deextend(dep, length, cred)
osize = dep->de_FileSize;
dep->de_FileSize = length;
- uvm_vnp_setsize(DETOV(dep), (voff_t)dep->de_FileSize);
+ uvm_vnp_setwritesize(DETOV(dep), (voff_t)dep->de_FileSize);
dep->de_flag |= DE_UPDATE|DE_MODIFIED;
uvm_vnp_zerorange(DETOV(dep), (off_t)osize,
(size_t)(dep->de_FileSize - osize));
Index: sys/fs/msdosfs/msdosfs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/fs/msdosfs/msdosfs_vnops.c,v
retrieving revision 1.42
diff -u -p -r1.42 msdosfs_vnops.c
--- sys/fs/msdosfs/msdosfs_vnops.c 8 Oct 2007 18:04:04 -0000 1.42
+++ sys/fs/msdosfs/msdosfs_vnops.c 25 Oct 2007 20:33:32 -0000
@@ -641,7 +641,7 @@ msdosfs_write(v)
goto errexit;
dep->de_FileSize = uio->uio_offset + resid;
- uvm_vnp_setsize(vp, dep->de_FileSize);
+ uvm_vnp_setwritesize(vp, dep->de_FileSize);
extended = 1;
}
@@ -668,6 +668,7 @@ msdosfs_write(v)
(uio->uio_offset >> 16) << 16, PGO_CLEANIT);
}
} while (error == 0 && uio->uio_resid > 0);
+ uvm_vnp_setsize(vp, dep->de_FileSize);
if (error == 0 && ioflag & IO_SYNC) {
simple_lock(&vp->v_interlock);
error = VOP_PUTPAGES(vp, trunc_page(oldoff),
@@ -688,7 +689,6 @@ errexit:
uio->uio_resid = resid;
} else if ((ioflag & IO_SYNC) == IO_SYNC)
error = deupdat(dep, 1);
- KASSERT(vp->v_size == dep->de_FileSize);
return (error);
}
--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=bonnie-ffs1-softdep
> bonnie++ -d bonnie/ -r 50
Writing with putc()...done
Writing intelligently...done
Rewriting...done
Reading with getc()...done
Reading intelligently...done
start 'em...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version 1.03 ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
heethoofdje.13 300M 29463 25 33954 9 33091 11 94559 99 +++++ +++ +++++ +++
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 1449 83 +++++ +++ 32590 99 1644 94 1849 97 4178 99
heethoofdje.13thmonkey.org,300M,29463,25,33954,9,33091,11,94559,99,+++++,+++,+++++,+++,16,1449,83,+++++,+++,32590,99,1644,94,1849,97,4178,99
--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=bonnie-post-msdos
> bonnie++ -d bonnie/ -r 50
Writing with putc()...done
Writing intelligently...done
Rewriting...done
Reading with getc()...done
Reading intelligently...done
start 'em...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version 1.03 ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
heethoofdje.13 300M 48537 47 48190 20 45872 16 93126 99 +++++ +++ +++++ +++
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 226 74 1626 99 1060 23 459 56 1642 99 982 40
heethoofdje.13thmonkey.org,300M,48537,47,48190,20,45872,16,93126,99,+++++,+++,+++++,+++,16,226,74,1626,99,1060,23,459,56,1642,99,982,40
--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=bonnie-pre-msdos
> bonnie++ -d bonnie/ -r 50
Writing with putc()...done
Writing intelligently...done
Rewriting...done
Reading with getc()...done
Reading intelligently...done
start 'em...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version 1.03 ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
heethoofdje.13 300M 2077 2 2130 1 35965 10 89249 95 +++++ +++ +++++ +++
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 223 74 1572 96 1030 24 455 56 1585 96 976 41
heethoofdje.13thmonkey.org,300M,2077,2,2130,1,35965,10,89249,95,+++++,+++,+++++,+++,16,223,74,1572,96,1030,24,455,56,1585,96,976,41
--1yeeQ81UyVL57Vl7--