svn commit: r206097 - in head/sys: geom kern

Andriy Gapon avg at FreeBSD.org
Fri Apr 2 15:12:31 UTC 2010


Author: avg
Date: Fri Apr  2 15:12:31 2010
New Revision: 206097
URL: http://svn.freebsd.org/changeset/base/206097

Log:
  bo_bsize: revert r205860 and take an alternative approch in getblk
  
  In r205860 I missed the fact that there is code that strongly assumes
  that devvp bo_bsize is equal to underlying provider's sectorsize.
  In those places it is hard to obtain the sectorsize in an alternative
  way if devvp bo_bsize is set to something else.
  So, I am reverting bo_bsize assigment in g_vfs_open.
  Instead, in getblk I use DEV_BSIZE block size for b_offset calculation
  if vp is a disk vp as reported by vn_isdisk.  This should coinside with
  vp being a devvp.
  
  Reported by:	Mykola Dzham <i at levsha.me>
  Tested by:	Mykola Dzham <i at levsha.me>
  Pointyhat to:	avg
  MFC after:	2 weeks
  X-ToDo:		convert bread(devvp) in all fs to use bo_bsize-d blocks

Modified:
  head/sys/geom/geom_vfs.c
  head/sys/kern/vfs_bio.c

Modified: head/sys/geom/geom_vfs.c
==============================================================================
--- head/sys/geom/geom_vfs.c	Fri Apr  2 14:37:55 2010	(r206096)
+++ head/sys/geom/geom_vfs.c	Fri Apr  2 15:12:31 2010	(r206097)
@@ -179,7 +179,7 @@ g_vfs_open(struct vnode *vp, struct g_co
 	bo = &vp->v_bufobj;
 	bo->bo_ops = g_vfs_bufops;
 	bo->bo_private = cp;
-	bo->bo_bsize = DEV_BSIZE;
+	bo->bo_bsize = pp->sectorsize;
 	gp->softc = bo;
 
 	return (error);

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Fri Apr  2 14:37:55 2010	(r206096)
+++ head/sys/kern/vfs_bio.c	Fri Apr  2 15:12:31 2010	(r206097)
@@ -2678,7 +2678,7 @@ loop:
 		 */
 		if (flags & GB_NOCREAT)
 			return NULL;
-		bsize = bo->bo_bsize;
+		bsize = vn_isdisk(vp, NULL) ? DEV_BSIZE : bo->bo_bsize;
 		offset = blkno * bsize;
 		vmio = vp->v_object != NULL;
 		maxsize = vmio ? size + (offset & PAGE_MASK) : size;


More information about the svn-src-all mailing list