diff options
-rw-r--r-- | sbin/mount/mount.c | 4 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_alloc.c | 4 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 39 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 15 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 3 | ||||
-rw-r--r-- | sys/ufs/ufs/inode.h | 8 |
6 files changed, 36 insertions, 37 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 61d1747..6e8f3b5 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -317,7 +317,7 @@ main(int argc, char *argv[]) rval = 0; switch (argc) { case 0: - if ((mntsize = getmntinfo(&mntbuf, MNT_WAIT)) == 0) + if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) err(1, "getmntinfo"); if (all) { while ((fs = getfsent()) != NULL) { @@ -666,7 +666,7 @@ getmntpt(const char *name) struct statfs *mntbuf; int i, mntsize; - mntsize = getmntinfo(&mntbuf, MNT_WAIT); + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); for (i = mntsize - 1; i >= 0; i--) { if (strcmp(mntbuf[i].f_mntfromname, name) == 0 || strcmp(mntbuf[i].f_mntonname, name) == 0) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 283db17..f6d0366 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1967,7 +1967,7 @@ ffs_blkfree_cg(ump, fs, devvp, bno, size, inum, dephd) ACTIVECLEAR(fs, cg); UFS_UNLOCK(ump); mp = UFSTOVFS(ump); - if (mp->mnt_flag & MNT_SOFTDEP && devvp->v_type != VREG) + if (MOUNTEDSOFTDEP(mp) && devvp->v_type != VREG) softdep_setup_blkfree(UFSTOVFS(ump), bp, bno, numfrags(fs, size), dephd); bdwrite(bp); @@ -2217,7 +2217,7 @@ ffs_freefile(ump, fs, devvp, ino, mode, wkhd) fs->fs_fmod = 1; ACTIVECLEAR(fs, cg); UFS_UNLOCK(ump); - if (UFSTOVFS(ump)->mnt_flag & MNT_SOFTDEP && devvp->v_type != VREG) + if (MOUNTEDSOFTDEP(UFSTOVFS(ump)) && devvp->v_type != VREG) softdep_setup_inofree(UFSTOVFS(ump), bp, ino + cg * fs->fs_ipg, wkhd); bdwrite(bp); diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 8f1923a..58d8ba9 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1364,7 +1364,7 @@ softdep_flush(void) mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { nmp = TAILQ_NEXT(mp, mnt_list); - if ((mp->mnt_flag & MNT_SOFTDEP) == 0) + if (MOUNTEDSOFTDEP(mp) == 0) continue; if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) continue; @@ -2423,7 +2423,7 @@ softdep_unmount(mp) MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_SOFTDEP; - if ((mp->mnt_flag & MNT_SUJ) == 0) { + if (MOUNTEDSUJ(mp) == 0) { MNT_IUNLOCK(mp); return; } @@ -2638,6 +2638,7 @@ out: if (error == 0) { MNT_ILOCK(mp); mp->mnt_flag |= MNT_SUJ; + mp->mnt_flag &= ~MNT_SOFTDEP; MNT_IUNLOCK(mp); /* * Only validate the journal contents if the @@ -3060,7 +3061,7 @@ softdep_flushjournal(mp) struct jblocks *jblocks; struct ufsmount *ump; - if ((mp->mnt_flag & MNT_SUJ) == 0) + if (MOUNTEDSUJ(mp) == 0) return; ump = VFSTOUFS(mp); jblocks = ump->softdep_jblocks; @@ -3096,7 +3097,7 @@ softdep_process_journal(mp, needwk, flags) int off; int devbsize; - if ((mp->mnt_flag & MNT_SUJ) == 0) + if (MOUNTEDSUJ(mp) == 0) return; ump = VFSTOUFS(mp); fs = ump->um_fs; @@ -3827,8 +3828,8 @@ newfreework(ump, freeblks, parent, lbn, nb, frags, off, journal) freework->fw_blkno = nb; freework->fw_frags = frags; freework->fw_indir = NULL; - freework->fw_ref = ((UFSTOVFS(ump)->mnt_flag & MNT_SUJ) == 0 || - lbn >= -NXADDR) ? 0 : NINDIR(ump->um_fs) + 1; + freework->fw_ref = (MOUNTEDSUJ(UFSTOVFS(ump)) == 0 || lbn >= -NXADDR) + ? 0 : NINDIR(ump->um_fs) + 1; freework->fw_start = freework->fw_off = off; if (journal) newjfreeblk(freeblks, lbn, nb, frags); @@ -4681,7 +4682,7 @@ softdep_setup_inomapdep(bp, ip, newinum, mode) * Allocate the journal reference add structure so that the bitmap * can be dependent on it. */ - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { jaddref = newjaddref(ip, newinum, 0, 0, mode); jaddref->ja_state |= NEWBLOCK; } @@ -4734,7 +4735,7 @@ softdep_setup_blkmapdep(bp, mp, newblkno, frags, oldfrags) * Add it to the dependency list for the buffer holding * the cylinder group map from which it was allocated. */ - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { jnewblk = malloc(sizeof(*jnewblk), M_JNEWBLK, M_SOFTDEP_FLAGS); workitem_alloc(&jnewblk->jn_list, D_JNEWBLK, mp); jnewblk->jn_jsegdep = newjsegdep(&jnewblk->jn_list); @@ -5199,7 +5200,7 @@ newfreefrag(ip, blkno, size, lbn) freefrag->ff_blkno = blkno; freefrag->ff_fragsize = size; - if ((ip->i_ump->um_mountp->mnt_flag & MNT_SUJ) != 0) { + if (MOUNTEDSUJ(UFSTOVFS(ip->i_ump))) { freefrag->ff_jdep = (struct worklist *) newjfreefrag(freefrag, ip, blkno, size, lbn); } else { @@ -7254,7 +7255,7 @@ freework_freeblock(freework) freeblks = freework->fw_freeblks; ump = VFSTOUFS(freeblks->fb_list.wk_mp); fs = ump->um_fs; - needj = (freeblks->fb_list.wk_mp->mnt_flag & MNT_SUJ) != 0; + needj = MOUNTEDSUJ(freeblks->fb_list.wk_mp) != 0; bsize = lfragtosize(fs, freework->fw_frags); LIST_INIT(&wkhd); /* @@ -7674,7 +7675,7 @@ indir_trunc(freework, dbn, lbn) ufs1fmt = 0; } level = lbn_level(lbn); - needj = (UFSTOVFS(ump)->mnt_flag & MNT_SUJ) != 0; + needj = MOUNTEDSUJ(UFSTOVFS(ump)) != 0; lbnadd = lbn_offset(fs, level); nblocks = btodb(fs->fs_bsize); nfreework = freework; @@ -7860,7 +7861,7 @@ setup_newdir(dap, newinum, dinum, newdirbp, mkdirp) mkdir2->md_state = ATTACHED | MKDIR_PARENT; mkdir2->md_diradd = dap; mkdir2->md_jaddref = NULL; - if ((mp->mnt_flag & MNT_SUJ) == 0) { + if (MOUNTEDSUJ(mp) == 0) { mkdir1->md_state |= DEPCOMPLETE; mkdir2->md_state |= DEPCOMPLETE; } @@ -7900,7 +7901,7 @@ setup_newdir(dap, newinum, dinum, newdirbp, mkdirp) * been satisfied and mkdir2 can be freed. */ inodedep_lookup(mp, dinum, 0, &inodedep); - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { if (inodedep == NULL) panic("setup_newdir: Lost parent."); jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, @@ -8031,7 +8032,7 @@ softdep_setup_directory_add(bp, dp, diroffset, newinum, newdirbp, isnewblk) * written place it on the bufwait list, otherwise do the post-inode * write processing to put it on the id_pendinghd list. */ - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, inoreflst); KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number, @@ -8047,7 +8048,7 @@ softdep_setup_directory_add(bp, dp, diroffset, newinum, newdirbp, isnewblk) * Add the journal entries for . and .. links now that the primary * link is written. */ - if (mkdir1 != NULL && (mp->mnt_flag & MNT_SUJ)) { + if (mkdir1 != NULL && MOUNTEDSUJ(mp)) { jaddref = (struct jaddref *)TAILQ_PREV(&jaddref->ja_ref, inoreflst, if_deps); KASSERT(jaddref != NULL && @@ -8144,7 +8145,7 @@ softdep_change_directoryentry_offset(bp, dp, base, oldloc, newloc, entrysize) * determine if any affected adds or removes are present in the * journal. */ - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { flags = DEPALLOC; jmvref = newjmvref(dp, de->d_ino, dp->i_offset + (oldloc - base), @@ -8865,7 +8866,7 @@ softdep_setup_directory_change(bp, dp, ip, newinum, isrmdir) * processing to put it on the id_pendinghd list. */ inodedep_lookup(mp, newinum, DEPALLOC, &inodedep); - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, inoreflst); KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number, @@ -8928,7 +8929,7 @@ softdep_setup_sbupdate(ump, fs, bp) struct sbdep *sbdep; struct worklist *wk; - if ((ump->um_mountp->mnt_flag & MNT_SUJ) == 0) + if (MOUNTEDSUJ(UFSTOVFS(ump)) == 0) return; LIST_FOREACH(wk, &bp->b_dep, wk_list) if (wk->wk_type == D_SBDEP) @@ -9046,7 +9047,7 @@ unlinked_inodedep(mp, inodedep) { struct ufsmount *ump; - if ((mp->mnt_flag & MNT_SUJ) == 0) + if (MOUNTEDSUJ(mp) == 0) return; ump = VFSTOUFS(mp); ump->um_fs->fs_fmod = 1; diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 7f57c84..4f688a2 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -281,7 +281,7 @@ ffs_mount(struct mount *mp) flags = WRITECLOSE; if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; - if (mp->mnt_flag & MNT_SOFTDEP) { + if (MOUNTEDSOFTDEP(mp)) { error = softdep_flushfiles(mp, flags, td); } else { error = ffs_flushfiles(mp, flags, td); @@ -307,7 +307,7 @@ ffs_mount(struct mount *mp) vfs_write_resume(mp); return (error); } - if (mp->mnt_flag & MNT_SOFTDEP) + if (MOUNTEDSOFTDEP(mp)) softdep_unmount(mp); DROP_GIANT(); g_topology_lock(); @@ -411,7 +411,7 @@ ffs_mount(struct mount *mp) * Softdep_mount() clears it in an initial mount * or ro->rw remount. */ - if (mp->mnt_flag & MNT_SOFTDEP) { + if (MOUNTEDSOFTDEP(mp)) { /* XXX: Reset too late ? */ MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_ASYNC; @@ -443,7 +443,7 @@ ffs_mount(struct mount *mp) fs->fs_fsmnt); return (EINVAL); } - KASSERT((mp->mnt_flag & MNT_SOFTDEP) == 0, + KASSERT(MOUNTEDSOFTDEP(mp) == 0, ("soft updates enabled on read-only file system")); DROP_GIANT(); g_topology_lock(); @@ -530,7 +530,7 @@ ffs_mount(struct mount *mp) return (error); } if (fsckpid > 0) { - KASSERT((mp->mnt_flag & MNT_SOFTDEP) == 0, + KASSERT(MOUNTEDSOFTDEP(mp) == 0, ("soft updates enabled on read-only file system")); ump = VFSTOUFS(mp); fs = ump->um_fs; @@ -1247,7 +1247,7 @@ ffs_unmount(mp, mntflags) vn_start_write(NULL, &mp, V_WAIT); } } - if (mp->mnt_flag & MNT_SOFTDEP) + if (MOUNTEDSOFTDEP(mp)) error = softdep_flushfiles(mp, flags, td); else error = ffs_flushfiles(mp, flags, td); @@ -1389,9 +1389,6 @@ ffs_statfs(mp, sbp) fs = ump->um_fs; if (fs->fs_magic != FS_UFS1_MAGIC && fs->fs_magic != FS_UFS2_MAGIC) panic("ffs_statfs"); - /* Don't export MNT_SOFTDEP when MNT_SUJ is in use */ - if ((sbp->f_flags & (MNT_SOFTDEP | MNT_SUJ)) == (MNT_SOFTDEP | MNT_SUJ)) - sbp->f_flags &= ~MNT_SOFTDEP; sbp->f_version = STATFS_VERSION; sbp->f_bsize = fs->fs_fsize; sbp->f_iosize = fs->fs_bsize; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 9f528da..81c7af4 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -187,8 +187,7 @@ retry: error = ffs_syncvnode(vp, ap->a_waitfor); if (error) return (error); - if (ap->a_waitfor == MNT_WAIT && - (vp->v_mount->mnt_flag & MNT_SOFTDEP)) { + if (ap->a_waitfor == MNT_WAIT && DOINGSOFTDEP(vp)) { error = softdep_fsync(vp); if (error) return (error); diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index 943e303..6f3d6f9 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -174,9 +174,11 @@ struct indir { #define ITOV(ip) ((ip)->i_vnode) /* Determine if soft dependencies are being done */ -#define DOINGSOFTDEP(vp) ((vp)->v_mount->mnt_flag & MNT_SOFTDEP) -#define DOINGASYNC(vp) ((vp)->v_mount->mnt_kern_flag & MNTK_ASYNC) -#define DOINGSUJ(vp) ((vp)->v_mount->mnt_flag & MNT_SUJ) +#define DOINGSOFTDEP(vp) ((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) +#define MOUNTEDSOFTDEP(mp) ((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) +#define DOINGASYNC(vp) ((vp)->v_mount->mnt_kern_flag & MNTK_ASYNC) +#define DOINGSUJ(vp) ((vp)->v_mount->mnt_flag & MNT_SUJ) +#define MOUNTEDSUJ(mp) ((mp)->mnt_flag & MNT_SUJ) /* This overlays the fid structure (see mount.h). */ struct ufid { |