svn commit: r221166 - in head/sys: fs/ext2fs modules/ext2fs

John Baldwin jhb at freebsd.org
Thu Apr 28 16:31:54 UTC 2011


On Thursday, April 28, 2011 10:47:37 am Kostik Belousov wrote:
> On Thu, Apr 28, 2011 at 02:27:17PM +0000, John Baldwin wrote:
> > Author: jhb
> > Date: Thu Apr 28 14:27:17 2011
> > New Revision: 221166
> > URL: http://svn.freebsd.org/changeset/base/221166
> > 
> > Log:
> >   Sync with several changes in UFS/FFS:
> >   - 77115: Implement support for O_DIRECT.
> >   - 98425: Fix a performance issue introduced in 70131 that was causing
> >     reads before writes even when writing full blocks.
> >   - 98658: Rename the BALLOC flags from B_* to BA_* to avoid confusion with
> >     the struct buf B_ flags.
> >   - 100344: Merge the BA_ and IO_ flags so so that they may both be used in
> >     the same flags word. This merger is possible by assigning the IO_ flags
> >     to the low sixteen bits and the BA_ flags the high sixteen bits.
> >   - 105422: Fix a file-rewrite performance case.
> >   - 129545: Implement IO_INVAL in VOP_WRITE() by marking the buffer as
> >     "no cache".
> >   - Readd the DOINGASYNC() macro and use it to control asynchronous writes.
> >     Change i-node updates to honor DOINGASYNC() instead of always being
> >     synchronous.
> >   - Use a PRIV_VFS_RETAINSUGID check instead of checking cr_uid against 0
> >     directly when deciding whether or not to clear suid and sgid bits.
> >   
> >   Submitted by:	Pedro F. Giffuni  giffunip at yahoo
> > 
> 
> > @@ -141,10 +162,42 @@ READ(ap)
> >  		if (error)
> >  			break;
> >  
> > -		bqrelse(bp);
> > +		if ((ioflag & (IO_VMIO|IO_DIRECT)) &&
> > +		   (LIST_FIRST(&bp->b_dep) == NULL)) {
> > +			/*
> > +			 * If there are no dependencies, and it's VMIO,
> There is no dependencies for ext2fs, the FFS comments talks about SU.

It looks like Pedro hinted at that in the 3rd place the code tested it.  This
patch should remove the checks assuming they are always true:

Index: ext2_readwrite.c
===================================================================
--- ext2_readwrite.c	(revision 221166)
+++ ext2_readwrite.c	(working copy)
@@ -162,8 +162,7 @@ READ(ap)
 		if (error)
 			break;
 
-		if ((ioflag & (IO_VMIO|IO_DIRECT)) &&
-		   (LIST_FIRST(&bp->b_dep) == NULL)) {
+		if (ioflag & (IO_VMIO|IO_DIRECT)) {
 			/*
 			 * If there are no dependencies, and it's VMIO,
 			 * then we don't need the buf, mark it available
@@ -189,8 +188,7 @@ READ(ap)
 	 * so it must have come from a 'break' statement
 	 */
 	if (bp != NULL) {
-		if ((ioflag & (IO_VMIO|IO_DIRECT)) &&
-		   (LIST_FIRST(&bp->b_dep) == NULL)) {
+		if (ioflag & (IO_VMIO|IO_DIRECT)) {
 			bp->b_flags |= B_RELBUF;
 			brelse(bp);
 		} else {
@@ -319,8 +317,7 @@ WRITE(ap)
 
 		error =
 		    uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio);
-		if ((ioflag & (IO_VMIO|IO_DIRECT)) &&
-		   (LIST_EMPTY(&bp->b_dep))) {	/* in ext2fs? */
+		if (ioflag & (IO_VMIO|IO_DIRECT)) {
 			bp->b_flags |= B_RELBUF;
 		}
 

> Also, I am unsure what the resulting semantic of O_DIRECTIO for ext2
> is ? UFS tries to eliminate any use of buffer cache for O_DIRECTIO
> case, up to the mapping of user pages into pbuf to perform the
> actual i/o. In ext2 case, it seems we will just destroy the buffers
> after using them for i/o. Is it useful ?

Hmm, I believe Pedro said he did not see a performance change in benchmarks,
but that it was still good to reduce diffs with the UFS code at least.
However, mapping the user pages into the buffer seems mandatory for any
performance gain to be seen.

-- 
John Baldwin


More information about the svn-src-all mailing list