diff options
author | mckusick <mckusick@FreeBSD.org> | 2011-07-24 18:27:09 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2011-07-24 18:27:09 +0000 |
commit | ffeefed9fc8fa85d3fcbd19640ba38e51e2ff4da (patch) | |
tree | dff2f2c8a3cdf5485267a96d12dd0c20f58da76d /sys/ufs | |
parent | 64e0ba1afe60a4c7d7a1960154875516b560d46c (diff) | |
download | FreeBSD-src-ffeefed9fc8fa85d3fcbd19640ba38e51e2ff4da.zip FreeBSD-src-ffeefed9fc8fa85d3fcbd19640ba38e51e2ff4da.tar.gz |
Move the MNTK_SUJ flag in mnt_kern_flag to MNT_SUJ in mnt_flag
so that it is visible to userland programs. This change enables
the `mount' command with no arguments to be able to show if a
filesystem is mounted using journaled soft updates as opposed
to just normal soft updates.
Approved by: re (bz)
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 38 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 3 | ||||
-rw-r--r-- | sys/ufs/ufs/inode.h | 2 |
3 files changed, 23 insertions, 20 deletions
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index fccb296..8f1923a 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -2423,11 +2423,11 @@ softdep_unmount(mp) MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_SOFTDEP; - if ((mp->mnt_kern_flag & MNTK_SUJ) == 0) { + if ((mp->mnt_flag & MNT_SUJ) == 0) { MNT_IUNLOCK(mp); return; } - mp->mnt_kern_flag &= ~MNTK_SUJ; + mp->mnt_flag &= ~MNT_SUJ; MNT_IUNLOCK(mp); journal_unmount(mp); } @@ -2637,7 +2637,7 @@ journal_mount(mp, fs, cred) out: if (error == 0) { MNT_ILOCK(mp); - mp->mnt_kern_flag |= MNTK_SUJ; + mp->mnt_flag |= MNT_SUJ; MNT_IUNLOCK(mp); /* * Only validate the journal contents if the @@ -3060,7 +3060,7 @@ softdep_flushjournal(mp) struct jblocks *jblocks; struct ufsmount *ump; - if ((mp->mnt_kern_flag & MNTK_SUJ) == 0) + if ((mp->mnt_flag & MNT_SUJ) == 0) return; ump = VFSTOUFS(mp); jblocks = ump->softdep_jblocks; @@ -3096,7 +3096,7 @@ softdep_process_journal(mp, needwk, flags) int off; int devbsize; - if ((mp->mnt_kern_flag & MNTK_SUJ) == 0) + if ((mp->mnt_flag & MNT_SUJ) == 0) return; ump = VFSTOUFS(mp); fs = ump->um_fs; @@ -3827,7 +3827,7 @@ 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_kern_flag & MNTK_SUJ) == 0 || + freework->fw_ref = ((UFSTOVFS(ump)->mnt_flag & MNT_SUJ) == 0 || lbn >= -NXADDR) ? 0 : NINDIR(ump->um_fs) + 1; freework->fw_start = freework->fw_off = off; if (journal) @@ -4681,7 +4681,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_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { jaddref = newjaddref(ip, newinum, 0, 0, mode); jaddref->ja_state |= NEWBLOCK; } @@ -4734,7 +4734,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_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { 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 +5199,7 @@ newfreefrag(ip, blkno, size, lbn) freefrag->ff_blkno = blkno; freefrag->ff_fragsize = size; - if ((ip->i_ump->um_mountp->mnt_kern_flag & MNTK_SUJ) != 0) { + if ((ip->i_ump->um_mountp->mnt_flag & MNT_SUJ) != 0) { freefrag->ff_jdep = (struct worklist *) newjfreefrag(freefrag, ip, blkno, size, lbn); } else { @@ -7254,7 +7254,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_kern_flag & MNTK_SUJ; + needj = (freeblks->fb_list.wk_mp->mnt_flag & MNT_SUJ) != 0; bsize = lfragtosize(fs, freework->fw_frags); LIST_INIT(&wkhd); /* @@ -7674,7 +7674,7 @@ indir_trunc(freework, dbn, lbn) ufs1fmt = 0; } level = lbn_level(lbn); - needj = UFSTOVFS(ump)->mnt_kern_flag & MNTK_SUJ; + needj = (UFSTOVFS(ump)->mnt_flag & MNT_SUJ) != 0; lbnadd = lbn_offset(fs, level); nblocks = btodb(fs->fs_bsize); nfreework = freework; @@ -7860,7 +7860,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_kern_flag & MNTK_SUJ) == 0) { + if ((mp->mnt_flag & MNT_SUJ) == 0) { mkdir1->md_state |= DEPCOMPLETE; mkdir2->md_state |= DEPCOMPLETE; } @@ -7900,7 +7900,7 @@ setup_newdir(dap, newinum, dinum, newdirbp, mkdirp) * been satisfied and mkdir2 can be freed. */ inodedep_lookup(mp, dinum, 0, &inodedep); - if (mp->mnt_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { if (inodedep == NULL) panic("setup_newdir: Lost parent."); jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, @@ -8031,7 +8031,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_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, inoreflst); KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number, @@ -8047,7 +8047,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_kern_flag & MNTK_SUJ) { + if (mkdir1 != NULL && (mp->mnt_flag & MNT_SUJ)) { jaddref = (struct jaddref *)TAILQ_PREV(&jaddref->ja_ref, inoreflst, if_deps); KASSERT(jaddref != NULL && @@ -8144,7 +8144,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_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { flags = DEPALLOC; jmvref = newjmvref(dp, de->d_ino, dp->i_offset + (oldloc - base), @@ -8865,7 +8865,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_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, inoreflst); KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number, @@ -8928,7 +8928,7 @@ softdep_setup_sbupdate(ump, fs, bp) struct sbdep *sbdep; struct worklist *wk; - if ((ump->um_mountp->mnt_kern_flag & MNTK_SUJ) == 0) + if ((ump->um_mountp->mnt_flag & MNT_SUJ) == 0) return; LIST_FOREACH(wk, &bp->b_dep, wk_list) if (wk->wk_type == D_SBDEP) @@ -9046,7 +9046,7 @@ unlinked_inodedep(mp, inodedep) { struct ufsmount *ump; - if ((mp->mnt_kern_flag & MNTK_SUJ) == 0) + if ((mp->mnt_flag & MNT_SUJ) == 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 35852bf..7f57c84 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1389,6 +1389,9 @@ 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/ufs/inode.h b/sys/ufs/ufs/inode.h index 7adcc73..943e303 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -176,7 +176,7 @@ struct indir { /* 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_kern_flag & MNTK_SUJ) +#define DOINGSUJ(vp) ((vp)->v_mount->mnt_flag & MNT_SUJ) /* This overlays the fid structure (see mount.h). */ struct ufid { |