diff options
author | phk <phk@FreeBSD.org> | 2004-10-29 10:40:58 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-10-29 10:40:58 +0000 |
commit | 6dbcd5fd091cd06ac853f27276cb7f316af8eab9 (patch) | |
tree | 8d1ae2cf766f453bce7569d0be063aa51d4a6804 /sys/fs | |
parent | a4581c67889154eca92ca51c4863ca7e13d8238f (diff) | |
download | FreeBSD-src-6dbcd5fd091cd06ac853f27276cb7f316af8eab9.zip FreeBSD-src-6dbcd5fd091cd06ac853f27276cb7f316af8eab9.tar.gz |
Move UDF to GEOM backing instead of DEVFS.
For details, please see src/sys/ufs/ffs/ffs_vfsops.c 1.250.
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/udf/udf.h | 2 | ||||
-rw-r--r-- | sys/fs/udf/udf_vfsops.c | 43 | ||||
-rw-r--r-- | sys/fs/udf/udf_vnops.c | 8 |
3 files changed, 28 insertions, 25 deletions
diff --git a/sys/fs/udf/udf.h b/sys/fs/udf/udf.h index c45f60e..6cebc71 100644 --- a/sys/fs/udf/udf.h +++ b/sys/fs/udf/udf.h @@ -42,6 +42,8 @@ struct udf_node { struct udf_mnt { int im_flags; struct mount *im_mountp; + struct g_consumer *im_cp; + struct bufobj *im_bo; struct cdev *im_dev; struct vnode *im_devvp; int bsize; diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c index 89f38ba..71670d9 100644 --- a/sys/fs/udf/udf_vfsops.c +++ b/sys/fs/udf/udf_vfsops.c @@ -89,6 +89,9 @@ #include <sys/vnode.h> #include <sys/endian.h> +#include <geom/geom.h> +#include <geom/geom_vfs.h> + #include <vm/uma.h> #include <fs/udf/ecma167-udf.h> @@ -319,28 +322,25 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td) { uint32_t sector, size, mvds_start, mvds_end; uint32_t fsd_offset = 0; uint16_t part_num = 0, fsd_part = 0; - int error = EINVAL, needclose = 0; + int error = EINVAL; int logvol_found = 0, part_found = 0, fsd_found = 0; int bsize; - - /* - * Disallow multiple mounts of the same device. Flush the buffer - * cache for the device. - */ - if ((error = vfs_mountedon(devvp))) - return (error); - if (vcount(devvp) > 1) - return (EBUSY); - if ((error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0))) - return (error); + struct g_consumer *cp; + struct bufobj *bo; vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td); - error = VOP_OPEN(devvp, FREAD, FSCRED, td, -1); + DROP_GIANT(); + g_topology_lock(); + error = g_vfs_open(devvp, &cp, "udf", 0); + g_topology_unlock(); + PICKUP_GIANT(); VOP_UNLOCK(devvp, 0, td); if (error) return error; - needclose = 1; + bo = &devvp->v_bufobj; + + /* XXX: should be M_WAITOK */ MALLOC(udfmp, struct udf_mnt *, sizeof(struct udf_mnt), M_UDFMOUNT, M_NOWAIT | M_ZERO); if (udfmp == NULL) { @@ -357,6 +357,9 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td) { udfmp->im_dev = devvp->v_rdev; udfmp->im_devvp = devvp; udfmp->im_d2l = NULL; + udfmp->im_cp = cp; + udfmp->im_bo = bo; + #if 0 udfmp->im_l2d = NULL; #endif @@ -474,8 +477,6 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td) { brelse(bp); bp = NULL; - devvp->v_rdev->si_mountpoint = mp; - mtx_init(&udfmp->hash_mtx, "udf_hash", NULL, MTX_DEF); udfmp->hashtbl = phashinit(UDF_HASHTBLSIZE, M_UDFMOUNT, &udfmp->hashsz); @@ -486,8 +487,11 @@ bail: FREE(udfmp, M_UDFMOUNT); if (bp != NULL) brelse(bp); - if (needclose) - VOP_CLOSE(devvp, FREAD, NOCRED, td); + DROP_GIANT(); + g_topology_lock(); + g_wither_geom_close(cp->geom, ENXIO); + g_topology_unlock(); + PICKUP_GIANT(); return error; }; @@ -514,8 +518,7 @@ udf_unmount(struct mount *mp, int mntflags, struct thread *td) #endif } - udfmp->im_devvp->v_rdev->si_mountpoint = NULL; - error = VOP_CLOSE(udfmp->im_devvp, FREAD, NOCRED, td); + g_wither_geom_close(udfmp->im_cp->geom, ENXIO); vrele(udfmp->im_devvp); if (udfmp->s_table != NULL) diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c index d2ca71f..80f39ed 100644 --- a/sys/fs/udf/udf_vnops.c +++ b/sys/fs/udf/udf_vnops.c @@ -829,13 +829,12 @@ udf_strategy(struct vop_strategy_args *a) struct vnode *vp; struct udf_node *node; int maxsize; + struct bufobj *bo; bp = a->a_bp; vp = a->a_vp; node = VTON(vp); - KASSERT(a->a_vp == a->a_bp->b_vp, ("%s(%p != %p)", - __func__, a->a_vp, a->a_bp->b_vp)); /* cd9660 has this test reversed, but it seems more logical this way */ if (bp->b_blkno != bp->b_lblkno) { /* @@ -852,10 +851,9 @@ udf_strategy(struct vop_strategy_args *a) bufdone(bp); return (0); } - vp = node->i_devvp; - bp->b_dev = vp->v_rdev; + bo = node->udfmp->im_bo; bp->b_iooffset = dbtob(bp->b_blkno); - VOP_SPECSTRATEGY(vp, bp); + bo->bo_ops->bop_strategy(bo, bp); return (0); } |