On 2000-06-23 09:41 -0700, Matthew Dillon <[EMAIL PROTECTED]> wrote:
>     Slight problem:  We've run out of mount option flags.

But there already ist MNT_SOFTDEP in <sys/mount.h> ...

#define MNT_SUIDDIR     0x00100000      /* special handling of SUID on dirs */
#define MNT_SOFTDEP     0x00200000      /* soft updates being done */
#define MNT_NOSYMFOLLOW 0x00400000      /* do not follow symlinks */


Hmmm, just checked in <ufs/ffs/fs.h> and found that the soft-updates state
is already kept in the fs_flags element of struct fs (the super-block).

/*
 * Super block for an FFS file system.
 */
struct fs {
        ...
        int8_t   fs_flags;              /* see FS_ flags below */
        ...
};

/*
 * Filesystem flags.
 */
#define FS_UNCLEAN    0x01    /* filesystem not clean at mount */
#define FS_DOSOFTDEP  0x02    /* filesystem using soft dependencies */


And in fsck/setup.c, I found:

        bufinit();
        if (sblock.fs_flags & FS_DOSOFTDEP)
                usedsoftdep = 1;
        else
                usedsoftdep = 0;
        return (1);


So its obvious, that we could make "-o softdep" a mount option, do away
with the tunefs option, and have the *kernel* record the use of soft-updates
on a R/W mounted file system when it marks the file system FS_UNCLEAN in
the fs_flags files in the super-block. If a file system is unmounted 
cleanly, the FS_DOSOFTDEP flag can be cleared along with the FS_UNCLEAN
bit, since the next mount is free to decide whether to use soft-updates
or not.

This is more safe than the tunefs method, since FS_DOSOFTDEP will only be
set if the last R/W mount was on a kernel that supported soft-updates ...


Only problem I see (but that is not different from the current situation)
is that "mount -u" can't change the soft-updates state, if a file-system
is mounted R/W. This should probably be inforced in the kernel (not the
mount command) and there should be *no* way to "force" mount to override
this lock.


Regards, STefan


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to