Home | History | Annotate | Line # | Download | only in mfs
mfs_vfsops.c revision 1.75
      1  1.75  christos /*	$NetBSD: mfs_vfsops.c,v 1.75 2006/11/16 01:33:53 christos Exp $	*/
      2   1.2       cgd 
      3   1.1   mycroft /*
      4   1.1   mycroft  * Copyright (c) 1989, 1990, 1993, 1994
      5   1.1   mycroft  *	The Regents of the University of California.  All rights reserved.
      6   1.1   mycroft  *
      7   1.1   mycroft  * Redistribution and use in source and binary forms, with or without
      8   1.1   mycroft  * modification, are permitted provided that the following conditions
      9   1.1   mycroft  * are met:
     10   1.1   mycroft  * 1. Redistributions of source code must retain the above copyright
     11   1.1   mycroft  *    notice, this list of conditions and the following disclaimer.
     12   1.1   mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1   mycroft  *    notice, this list of conditions and the following disclaimer in the
     14   1.1   mycroft  *    documentation and/or other materials provided with the distribution.
     15  1.52       agc  * 3. Neither the name of the University nor the names of its contributors
     16   1.1   mycroft  *    may be used to endorse or promote products derived from this software
     17   1.1   mycroft  *    without specific prior written permission.
     18   1.1   mycroft  *
     19   1.1   mycroft  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20   1.1   mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21   1.1   mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22   1.1   mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23   1.1   mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24   1.1   mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25   1.1   mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26   1.1   mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27   1.1   mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28   1.1   mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29   1.1   mycroft  * SUCH DAMAGE.
     30   1.1   mycroft  *
     31  1.15      fvdl  *	@(#)mfs_vfsops.c	8.11 (Berkeley) 6/19/95
     32   1.1   mycroft  */
     33  1.36     lukem 
     34  1.36     lukem #include <sys/cdefs.h>
     35  1.75  christos __KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.75 2006/11/16 01:33:53 christos Exp $");
     36  1.17  jonathan 
     37  1.34       mrg #if defined(_KERNEL_OPT)
     38  1.17  jonathan #include "opt_compat_netbsd.h"
     39  1.17  jonathan #endif
     40   1.1   mycroft 
     41   1.1   mycroft #include <sys/param.h>
     42   1.1   mycroft #include <sys/systm.h>
     43  1.54    atatat #include <sys/sysctl.h>
     44   1.1   mycroft #include <sys/time.h>
     45   1.1   mycroft #include <sys/kernel.h>
     46   1.1   mycroft #include <sys/proc.h>
     47   1.1   mycroft #include <sys/buf.h>
     48  1.62      yamt #include <sys/bufq.h>
     49   1.1   mycroft #include <sys/mount.h>
     50   1.1   mycroft #include <sys/signalvar.h>
     51   1.1   mycroft #include <sys/vnode.h>
     52   1.1   mycroft #include <sys/malloc.h>
     53   1.1   mycroft 
     54  1.33   thorpej #include <miscfs/syncfs/syncfs.h>
     55  1.33   thorpej 
     56   1.1   mycroft #include <ufs/ufs/quota.h>
     57   1.1   mycroft #include <ufs/ufs/inode.h>
     58   1.1   mycroft #include <ufs/ufs/ufsmount.h>
     59   1.1   mycroft #include <ufs/ufs/ufs_extern.h>
     60   1.1   mycroft 
     61   1.1   mycroft #include <ufs/ffs/fs.h>
     62   1.1   mycroft #include <ufs/ffs/ffs_extern.h>
     63   1.1   mycroft 
     64   1.1   mycroft #include <ufs/mfs/mfsnode.h>
     65   1.1   mycroft #include <ufs/mfs/mfs_extern.h>
     66   1.1   mycroft 
     67   1.1   mycroft caddr_t	mfs_rootbase;	/* address of mini-root in kernel virtual memory */
     68   1.1   mycroft u_long	mfs_rootsize;	/* size of mini-root in bytes */
     69   1.1   mycroft 
     70   1.1   mycroft static	int mfs_minor;	/* used for building internal dev_t */
     71   1.1   mycroft 
     72  1.68   xtraeme extern int (**mfs_vnodeop_p)(void *);
     73  1.44   thorpej 
     74  1.44   thorpej MALLOC_DEFINE(M_MFSNODE, "MFS node", "MFS vnode private part");
     75   1.1   mycroft 
     76   1.1   mycroft /*
     77   1.1   mycroft  * mfs vfs operations.
     78   1.1   mycroft  */
     79  1.14   thorpej 
     80  1.65     perry extern const struct vnodeopv_desc mfs_vnodeop_opv_desc;
     81  1.14   thorpej 
     82  1.31  jdolecek const struct vnodeopv_desc * const mfs_vnodeopv_descs[] = {
     83  1.14   thorpej 	&mfs_vnodeop_opv_desc,
     84  1.14   thorpej 	NULL,
     85  1.14   thorpej };
     86  1.14   thorpej 
     87   1.1   mycroft struct vfsops mfs_vfsops = {
     88   1.1   mycroft 	MOUNT_MFS,
     89   1.1   mycroft 	mfs_mount,
     90   1.1   mycroft 	mfs_start,
     91   1.1   mycroft 	ffs_unmount,
     92   1.1   mycroft 	ufs_root,
     93   1.1   mycroft 	ufs_quotactl,
     94  1.56  christos 	mfs_statvfs,
     95   1.1   mycroft 	ffs_sync,
     96   1.1   mycroft 	ffs_vget,
     97   1.1   mycroft 	ffs_fhtovp,
     98   1.1   mycroft 	ffs_vptofh,
     99   1.1   mycroft 	mfs_init,
    100  1.35       chs 	mfs_reinit,
    101  1.23  jdolecek 	mfs_done,
    102  1.54    atatat 	NULL,
    103  1.60   hannken 	(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
    104  1.63   thorpej 	vfs_stdextattrctl,
    105  1.14   thorpej 	mfs_vnodeopv_descs,
    106  1.73  christos 	0,
    107  1.73  christos 	{ NULL, NULL },
    108   1.1   mycroft };
    109  1.66   thorpej VFS_ATTACH(mfs_vfsops);
    110  1.54    atatat 
    111  1.54    atatat SYSCTL_SETUP(sysctl_vfs_mfs_setup, "sysctl vfs.mfs subtree setup")
    112  1.54    atatat {
    113  1.54    atatat 
    114  1.55    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    115  1.55    atatat 		       CTLFLAG_PERMANENT,
    116  1.54    atatat 		       CTLTYPE_NODE, "vfs", NULL,
    117  1.54    atatat 		       NULL, 0, NULL, 0,
    118  1.54    atatat 		       CTL_VFS, CTL_EOL);
    119  1.55    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    120  1.55    atatat 		       CTLFLAG_PERMANENT|CTLFLAG_ALIAS,
    121  1.59    atatat 		       CTLTYPE_NODE, "mfs",
    122  1.59    atatat 		       SYSCTL_DESCR("Memory based file system"),
    123  1.54    atatat 		       NULL, 1, NULL, 0,
    124  1.54    atatat 		       CTL_VFS, 3, CTL_EOL);
    125  1.54    atatat 	/*
    126  1.54    atatat 	 * XXX the "1" and the "3" above could be dynamic, thereby
    127  1.54    atatat 	 * eliminating one more instance of the "number to vfs"
    128  1.54    atatat 	 * mapping problem, but they are in order as taken from
    129  1.54    atatat 	 * sys/mount.h
    130  1.54    atatat 	 */
    131  1.54    atatat }
    132   1.1   mycroft 
    133  1.65     perry /*
    134  1.15      fvdl  * Memory based filesystem initialization.
    135  1.65     perry  */
    136  1.15      fvdl void
    137  1.68   xtraeme mfs_init(void)
    138  1.15      fvdl {
    139  1.48  christos #ifdef _LKM
    140  1.48  christos 	malloc_type_attach(M_MFSNODE);
    141  1.48  christos #endif
    142  1.23  jdolecek 	/*
    143  1.23  jdolecek 	 * ffs_init() ensures to initialize necessary resources
    144  1.23  jdolecek 	 * only once.
    145  1.23  jdolecek 	 */
    146  1.23  jdolecek 	ffs_init();
    147  1.35       chs }
    148  1.35       chs 
    149  1.35       chs void
    150  1.68   xtraeme mfs_reinit(void)
    151  1.35       chs {
    152  1.35       chs 	ffs_reinit();
    153  1.15      fvdl }
    154  1.15      fvdl 
    155  1.23  jdolecek void
    156  1.68   xtraeme mfs_done(void)
    157  1.23  jdolecek {
    158  1.23  jdolecek 	/*
    159  1.23  jdolecek 	 * ffs_done() ensures to free necessary resources
    160  1.23  jdolecek 	 * only once, when it's no more needed.
    161  1.23  jdolecek 	 */
    162  1.23  jdolecek 	ffs_done();
    163  1.48  christos #ifdef _LKM
    164  1.48  christos 	malloc_type_detach(M_MFSNODE);
    165  1.48  christos #endif
    166  1.23  jdolecek }
    167  1.15      fvdl 
    168   1.1   mycroft /*
    169   1.1   mycroft  * Called by main() when mfs is going to be mounted as root.
    170   1.1   mycroft  */
    171   1.1   mycroft 
    172  1.10  christos int
    173  1.68   xtraeme mfs_mountroot(void)
    174   1.1   mycroft {
    175  1.15      fvdl 	struct fs *fs;
    176  1.15      fvdl 	struct mount *mp;
    177  1.71  christos 	struct lwp *l = curlwp;		/* XXX */
    178   1.1   mycroft 	struct ufsmount *ump;
    179   1.1   mycroft 	struct mfsnode *mfsp;
    180  1.15      fvdl 	int error = 0;
    181   1.1   mycroft 
    182  1.21  wrstuden 	if ((error = vfs_rootmountalloc(MOUNT_MFS, "mfs_root", &mp))) {
    183  1.21  wrstuden 		vrele(rootvp);
    184  1.15      fvdl 		return (error);
    185  1.21  wrstuden 	}
    186   1.1   mycroft 
    187   1.1   mycroft 	mfsp = malloc(sizeof *mfsp, M_MFSNODE, M_WAITOK);
    188   1.1   mycroft 	rootvp->v_data = mfsp;
    189   1.1   mycroft 	rootvp->v_op = mfs_vnodeop_p;
    190   1.1   mycroft 	rootvp->v_tag = VT_MFS;
    191   1.1   mycroft 	mfsp->mfs_baseoff = mfs_rootbase;
    192   1.1   mycroft 	mfsp->mfs_size = mfs_rootsize;
    193   1.1   mycroft 	mfsp->mfs_vnode = rootvp;
    194  1.26   thorpej 	mfsp->mfs_proc = NULL;		/* indicate kernel space */
    195  1.39   hannken 	mfsp->mfs_shutdown = 0;
    196  1.70      yamt 	bufq_alloc(&mfsp->mfs_buflist, "fcfs", 0);
    197  1.71  christos 	if ((error = ffs_mountfs(rootvp, mp, l)) != 0) {
    198  1.15      fvdl 		mp->mnt_op->vfs_refcount--;
    199  1.15      fvdl 		vfs_unbusy(mp);
    200  1.70      yamt 		bufq_free(mfsp->mfs_buflist);
    201   1.1   mycroft 		free(mp, M_MOUNT);
    202   1.1   mycroft 		free(mfsp, M_MFSNODE);
    203   1.1   mycroft 		return (error);
    204  1.65     perry 	}
    205  1.15      fvdl 	simple_lock(&mountlist_slock);
    206   1.4   mycroft 	CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
    207  1.15      fvdl 	simple_unlock(&mountlist_slock);
    208   1.1   mycroft 	mp->mnt_vnodecovered = NULLVP;
    209   1.1   mycroft 	ump = VFSTOUFS(mp);
    210   1.1   mycroft 	fs = ump->um_fs;
    211  1.15      fvdl 	(void) copystr(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN - 1, 0);
    212  1.71  christos 	(void)ffs_statvfs(mp, &mp->mnt_stat, l);
    213  1.15      fvdl 	vfs_unbusy(mp);
    214   1.1   mycroft 	return (0);
    215   1.1   mycroft }
    216   1.1   mycroft 
    217   1.1   mycroft /*
    218   1.1   mycroft  * This is called early in boot to set the base address and size
    219   1.1   mycroft  * of the mini-root.
    220   1.1   mycroft  */
    221  1.10  christos int
    222  1.68   xtraeme mfs_initminiroot(caddr_t base)
    223   1.1   mycroft {
    224  1.45      fvdl 	struct fs *fs = (struct fs *)(base + SBLOCK_UFS1);
    225   1.1   mycroft 
    226   1.1   mycroft 	/* check for valid super block */
    227  1.45      fvdl 	if (fs->fs_magic != FS_UFS1_MAGIC || fs->fs_bsize > MAXBSIZE ||
    228   1.1   mycroft 	    fs->fs_bsize < sizeof(struct fs))
    229   1.1   mycroft 		return (0);
    230   1.1   mycroft 	mountroot = mfs_mountroot;
    231   1.1   mycroft 	mfs_rootbase = base;
    232   1.1   mycroft 	mfs_rootsize = fs->fs_fsize * fs->fs_size;
    233  1.32       cgd 	rootdev = makedev(255, mfs_minor);
    234  1.32       cgd 	mfs_minor++;
    235   1.1   mycroft 	return (mfs_rootsize);
    236   1.1   mycroft }
    237   1.1   mycroft 
    238   1.1   mycroft /*
    239   1.1   mycroft  * VFS Operations.
    240   1.1   mycroft  *
    241   1.1   mycroft  * mount system call
    242   1.1   mycroft  */
    243   1.1   mycroft /* ARGSUSED */
    244   1.1   mycroft int
    245  1.68   xtraeme mfs_mount(struct mount *mp, const char *path, void *data,
    246  1.75  christos     struct nameidata *ndp, struct lwp *l)
    247   1.1   mycroft {
    248   1.1   mycroft 	struct vnode *devvp;
    249   1.1   mycroft 	struct mfs_args args;
    250   1.1   mycroft 	struct ufsmount *ump;
    251  1.25  augustss 	struct fs *fs;
    252  1.25  augustss 	struct mfsnode *mfsp;
    253  1.71  christos 	struct proc *p;
    254   1.1   mycroft 	int flags, error;
    255  1.37       chs 
    256  1.71  christos 	p = l->l_proc;
    257  1.41  christos 	if (mp->mnt_flag & MNT_GETARGS) {
    258  1.41  christos 		struct vnode *vp;
    259  1.41  christos 
    260  1.41  christos 		ump = VFSTOUFS(mp);
    261  1.41  christos 		if (ump == NULL)
    262  1.41  christos 			return EIO;
    263  1.41  christos 
    264  1.41  christos 		vp = ump->um_devvp;
    265  1.41  christos 		if (vp == NULL)
    266  1.41  christos 			return EIO;
    267  1.41  christos 
    268  1.41  christos 		mfsp = VTOMFS(vp);
    269  1.41  christos 		if (mfsp == NULL)
    270  1.41  christos 			return EIO;
    271  1.41  christos 
    272  1.41  christos 		args.fspec = NULL;
    273  1.41  christos 		args.base = mfsp->mfs_baseoff;
    274  1.41  christos 		args.size = mfsp->mfs_size;
    275  1.41  christos 		return copyout(&args, data, sizeof(args));
    276  1.41  christos 	}
    277  1.37       chs 	/*
    278  1.37       chs 	 * XXX turn off async to avoid hangs when writing lots of data.
    279  1.37       chs 	 * the problem is that MFS needs to allocate pages to clean pages,
    280  1.37       chs 	 * so if we wait until the last minute to clean pages then there
    281  1.37       chs 	 * may not be any pages available to do the cleaning.
    282  1.42       chs 	 * ... and since the default partially-synchronous mode turns out
    283  1.42       chs 	 * to not be sufficient under heavy load, make it full synchronous.
    284  1.37       chs 	 */
    285  1.37       chs 	mp->mnt_flag &= ~MNT_ASYNC;
    286  1.42       chs 	mp->mnt_flag |= MNT_SYNCHRONOUS;
    287   1.1   mycroft 
    288  1.10  christos 	error = copyin(data, (caddr_t)&args, sizeof (struct mfs_args));
    289  1.10  christos 	if (error)
    290   1.1   mycroft 		return (error);
    291   1.1   mycroft 
    292   1.1   mycroft 	/*
    293   1.1   mycroft 	 * If updating, check whether changing from read-only to
    294   1.1   mycroft 	 * read/write; if there is no device name, that's all we do.
    295   1.1   mycroft 	 */
    296   1.1   mycroft 	if (mp->mnt_flag & MNT_UPDATE) {
    297   1.1   mycroft 		ump = VFSTOUFS(mp);
    298   1.1   mycroft 		fs = ump->um_fs;
    299   1.1   mycroft 		if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
    300   1.1   mycroft 			flags = WRITECLOSE;
    301   1.1   mycroft 			if (mp->mnt_flag & MNT_FORCE)
    302   1.1   mycroft 				flags |= FORCECLOSE;
    303  1.71  christos 			error = ffs_flushfiles(mp, flags, l);
    304   1.1   mycroft 			if (error)
    305   1.1   mycroft 				return (error);
    306   1.1   mycroft 		}
    307  1.53       dbj 		if (fs->fs_ronly && (mp->mnt_iflag & IMNT_WANTRDWR))
    308   1.1   mycroft 			fs->fs_ronly = 0;
    309  1.69      jmmv 		if (args.fspec == NULL)
    310  1.69      jmmv 			return EINVAL;
    311   1.1   mycroft 		return (0);
    312   1.1   mycroft 	}
    313   1.1   mycroft 	error = getnewvnode(VT_MFS, (struct mount *)0, mfs_vnodeop_p, &devvp);
    314   1.1   mycroft 	if (error)
    315   1.1   mycroft 		return (error);
    316   1.1   mycroft 	devvp->v_type = VBLK;
    317  1.32       cgd 	if (checkalias(devvp, makedev(255, mfs_minor), (struct mount *)0))
    318   1.1   mycroft 		panic("mfs_mount: dup dev");
    319  1.32       cgd 	mfs_minor++;
    320   1.1   mycroft 	mfsp = (struct mfsnode *)malloc(sizeof *mfsp, M_MFSNODE, M_WAITOK);
    321   1.1   mycroft 	devvp->v_data = mfsp;
    322   1.1   mycroft 	mfsp->mfs_baseoff = args.base;
    323   1.1   mycroft 	mfsp->mfs_size = args.size;
    324   1.1   mycroft 	mfsp->mfs_vnode = devvp;
    325  1.26   thorpej 	mfsp->mfs_proc = p;
    326  1.39   hannken 	mfsp->mfs_shutdown = 0;
    327  1.70      yamt 	bufq_alloc(&mfsp->mfs_buflist, "fcfs", 0);
    328  1.71  christos 	if ((error = ffs_mountfs(devvp, mp, l)) != 0) {
    329  1.39   hannken 		mfsp->mfs_shutdown = 1;
    330   1.1   mycroft 		vrele(devvp);
    331   1.1   mycroft 		return (error);
    332   1.1   mycroft 	}
    333   1.1   mycroft 	ump = VFSTOUFS(mp);
    334   1.1   mycroft 	fs = ump->um_fs;
    335  1.56  christos 	error = set_statvfs_info(path, UIO_USERSPACE, args.fspec,
    336  1.71  christos 	    UIO_USERSPACE, mp, l);
    337  1.58  christos 	if (error)
    338  1.58  christos 		return error;
    339  1.58  christos 	(void)strncpy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname,
    340  1.58  christos 		sizeof(fs->fs_fsmnt));
    341  1.58  christos 	fs->fs_fsmnt[sizeof(fs->fs_fsmnt) - 1] = '\0';
    342  1.57     enami 	/* XXX: cleanup on error */
    343  1.58  christos 	return 0;
    344   1.1   mycroft }
    345   1.1   mycroft 
    346   1.1   mycroft int	mfs_pri = PWAIT | PCATCH;		/* XXX prob. temp */
    347   1.1   mycroft 
    348   1.1   mycroft /*
    349   1.1   mycroft  * Used to grab the process and keep it in the kernel to service
    350   1.1   mycroft  * memory filesystem I/O requests.
    351   1.1   mycroft  *
    352  1.28   thorpej  * Loop servicing I/O requests.
    353  1.28   thorpej  * Copy the requested data into or out of the memory filesystem
    354  1.28   thorpej  * address space.
    355   1.1   mycroft  */
    356   1.1   mycroft /* ARGSUSED */
    357   1.1   mycroft int
    358  1.75  christos mfs_start(struct mount *mp, int flags, struct lwp *l)
    359   1.1   mycroft {
    360  1.25  augustss 	struct vnode *vp = VFSTOUFS(mp)->um_devvp;
    361  1.25  augustss 	struct mfsnode *mfsp = VTOMFS(vp);
    362  1.28   thorpej 	struct buf *bp;
    363  1.28   thorpej 	caddr_t base;
    364  1.15      fvdl 	int sleepreturn = 0;
    365   1.1   mycroft 
    366  1.28   thorpej 	base = mfsp->mfs_baseoff;
    367  1.39   hannken 	while (mfsp->mfs_shutdown != 1) {
    368  1.70      yamt 		while ((bp = BUFQ_GET(mfsp->mfs_buflist)) != NULL) {
    369  1.30    simonb 			mfs_doio(bp, base);
    370  1.30    simonb 			wakeup((caddr_t)bp);
    371  1.30    simonb 		}
    372   1.1   mycroft 		/*
    373   1.1   mycroft 		 * If a non-ignored signal is received, try to unmount.
    374  1.15      fvdl 		 * If that fails, or the filesystem is already in the
    375  1.15      fvdl 		 * process of being unmounted, clear the signal (it has been
    376  1.15      fvdl 		 * "processed"), otherwise we will loop here, as tsleep
    377  1.15      fvdl 		 * will always return EINTR/ERESTART.
    378   1.1   mycroft 		 */
    379  1.15      fvdl 		if (sleepreturn != 0) {
    380  1.33   thorpej 			/*
    381  1.33   thorpej 			 * XXX Freeze syncer.  Must do this before locking
    382  1.33   thorpej 			 * the mount point.  See dounmount() for details.
    383  1.33   thorpej 			 */
    384  1.33   thorpej 			lockmgr(&syncer_lock, LK_EXCLUSIVE, NULL);
    385  1.33   thorpej 			if (vfs_busy(mp, LK_NOWAIT, 0) != 0)
    386  1.33   thorpej 				lockmgr(&syncer_lock, LK_RELEASE, NULL);
    387  1.71  christos 			else if (dounmount(mp, 0, l) != 0)
    388  1.72  christos 				CLRSIG(l);
    389  1.15      fvdl 			sleepreturn = 0;
    390  1.12      fvdl 			continue;
    391   1.9   mycroft 		}
    392  1.28   thorpej 
    393  1.28   thorpej 		sleepreturn = tsleep(vp, mfs_pri, "mfsidl", 0);
    394   1.1   mycroft 	}
    395  1.70      yamt 	KASSERT(BUFQ_PEEK(mfsp->mfs_buflist) == NULL);
    396  1.70      yamt 	bufq_free(mfsp->mfs_buflist);
    397  1.15      fvdl 	return (sleepreturn);
    398   1.1   mycroft }
    399   1.1   mycroft 
    400   1.1   mycroft /*
    401   1.1   mycroft  * Get file system statistics.
    402   1.1   mycroft  */
    403  1.10  christos int
    404  1.71  christos mfs_statvfs(struct mount *mp, struct statvfs *sbp, struct lwp *l)
    405   1.1   mycroft {
    406   1.1   mycroft 	int error;
    407   1.1   mycroft 
    408  1.71  christos 	error = ffs_statvfs(mp, sbp, l);
    409  1.58  christos 	if (error)
    410  1.58  christos 		return error;
    411  1.58  christos 	(void)strncpy(sbp->f_fstypename, mp->mnt_op->vfs_name,
    412  1.58  christos 	    sizeof(sbp->f_fstypename));
    413  1.58  christos 	sbp->f_fstypename[sizeof(sbp->f_fstypename) - 1] = '\0';
    414  1.58  christos 	return 0;
    415   1.1   mycroft }
    416