Make a more whole-hearted attempt at GEOM'ifying NTFS.

I must have been sleepy when I did the first pass.

Spotted by:	tegge
This commit is contained in:
Poul-Henning Kamp 2004-11-03 21:36:41 +00:00
parent e0b687d33b
commit e1c6cbef33
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137172
3 changed files with 21 additions and 9 deletions

View File

@ -241,7 +241,8 @@ struct bootfile {
struct ntfsmount {
struct mount *ntm_mountp; /* filesystem vfs structure */
struct bootfile ntm_bootfile;
struct cdev *ntm_dev; /* device mounted */
struct g_consumer *ntm_cp;
struct bufobj *ntm_bo;
struct vnode *ntm_devvp; /* block device mounted vnode */
struct vnode *ntm_sysvn[NTFS_SYSNODESNUM];
u_int32_t ntm_bpmftrec;

View File

@ -382,7 +382,8 @@ ntfs_ntlookup(
dprintf(("ntfs_ntlookup: looking for ntnode %d\n", ino));
do {
if ((ip = ntfs_nthashlookup(ntmp->ntm_dev, ino)) != NULL) {
ip = ntfs_nthashlookup(ntmp->ntm_devvp->v_rdev, ino);
if (ip != NULL) {
ntfs_ntget(ip);
dprintf(("ntfs_ntlookup: ntnode %d: %p, usecount: %d\n",
ino, ip, ip->i_usecount));
@ -398,7 +399,6 @@ ntfs_ntlookup(
/* Generic initialization */
ip->i_devvp = ntmp->ntm_devvp;
ip->i_dev = ntmp->ntm_dev;
ip->i_number = ino;
ip->i_mp = ntmp;

View File

@ -43,6 +43,9 @@
#include <sys/malloc.h>
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_vfs.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_page.h>
@ -277,10 +280,15 @@ ntfs_mountfs(devvp, mp, argsp, td)
struct cdev *dev = devvp->v_rdev;
int error, ronly, i;
struct vnode *vp;
struct g_consumer *cp;
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td, -1);
DROP_GIANT();
g_topology_lock();
error = g_vfs_open(devvp, &cp, "ffs", ronly ? 0 : 1);
g_topology_unlock();
PICKUP_GIANT();
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);
@ -323,12 +331,13 @@ ntfs_mountfs(devvp, mp, argsp, td)
(u_int32_t)ntmp->ntm_mftcn,(u_int32_t)ntmp->ntm_mftmirrcn));
ntmp->ntm_mountp = mp;
ntmp->ntm_dev = dev;
ntmp->ntm_devvp = devvp;
ntmp->ntm_uid = argsp->uid;
ntmp->ntm_gid = argsp->gid;
ntmp->ntm_mode = argsp->mode;
ntmp->ntm_flag = argsp->flag;
ntmp->ntm_cp = cp;
ntmp->ntm_bo = &devvp->v_bufobj;
/* Copy in the 8-bit to Unicode conversion table */
/* Initialize Unicode to 8-bit table from 8toU table */
@ -456,7 +465,7 @@ ntfs_unmount(
struct thread *td)
{
struct ntfsmount *ntmp;
int error, ronly, flags, i;
int error, flags, i;
dprintf(("ntfs_unmount: unmounting...\n"));
ntmp = VFSTONTFS(mp);
@ -488,9 +497,11 @@ ntfs_unmount(
vinvalbuf(ntmp->ntm_devvp, V_SAVE, NOCRED, td, 0, 0);
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
error = VOP_CLOSE(ntmp->ntm_devvp, ronly ? FREAD : FREAD|FWRITE,
NOCRED, td);
DROP_GIANT();
g_topology_lock();
g_wither_geom_close(ntmp->ntm_cp->geom, ENXIO);
g_topology_unlock();
PICKUP_GIANT();
vrele(ntmp->ntm_devvp);