Deleted Added
full compact
ext2_vfsops.c (71999) ext2_vfsops.c (72200)
1/*
2 * modified for EXT2FS support in Lites 1.1
3 *
4 * Aug 1995, Godmar Back (gback@cs.utah.edu)
5 * University of Utah, Department of Computer Science
6 */
7/*
8 * Copyright (c) 1989, 1991, 1993, 1994

--- 23 unchanged lines hidden (view full) ---

32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94
1/*
2 * modified for EXT2FS support in Lites 1.1
3 *
4 * Aug 1995, Godmar Back (gback@cs.utah.edu)
5 * University of Utah, Department of Computer Science
6 */
7/*
8 * Copyright (c) 1989, 1991, 1993, 1994

--- 23 unchanged lines hidden (view full) ---

32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94
40 * $FreeBSD: head/sys/gnu/fs/ext2fs/ext2_vfsops.c 71999 2001-02-04 13:13:25Z phk $
40 * $FreeBSD: head/sys/gnu/fs/ext2fs/ext2_vfsops.c 72200 2001-02-09 06:11:45Z bmilekic $
41 */
42
43#include "opt_quota.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/namei.h>
48#include <sys/proc.h>

--- 507 unchanged lines hidden (view full) ---

556 }
557#ifdef UNKLAR
558 if (fs->fs_sbsize < SBSIZE)
559 bp->b_flags |= B_INVAL;
560#endif
561 brelse(bp);
562
563loop:
41 */
42
43#include "opt_quota.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/namei.h>
48#include <sys/proc.h>

--- 507 unchanged lines hidden (view full) ---

556 }
557#ifdef UNKLAR
558 if (fs->fs_sbsize < SBSIZE)
559 bp->b_flags |= B_INVAL;
560#endif
561 brelse(bp);
562
563loop:
564 mtx_enter(&mntvnode_mtx, MTX_DEF);
564 mtx_lock(&mntvnode_mtx);
565 for (vp = LIST_FIRST(&mountp->mnt_vnodelist); vp != NULL; vp = nvp) {
566 if (vp->v_mount != mountp) {
565 for (vp = LIST_FIRST(&mountp->mnt_vnodelist); vp != NULL; vp = nvp) {
566 if (vp->v_mount != mountp) {
567 mtx_exit(&mntvnode_mtx, MTX_DEF);
567 mtx_unlock(&mntvnode_mtx);
568 goto loop;
569 }
570 nvp = LIST_NEXT(vp, v_mntvnodes);
571 /*
572 * Step 4: invalidate all inactive vnodes.
573 */
574 if (vrecycle(vp, &mntvnode_mtx, p))
575 goto loop;
576 /*
577 * Step 5: invalidate all cached file data.
578 */
568 goto loop;
569 }
570 nvp = LIST_NEXT(vp, v_mntvnodes);
571 /*
572 * Step 4: invalidate all inactive vnodes.
573 */
574 if (vrecycle(vp, &mntvnode_mtx, p))
575 goto loop;
576 /*
577 * Step 5: invalidate all cached file data.
578 */
579 mtx_enter(&vp->v_interlock, MTX_DEF);
580 mtx_exit(&mntvnode_mtx, MTX_DEF);
579 mtx_lock(&vp->v_interlock);
580 mtx_unlock(&mntvnode_mtx);
581 if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) {
582 goto loop;
583 }
584 if (vinvalbuf(vp, 0, cred, p, 0, 0))
585 panic("ext2_reload: dirty2");
586 /*
587 * Step 6: re-read inode data for all active vnodes.
588 */

--- 5 unchanged lines hidden (view full) ---

594 vput(vp);
595 return (error);
596 }
597 ext2_ei2di((struct ext2_inode *) ((char *)bp->b_data +
598 EXT2_INODE_SIZE * ino_to_fsbo(fs, ip->i_number)),
599 &ip->i_din);
600 brelse(bp);
601 vput(vp);
581 if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) {
582 goto loop;
583 }
584 if (vinvalbuf(vp, 0, cred, p, 0, 0))
585 panic("ext2_reload: dirty2");
586 /*
587 * Step 6: re-read inode data for all active vnodes.
588 */

--- 5 unchanged lines hidden (view full) ---

