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)
This commit is contained in:
parent
6beb3bb4eb
commit
d716efa9f7
@ -109,6 +109,7 @@ static struct opt {
|
||||
{ MNT_NOCLUSTERW, "noclusterw" },
|
||||
{ MNT_SUIDDIR, "suiddir" },
|
||||
{ MNT_SOFTDEP, "soft-updates" },
|
||||
{ MNT_SUJ, "journaled soft-updates" },
|
||||
{ MNT_MULTILABEL, "multilabel" },
|
||||
{ MNT_ACLS, "acls" },
|
||||
{ MNT_NFS4ACLS, "nfsv4acls" },
|
||||
@ -316,7 +317,7 @@ main(int argc, char *argv[])
|
||||
rval = 0;
|
||||
switch (argc) {
|
||||
case 0:
|
||||
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
|
||||
if ((mntsize = getmntinfo(&mntbuf, MNT_WAIT)) == 0)
|
||||
err(1, "getmntinfo");
|
||||
if (all) {
|
||||
while ((fs = getfsent()) != NULL) {
|
||||
@ -665,7 +666,7 @@ getmntpt(const char *name)
|
||||
struct statfs *mntbuf;
|
||||
int i, mntsize;
|
||||
|
||||
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
|
||||
mntsize = getmntinfo(&mntbuf, MNT_WAIT);
|
||||
for (i = mntsize - 1; i >= 0; i--) {
|
||||
if (strcmp(mntbuf[i].f_mntfromname, name) == 0 ||
|
||||
strcmp(mntbuf[i].f_mntonname, name) == 0)
|
||||
|
@ -2841,6 +2841,7 @@ DB_SHOW_COMMAND(mount, db_show_mount)
|
||||
MNT_FLAG(MNT_ASYNC);
|
||||
MNT_FLAG(MNT_SUIDDIR);
|
||||
MNT_FLAG(MNT_SOFTDEP);
|
||||
MNT_FLAG(MNT_SUJ);
|
||||
MNT_FLAG(MNT_NOSYMFOLLOW);
|
||||
MNT_FLAG(MNT_GJOURNAL);
|
||||
MNT_FLAG(MNT_MULTILABEL);
|
||||
@ -2866,7 +2867,6 @@ DB_SHOW_COMMAND(mount, db_show_mount)
|
||||
MNT_FLAG(MNT_FORCE);
|
||||
MNT_FLAG(MNT_SNAPSHOT);
|
||||
MNT_FLAG(MNT_BYFSID);
|
||||
MNT_FLAG(MNT_SOFTDEP);
|
||||
#undef MNT_FLAG
|
||||
if (flags != 0) {
|
||||
if (buf[0] != '\0')
|
||||
@ -2894,7 +2894,6 @@ DB_SHOW_COMMAND(mount, db_show_mount)
|
||||
MNT_KERN_FLAG(MNTK_REFEXPIRE);
|
||||
MNT_KERN_FLAG(MNTK_EXTENDED_SHARED);
|
||||
MNT_KERN_FLAG(MNTK_SHARED_WRITES);
|
||||
MNT_KERN_FLAG(MNTK_SUJ);
|
||||
MNT_KERN_FLAG(MNTK_UNMOUNT);
|
||||
MNT_KERN_FLAG(MNTK_MWAIT);
|
||||
MNT_KERN_FLAG(MNTK_SUSPEND);
|
||||
|
@ -239,6 +239,7 @@ void __mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp);
|
||||
#define MNT_NOATIME 0x0000000010000000ULL /* dont update file access time */
|
||||
#define MNT_NOCLUSTERR 0x0000000040000000ULL /* disable cluster read */
|
||||
#define MNT_NOCLUSTERW 0x0000000080000000ULL /* disable cluster write */
|
||||
#define MNT_SUJ 0x0000000100000000ULL /* using journaled soft updates */
|
||||
|
||||
/*
|
||||
* NFS export related mount flags.
|
||||
@ -267,7 +268,7 @@ void __mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp);
|
||||
* but the 'mount' program may need changing to handle this.
|
||||
*/
|
||||
#define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | \
|
||||
MNT_NOSUID | MNT_UNION | \
|
||||
MNT_NOSUID | MNT_UNION | MNT_SUJ | \
|
||||
MNT_ASYNC | MNT_EXRDONLY | MNT_EXPORTED | \
|
||||
MNT_DEFEXPORTED | MNT_EXPORTANON| MNT_EXKERB | \
|
||||
MNT_LOCAL | MNT_USER | MNT_QUOTA | \
|
||||
@ -324,7 +325,6 @@ void __mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp);
|
||||
#define MNTK_REFEXPIRE 0x00000020 /* refcount expiring is happening */
|
||||
#define MNTK_EXTENDED_SHARED 0x00000040 /* Allow shared locking for more ops */
|
||||
#define MNTK_SHARED_WRITES 0x00000080 /* Allow shared locking for writes */
|
||||
#define MNTK_SUJ 0x00000100 /* Softdep journaling enabled */
|
||||
#define MNTK_UNMOUNT 0x01000000 /* unmount in progress */
|
||||
#define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */
|
||||
#define MNTK_SUSPEND 0x08000000 /* request write suspension */
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user