On 2001-02-07 05:20 -0800, Peter Wemm <[EMAIL PROTECTED]> wrote:
[ Follow-ups to the FreeBSD-Audit mail list only, please ... ]
> Poul-Henning Kamp wrote:
> > In message <[EMAIL PROTECTED]>, Peter Wemm writes:
> > >So that fsck(8) can see what mode the FS *was* mounted in last time. That
> > >bears no relationship to fstab or the current options.
> >
> > Right, so if mounting in softupdates mode updates the superblock to
> > set the softupdates flag, why wouldn't that work ?
>
> It would work fine, but Kirk told me not to bother submitting patches
> because he had something else in mind (or at least, that's the way I
> interpreted the mail).
I created patches that do just that (mount -o softdep performs
a soft-updates mount and updates the superblock softdep flag)
back in June 2000 and sent them to Kirk, who then agreed that
this was the way to go, when the problems with memory and disk
resource usage of soft-updates writes were solved (the missing
limits on the amount of dirty buffers and the delayed freeing
of disk blocks after a file is removed). Both of these points
seem to have been resolved, meanwhile, and I do not see any
reason, not to enable soft-updates by default and to provide a
mount option that disables soft-updates per filesystem.
( For reference, see the FreeBSD-Arch archive for the full message:
Message-Id: <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: Soft updates mount change
Cc: Stefan Esser <[EMAIL PROTECTED]>
Date: Wed, 28 Jun 2000 13:51:00 -0700
From: Kirk McKusick <[EMAIL PROTECTED]>
That message includes my mail to Kirk, where I describe the
diffs and my reasoning, why it should be done that way ... )
The following diffs are patches to all components (kernel, mount
programs) except for the required additions to the mount_ufs man
page.
I have been running a patched kernel on sevreal systems for more
than a half year with no problems at all ...
Regards, STefan
PS: The diffs that I append assume softdep OFF by default, which
is what I have used and tested. I can easily rework that code
to assume softdep ON and will start to implement and test that
version. The logic will remain unchanged, so this code should
be near enough to the final code to be suitable for review.
Index: sbin/mount/mntopts.h
===================================================================
RCS file: /usr/cvs/src/sbin/mount/mntopts.h,v
retrieving revision 1.17
diff -u -3 -r1.17 mntopts.h
--- sbin/mount/mntopts.h 2000/07/06 01:50:05 1.17
+++ sbin/mount/mntopts.h 2000/08/03 19:36:36
@@ -57,6 +57,7 @@
#define MOPT_NOCLUSTERW { "clusterw", 1, MNT_NOCLUSTERW, 0 }
#define MOPT_SUIDDIR { "suiddir", 0, MNT_SUIDDIR, 0 }
#define MOPT_SNAPSHOT { "snapshot", 0, MNT_SNAPSHOT, 0 }
+#define MOPT_SOFTDEP { "softdep", 0, MNT_SOFTDEP, 0 }
/* Control flags. */
#define MOPT_FORCE { "force", 0, MNT_FORCE, 0 }
Index: sbin/mount/mount.c
===================================================================
RCS file: /usr/cvs/src/sbin/mount/mount.c,v
retrieving revision 1.41
diff -u -3 -r1.41 mount.c
--- sbin/mount/mount.c 2000/11/22 17:54:56 1.41
+++ sbin/mount/mount.c 2000/11/24 22:57:46
@@ -742,6 +742,7 @@
if (flags & MNT_NOCLUSTERW) res = catopt(res, "noclusterw");
if (flags & MNT_NOSYMFOLLOW) res = catopt(res, "nosymfollow");
if (flags & MNT_SUIDDIR) res = catopt(res, "suiddir");
+ if (flags & MNT_SOFTDEP) res = catopt(res, "softdep");
return res;
}
Index: sbin/mount/mount_ufs.c
===================================================================
RCS file: /usr/cvs/src/sbin/mount/mount_ufs.c,v
retrieving revision 1.20
diff -u -3 -r1.20 mount_ufs.c
--- sbin/mount/mount_ufs.c 2001/01/25 20:03:38 1.20
+++ sbin/mount/mount_ufs.c 2001/01/27 10:27:06
@@ -67,6 +67,7 @@
MOPT_SYNC,
MOPT_UPDATE,
MOPT_SNAPSHOT,
+ MOPT_SOFTDEP,
{ NULL }
};
Index: sys/ufs/ffs/ffs_softdep.c
===================================================================
RCS file: /usr/cvs/src/sys/ufs/ffs/ffs_softdep.c,v
retrieving revision 1.84
diff -u -3 -r1.84 ffs_softdep.c
--- sys/ufs/ffs/ffs_softdep.c 2001/02/04 16:08:18 1.84
+++ sys/ufs/ffs/ffs_softdep.c 2001/02/04 19:23:31
@@ -1063,7 +1063,7 @@
int error, cyl;
mp->mnt_flag &= ~MNT_ASYNC;
- mp->mnt_flag |= MNT_SOFTDEP;
+ fs->fs_flags |= FS_DOSOFTDEP;
/*
* When doing soft updates, the counters in the
* superblock may have gotten out of sync, so we have
Index: sys/ufs/ffs/ffs_softdep_stub.c
===================================================================
RCS file: /usr/cvs/src/sys/ufs/ffs/ffs_softdep_stub.c,v
retrieving revision 1.15
diff -u -3 -r1.15 ffs_softdep_stub.c
--- sys/ufs/ffs/ffs_softdep_stub.c 2000/12/17 23:59:56 1.15
+++ sys/ufs/ffs/ffs_softdep_stub.c 2000/12/18 10:40:13
@@ -71,6 +71,7 @@
struct fs *fs;
struct ucred *cred;
{
+ mp->mnt_flag &= ~MNT_SOFTDEP;
return (0);
}
Index: sys/ufs/ffs/ffs_vfsops.c
===================================================================
RCS file: /usr/cvs/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.138
diff -u -3 -r1.138 ffs_vfsops.c
--- sys/ufs/ffs/ffs_vfsops.c 2001/02/09 06:11:33 1.138
+++ sys/ufs/ffs/ffs_vfsops.c 2001/02/10 08:06:19
@@ -177,6 +177,13 @@
ump = VFSTOUFS(mp);
fs = ump->um_fs;
devvp = ump->um_devvp;
+ if (fs->fs_ronly == 0) {
+ if (fs->fs_flags & FS_DOSOFTDEP) {
+ mp->mnt_flag |= MNT_SOFTDEP;
+ } else {
+ mp->mnt_flag &= ~MNT_SOFTDEP;
+ }
+ }
if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
if ((error = vn_start_write(NULL, &mp, V_WAIT)) != 0)
return (error);
@@ -242,7 +249,7 @@
return (error);
}
/* check to see if we need to start softdep */
- if ((fs->fs_flags & FS_DOSOFTDEP) &&
+ if ((mp->mnt_flag & MNT_SOFTDEP) &&
(error = softdep_mount(devvp, mp, fs, p->p_ucred))){
vn_finished_write(mp);
return (error);
@@ -602,6 +609,9 @@
error = EROFS; /* needs translation */
goto out;
}
+ /* clear softdep flag in superblock, if not a softdep mount */
+ if ((mp->mnt_flag & MNT_SOFTDEP) == 0)
+ fs->fs_flags &= ~FS_DOSOFTDEP;
ump = malloc(sizeof *ump, M_UFSMNT, M_WAITOK | M_ZERO);
ump->um_malloctype = malloctype;
ump->um_i_effnlink_valid = 1;
@@ -689,7 +699,7 @@
if (fs->fs_maxfilesize > maxfilesize) /* XXX */
fs->fs_maxfilesize = maxfilesize; /* XXX */
if (ronly == 0) {
- if ((fs->fs_flags & FS_DOSOFTDEP) &&
+ if ((mp->mnt_flag & MNT_SOFTDEP) &&
(error = softdep_mount(devvp, mp, fs, cred)) != 0) {
free(fs->fs_csp, M_UFSMNT);
goto out;
Index: sys/kern/vfs_syscalls.c
===================================================================
RCS file: /usr/cvs/src/sys/kern/vfs_syscalls.c,v
retrieving revision 1.176
diff -u -3 -r1.176 vfs_syscalls.c
--- sys/kern/vfs_syscalls.c 2001/02/09 06:09:52 1.176
+++ sys/kern/vfs_syscalls.c 2001/02/10 08:05:44
@@ -280,11 +280,11 @@
mp->mnt_flag &=~ (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV |
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME |
MNT_NOSYMFOLLOW | MNT_IGNORE |
- MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
+ MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR | MNT_SOFTDEP);
mp->mnt_flag |= SCARG(uap, flags) & (MNT_NOSUID | MNT_NOEXEC |
MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE |
MNT_NOSYMFOLLOW | MNT_IGNORE |
- MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
+ MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR | MNT_SOFTDEP);
/*
* Mount the filesystem.
* XXX The final recipients of VFS_MOUNT just overwrite the ndp they
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message