svn commit: r206129 - head/sys/kern

Andriy Gapon avg at FreeBSD.org
Sat Apr 3 08:39:01 UTC 2010


Author: avg
Date: Sat Apr  3 08:39:00 2010
New Revision: 206129
URL: http://svn.freebsd.org/changeset/base/206129

Log:
  vn_stat: take into account va_blocksize when setting st_blksize
  
  As currently st_blksize is always PAGE_SIZE, it is playing safe to not
  use any smaller value.  For some cases this might not be optimal, but
  at least nothing should get broken.
  
  Generally I don't expect this commit to change much for the following
  reasons (in case of VREG, VDIR):
  - application I/O and physical I/O are sufficiently decoupled by
    filesystem code, buffer cache code, cluster and read-ahead logic
  - not all applications use st_blksize as a hint, some use f_iosize, some
    use fixed block sizes
  
  I expect writes to the middle of files on ZFS to benefit the most from
  this change.
  
  Silence from:	fs@
  MFC after:	2 weeks

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c	Sat Apr  3 08:25:04 2010	(r206128)
+++ head/sys/kern/vfs_vnops.c	Sat Apr  3 08:39:00 2010	(r206129)
@@ -792,11 +792,10 @@ vn_stat(vp, sb, active_cred, file_cred, 
 	 *   "a filesystem-specific preferred I/O block size for this 
 	 *    object.  In some filesystem types, this may vary from file
 	 *    to file"
-	 * Default to PAGE_SIZE after much discussion.
-	 * XXX: min(PAGE_SIZE, vp->v_bufobj.bo_bsize) may be more correct.
+	 * Use miminum/default of PAGE_SIZE (e.g. for VCHR).
 	 */
 
-	sb->st_blksize = PAGE_SIZE;
+	sb->st_blksize = max(PAGE_SIZE, vap->va_blocksize);
 	
 	sb->st_flags = vap->va_flags;
 	if (priv_check(td, PRIV_VFS_GENERATION))


More information about the svn-src-head mailing list