594 vput(vp);
595 return (error);
596 }
597 ext2_ei2di((struct ext2_inode *) ((char *)bp->b_data +
598 EXT2_INODE_SIZE * ino_to_fsbo(fs, ip->i_number)),
599 &ip->i_din);
600 brelse(bp);
601 vput(vp);
602 mtx_enter(&mntvnode_mtx, MTX_DEF);
602 mtx_lock(&mntvnode_mtx);
603 }
603 }
604 mtx_exit(&mntvnode_mtx, MTX_DEF);
604 mtx_unlock(&mntvnode_mtx);
605 return (0);
606}
607
608/*
609 * Common code for mount and mountroot
610 */
611static int
612ext2_mountfs(devvp, mp, p)

--- 300 unchanged lines hidden (view full) ---

913 fs = ump->um_e2fs;
914 if (fs->s_dirt != 0 && fs->s_rd_only != 0) { /* XXX */
915 printf("fs = %s\n", fs->fs_fsmnt);
916 panic("ext2_sync: rofs mod");
917 }
918 /*
919 * Write back each (modified) inode.
920 */
605 return (0);
606}
607
608/*
609 * Common code for mount and mountroot
610 */
611static int
612ext2_mountfs(devvp, mp, p)

--- 300 unchanged lines hidden (view full) ---

913 fs = ump->um_e2fs;
914 if (fs->s_dirt != 0 && fs->s_rd_only != 0) { /* XXX */
915 printf("fs = %s\n", fs->fs_fsmnt);
916 panic("ext2_sync: rofs mod");
917 }
918 /*
919 * Write back each (modified) inode.
920 */
921 mtx_enter(&mntvnode_mtx, MTX_DEF);
921 mtx_lock(&mntvnode_mtx);
922loop:
923 for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nvp) {
924 /*
925 * If the vnode that we are about to sync is no longer
926 * associated with this mount point, start over.
927 */
928 if (vp->v_mount != mp)
929 goto loop;
922loop:
923 for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nvp) {
924 /*
925 * If the vnode that we are about to sync is no longer
926 * associated with this mount point, start over.
927 */
928 if (vp->v_mount != mp)
929 goto loop;
930 mtx_enter(&vp->v_interlock, MTX_DEF);
930 mtx_lock(&vp->v_interlock);
931 nvp = LIST_NEXT(vp, v_mntvnodes);
932 ip = VTOI(vp);
933 if (vp->v_type == VNON ||
934 ((ip->i_flag &
935 (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
936 (TAILQ_EMPTY(&vp->v_dirtyblkhd) || waitfor == MNT_LAZY))) {
931 nvp = LIST_NEXT(vp, v_mntvnodes);
932 ip = VTOI(vp);
933 if (vp->v_type == VNON ||
934 ((ip->i_flag &
935 (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
936 (TAILQ_EMPTY(&vp->v_dirtyblkhd) || waitfor == MNT_LAZY))) {
937 mtx_exit(&vp->v_interlock, MTX_DEF);
937 mtx_unlock(&vp->v_interlock);
938 continue;
939 }
938 continue;
939 }
940 mtx_exit(&mntvnode_mtx, MTX_DEF);
940 mtx_unlock(&mntvnode_mtx);
941 error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, p);
942 if (error) {
941 error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, p);
942 if (error) {
943 mtx_enter(&mntvnode_mtx, MTX_DEF);
943 mtx_lock(&mntvnode_mtx);
944 if (error == ENOENT)
945 goto loop;
946 continue;
947 }
948 if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0)
949 allerror = error;
950 VOP_UNLOCK(vp, 0, p);
951 vrele(vp);
944 if (error == ENOENT)
945 goto loop;
946 continue;
947 }
948 if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0)
949 allerror = error;
950 VOP_UNLOCK(vp, 0, p);
951 vrele(vp);
952 mtx_enter(&mntvnode_mtx, MTX_DEF);
952 mtx_lock(&mntvnode_mtx);
953 }
953 }
954 mtx_exit(&mntvnode_mtx, MTX_DEF);
954 mtx_unlock(&mntvnode_mtx);
955 /*
956 * Force stale file system control information to be flushed.
957 */
958 if (waitfor != MNT_LAZY) {
959 vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY, p);
960 if ((error = VOP_FSYNC(ump->um_devvp, cred, waitfor, p)) != 0)
961 allerror = error;
962 VOP_UNLOCK(ump->um_devvp, 0, p);

--- 241 unchanged lines hidden ---
955 /*
956 * Force stale file system control information to be flushed.
957 */
958 if (waitfor != MNT_LAZY) {
959 vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY, p);
960 if ((error = VOP_FSYNC(ump->um_devvp, cred, waitfor, p)) != 0)
961 allerror = error;
962 VOP_UNLOCK(ump->um_devvp, 0, p);

--- 241 unchanged lines hidden ---