Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jun 2000 21:01:10 +0200
From:      Stefan Esser <se@freebsd.org>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Poul-Henning Kamp <phk@critter.freebsd.dk>, Peter Wemm <peter@netplex.com.au>, Adrian Chadd <adrian@FreeBSD.ORG>, Julian Elischer <julian@elischer.org>, Anders Andersson <anders@sanyusan.se>, cvs-all@FreeBSD.ORG, freebsd-current@FreeBSD.ORG, Stefan Esser <se@freebsd.org>
Subject:   Re: cvs commit: src/sys/contrib/softupdates softdep.h ffs_softdep.c
Message-ID:  <20000623210110.B8626@StefanEsser.FreeBSD.org>
In-Reply-To: <200006231641.JAA10742@apollo.backplane.com>; from dillon@apollo.backplane.com on Fri, Jun 23, 2000 at 09:41:31AM -0700
References:  <669.961737829@critter.freebsd.dk> <200006231641.JAA10742@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2000-06-23 09:41 -0700, Matthew Dillon <dillon@apollo.backplane.com> 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 majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000623210110.B8626>