ffs_vfsops.c (16312) | ffs_vfsops.c (17761) |
---|---|
1/* 2 * Copyright (c) 1989, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94 | 1/* 2 * Copyright (c) 1989, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94 |
34 * $Id: ffs_vfsops.c,v 1.38 1996/03/02 22:18:34 dyson Exp $ | 34 * $Id: ffs_vfsops.c,v 1.39 1996/06/12 03:37:51 davidg Exp $ |
35 */ 36 37#include "opt_quota.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/namei.h> 42#include <sys/proc.h> --- 19 unchanged lines hidden (view full) --- 62#include <ufs/ffs/fs.h> 63#include <ufs/ffs/ffs_extern.h> 64 65#include <vm/vm.h> 66#include <vm/vm_param.h> 67#include <vm/vm_prot.h> 68#include <vm/vm_page.h> 69#include <vm/vm_object.h> | 35 */ 36 37#include "opt_quota.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/namei.h> 42#include <sys/proc.h> --- 19 unchanged lines hidden (view full) --- 62#include <ufs/ffs/fs.h> 63#include <ufs/ffs/ffs_extern.h> 64 65#include <vm/vm.h> 66#include <vm/vm_param.h> 67#include <vm/vm_prot.h> 68#include <vm/vm_page.h> 69#include <vm/vm_object.h> |
70#include <vm/vm_extern.h> |
|
70 71static int ffs_sbupdate __P((struct ufsmount *, int)); 72static int ffs_reload __P((struct mount *,struct ucred *,struct proc *)); 73static int ffs_oldfscompat __P((struct fs *)); 74static int ffs_mount __P((struct mount *, 75 char *, caddr_t, struct nameidata *, struct proc *)); 76 77struct vfsops ufs_vfsops = { --- 385 unchanged lines hidden (view full) --- 463 register struct fs *fs; 464 dev_t dev = devvp->v_rdev; 465 struct partinfo dpart; 466 caddr_t base, space; 467 int havepart = 0, blks; 468 int error, i, size; 469 int ronly; 470 u_int strsize; | 71 72static int ffs_sbupdate __P((struct ufsmount *, int)); 73static int ffs_reload __P((struct mount *,struct ucred *,struct proc *)); 74static int ffs_oldfscompat __P((struct fs *)); 75static int ffs_mount __P((struct mount *, 76 char *, caddr_t, struct nameidata *, struct proc *)); 77 78struct vfsops ufs_vfsops = { --- 385 unchanged lines hidden (view full) --- 464 register struct fs *fs; 465 dev_t dev = devvp->v_rdev; 466 struct partinfo dpart; 467 caddr_t base, space; 468 int havepart = 0, blks; 469 int error, i, size; 470 int ronly; 471 u_int strsize; |
472 int ncount; |
|
471 472 /* 473 * Disallow multiple mounts of the same device. 474 * Disallow mounting of a device that is currently in use 475 * (except for root, which might share swap device for miniroot). 476 * Flush out any old buffers remaining from a previous use. 477 */ 478 error = vfs_mountedon(devvp); 479 if (error) 480 return (error); | 473 474 /* 475 * Disallow multiple mounts of the same device. 476 * Disallow mounting of a device that is currently in use 477 * (except for root, which might share swap device for miniroot). 478 * Flush out any old buffers remaining from a previous use. 479 */ 480 error = vfs_mountedon(devvp); 481 if (error) 482 return (error); |
481 if (vcount(devvp) > 1 && devvp != rootvp) | 483 ncount = vcount(devvp); 484 if (devvp->v_object) 485 ncount -= 1; 486 if (ncount > 1 && devvp != rootvp) |
482 return (EBUSY); 483 error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0); 484 if (error) 485 return (error); 486 487 ronly = (mp->mnt_flag & MNT_RDONLY) != 0; 488 error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p); 489 if (error) --- 92 unchanged lines hidden (view full) --- 582 */ 583 mp->mnt_time = fs->fs_time; 584 } 585 if (ronly == 0) 586 ffs_sbupdate(ump, MNT_WAIT); 587 /* 588 * Only VMIO the backing device if the backing device is a real 589 * block device. This excludes the original MFS implementation. | 487 return (EBUSY); 488 error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0); 489 if (error) 490 return (error); 491 492 ronly = (mp->mnt_flag & MNT_RDONLY) != 0; 493 error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p); 494 if (error) --- 92 unchanged lines hidden (view full) --- 587 */ 588 mp->mnt_time = fs->fs_time; 589 } 590 if (ronly == 0) 591 ffs_sbupdate(ump, MNT_WAIT); 592 /* 593 * Only VMIO the backing device if the backing device is a real 594 * block device. This excludes the original MFS implementation. |
595 * Note that it is optional that the backing device be VMIOed. This 596 * increases the opportunity for metadata caching. |
|
590 */ 591 if ((devvp->v_type == VBLK) && (major(devvp->v_rdev) < nblkdev)) { | 597 */ 598 if ((devvp->v_type == VBLK) && (major(devvp->v_rdev) < nblkdev)) { |
592 vn_vmio_open(devvp, p, p->p_ucred); | 599 vfs_object_create(devvp, p, p->p_ucred, 0); |
593 } 594 return (0); 595out: 596 if (bp) 597 brelse(bp); 598 (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p); 599 if (ump) { 600 free(ump->um_fs, M_UFSMNT); --- 57 unchanged lines hidden (view full) --- 658 ump = VFSTOUFS(mp); 659 fs = ump->um_fs; 660 ronly = fs->fs_ronly; 661 if (!ronly) { 662 fs->fs_clean = 1; 663 ffs_sbupdate(ump, MNT_WAIT); 664 } 665 ump->um_devvp->v_specflags &= ~SI_MOUNTEDON; | 600 } 601 return (0); 602out: 603 if (bp) 604 brelse(bp); 605 (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p); 606 if (ump) { 607 free(ump->um_fs, M_UFSMNT); --- 57 unchanged lines hidden (view full) --- 665 ump = VFSTOUFS(mp); 666 fs = ump->um_fs; 667 ronly = fs->fs_ronly; 668 if (!ronly) { 669 fs->fs_clean = 1; 670 ffs_sbupdate(ump, MNT_WAIT); 671 } 672 ump->um_devvp->v_specflags &= ~SI_MOUNTEDON; |
673 674 vnode_pager_uncache(ump->um_devvp); 675 |
|
666 error = VOP_CLOSE(ump->um_devvp, ronly ? FREAD : FREAD|FWRITE, 667 NOCRED, p); | 676 error = VOP_CLOSE(ump->um_devvp, ronly ? FREAD : FREAD|FWRITE, 677 NOCRED, p); |
668 vn_vmio_close(ump->um_devvp); | 678 679 vrele(ump->um_devvp); 680 |
669 free(fs->fs_csp[0], M_UFSMNT); 670 free(fs, M_UFSMNT); 671 free(ump, M_UFSMNT); 672 mp->mnt_data = (qaddr_t)0; 673 mp->mnt_flag &= ~MNT_LOCAL; 674 return (error); 675} 676 --- 384 unchanged lines hidden --- | 681 free(fs->fs_csp[0], M_UFSMNT); 682 free(fs, M_UFSMNT); 683 free(ump, M_UFSMNT); 684 mp->mnt_data = (qaddr_t)0; 685 mp->mnt_flag &= ~MNT_LOCAL; 686 return (error); 687} 688 --- 384 unchanged lines hidden --- |