From 1b4bc5f851fa99278416fcef5edcc80be0d23e40 Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Fri, 2 Apr 2010 15:12:31 +0000 Subject: [PATCH] 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 Tested by: Mykola Dzham Pointyhat to: avg MFC after: 2 weeks X-ToDo: convert bread(devvp) in all fs to use bo_bsize-d blocks --- sys/geom/geom_vfs.c | 2 +- sys/kern/vfs_bio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/geom/geom_vfs.c b/sys/geom/geom_vfs.c index 9bfa74654e5d..9d01f40c0f70 100644 --- a/sys/geom/geom_vfs.c +++ b/sys/geom/geom_vfs.c @@ -179,7 +179,7 @@ g_vfs_open(struct vnode *vp, struct g_consumer **cpp, const char *fsname, int wr 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); diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index df9a257af3b2..4e9cfc699575 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -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;