Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jul 2005 02:08:26 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 79884 for review
Message-ID:  <200507100208.j6A28QXa014049@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=79884

Change 79884 by scottl@scottl-junior on 2005/07/10 02:08:18

	Integrate the ufsj work to the SoC2005 area so that it can be worked
	on.

Affected files ...

.. //depot/projects/soc2005/ufsj/src/sbin/mount/mount.c#2 integrate
.. //depot/projects/soc2005/ufsj/src/sbin/tunefs/tunefs.c#2 integrate
.. //depot/projects/soc2005/ufsj/src/sys/conf/files#2 integrate
.. //depot/projects/soc2005/ufsj/src/sys/conf/options#2 integrate
.. //depot/projects/soc2005/ufsj/src/sys/modules/ufs/Makefile#2 integrate
.. //depot/projects/soc2005/ufsj/src/sys/sys/mount.h#2 integrate
.. //depot/projects/soc2005/ufsj/src/sys/ufs/ffs/ffs_alloc.c#2 integrate
.. //depot/projects/soc2005/ufsj/src/sys/ufs/ffs/ffs_vfsops.c#2 integrate
.. //depot/projects/soc2005/ufsj/src/sys/ufs/ffs/fs.h#2 integrate
.. //depot/projects/soc2005/ufsj/src/sys/ufs/ufs/journal.h#1 branch
.. //depot/projects/soc2005/ufsj/src/sys/ufs/ufs/ufs_journal.c#1 branch
.. //depot/projects/soc2005/ufsj/src/sys/ufs/ufs/ufsmount.h#2 integrate

Differences ...

==== //depot/projects/soc2005/ufsj/src/sbin/mount/mount.c#2 (text+ko) ====

@@ -106,6 +106,7 @@
 	{ MNT_SOFTDEP,		"soft-updates" },
 	{ MNT_MULTILABEL,	"multilabel" },
 	{ MNT_ACLS,		"acls" },
+	{ MNT_JOURNAL,		"journalling" },
 	{ 0, NULL }
 };
 

==== //depot/projects/soc2005/ufsj/src/sbin/tunefs/tunefs.c#2 (text+ko) ====

@@ -83,6 +83,8 @@
 	int Aflag, aflag, eflag, evalue, fflag, fvalue, Lflag, lflag;
 	int mflag, mvalue, nflag, oflag, ovalue, pflag, sflag, svalue;
 	int ch, found_arg, i;
+	ino_t jvalue;
+	int jflag;
 	const char *chg[2];
 	struct ufs_args args;
 	struct statfs stfs;
@@ -93,9 +95,10 @@
 	nflag = oflag = pflag = sflag = 0;
 	avalue = Lvalue = lvalue = nvalue = NULL;
 	evalue = fvalue = mvalue = ovalue = svalue = 0;
+	jvalue = jflag = 0;
 	active = 0;
 	found_arg = 0;		/* At least one arg is required. */
-	while ((ch = getopt(argc, argv, "Aa:e:f:L:l:m:n:o:ps:")) != -1)
+	while ((ch = getopt(argc, argv, "Aa:e:f:j:L:l:m:n:o:ps:")) != -1)
 		switch (ch) {
 
 		case 'A':
@@ -135,6 +138,14 @@
 			fflag = 1;
 			break;
 
+		case 'j':
+			found_arg = 1;
+			name = "journalling";
+			jvalue = strtoul(optarg, NULL, 0);
+			if ((jvalue == 1) || (jvalue == 2))
+				errx(10, "Inode value cannot be 1 or 2");
+			jflag = 1;
+			break;
 		case 'L':
 			found_arg = 1;
 			name = "volume label";
@@ -282,6 +293,15 @@
 			sblock.fs_avgfilesize = fvalue;
 		}
 	}
+	if (jflag) {
+		name = "journalling";
+		if (jvalue == 0)
+			sblock.fs_flags &= ~FS_JOURNAL;
+		else {
+			sblock.fs_flags |= FS_JOURNAL;
+			sblock.fs_journal_inode = jvalue;
+		}
+	}
 	if (lflag) {
 		name = "multilabel";
 		if (strcmp(lvalue, "enable") == 0) {

==== //depot/projects/soc2005/ufsj/src/sys/conf/files#2 (text+ko) ====

@@ -1793,6 +1793,7 @@
 ufs/ufs/ufs_extattr.c		optional ffs
 ufs/ufs/ufs_inode.c		optional ffs
 ufs/ufs/ufs_lookup.c		optional ffs
+ufs/ufs/ufs_journal.c		optional ffs
 ufs/ufs/ufs_quota.c		optional ffs
 ufs/ufs/ufs_vfsops.c		optional ffs
 ufs/ufs/ufs_vnops.c		optional ffs

==== //depot/projects/soc2005/ufsj/src/sys/conf/options#2 (text+ko) ====

@@ -223,6 +223,9 @@
 # Enable fast hash lookups for large directories on UFS-based filesystems.
 UFS_DIRHASH	opt_ufs.h
 
+# Enable code to do filesystem journalling.
+UFS_JOURNAL	opt_ufs.h
+
 # The below sentence is not in English, and neither is this one.
 # We plan to remove the static dependences above, with a
 # <filesystem>_ROOT option to control if it usable as root.  This list

==== //depot/projects/soc2005/ufsj/src/sys/modules/ufs/Makefile#2 (text+ko) ====

@@ -6,10 +6,10 @@
 SRCS=	opt_ddb.h opt_directio.h opt_ffs.h opt_ffs_broken_fixme.h opt_mac.h \
 	opt_quota.h opt_suiddir.h opt_ufs.h \
 	vnode_if.h ufs_acl.c ufs_bmap.c ufs_dirhash.c ufs_extattr.c \
-	ufs_inode.c ufs_lookup.c ufs_quota.c ufs_vfsops.c \
+	ufs_inode.c ufs_journal.c ufs_lookup.c ufs_quota.c ufs_vfsops.c \
 	ufs_vnops.c ffs_alloc.c ffs_balloc.c ffs_inode.c ffs_snapshot.c \
 	ffs_softdep.c ffs_subr.c ffs_tables.c ffs_vfsops.c ffs_vnops.c
 
-CFLAGS+= -DSOFTUPDATES -DUFS_DIRHASH
+CFLAGS+= -DSOFTUPDATES -DUFS_DIRHASH -DUFS_JOURNAL
 
 .include <bsd.kmod.mk>

==== //depot/projects/soc2005/ufsj/src/sys/sys/mount.h#2 (text+ko) ====

@@ -188,6 +188,7 @@
 #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 */
+#define	MNT_JOURNAL	0x00800000	/* journalling being done */
 #define	MNT_JAILDEVFS	0x02000000	/* jail-friendly DEVFS behaviour */
 #define	MNT_MULTILABEL	0x04000000	/* MAC support for individual objects */
 #define	MNT_ACLS	0x08000000	/* ACL support enabled */

==== //depot/projects/soc2005/ufsj/src/sys/ufs/ffs/ffs_alloc.c#2 (text+ko) ====

@@ -63,6 +63,7 @@
 __FBSDID("$FreeBSD: src/sys/ufs/ffs/ffs_alloc.c,v 1.132 2005/02/20 08:02:15 delphij Exp $");
 
 #include "opt_quota.h"
+#include "opt_ufs.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2321,6 +2322,11 @@
 static SYSCTL_NODE(_vfs_ffs, FFS_SET_FLAGS, setflags, CTLFLAG_WR,
 	sysctl_ffs_fsck, "Change Filesystem Flags");
 
+#ifdef UFS_JOURNAL
+static SYSCTL_NODE(_vfs_ffs, FFS_SET_JINODE, setjinode, CTLFLAG_WR,
+	sysctl_ffs_fsck, "Set Journal Inode");
+#endif
+
 #ifdef DEBUG
 static int fsckcmds = 0;
 SYSCTL_INT(_debug, OID_AUTO, fsckcmds, CTLFLAG_RW, &fsckcmds, 0, "");
@@ -2365,6 +2371,13 @@
 
 	switch (oidp->oid_number) {
 
+#ifdef UFS_JOURNAL
+	case FFS_SET_JINODE:
+		fs->fs_journal_inode = (ino_t)cmd.value;
+		fs->fs_flags |= FS_JOURNAL;
+		break;
+#endif
+
 	case FFS_SET_FLAGS:
 #ifdef DEBUG
 		if (fsckcmds)

==== //depot/projects/soc2005/ufsj/src/sys/ufs/ffs/ffs_vfsops.c#2 (text+ko) ====

@@ -57,6 +57,7 @@
 #include <ufs/ufs/ufsmount.h>
 #include <ufs/ufs/inode.h>
 #include <ufs/ufs/ufs_extern.h>
+#include <ufs/ufs/journal.h>
 
 #include <ufs/ffs/fs.h>
 #include <ufs/ffs/ffs_extern.h>
@@ -265,6 +266,14 @@
 				vn_finished_write(mp);
 				return (error);
 			}
+#ifdef UFS_JOURNAL
+			/* check and start the journal */
+			if ((fs->fs_flags & FS_JOURNAL) &&
+			    (error = ufsj_start(devvp, mp, fs, td))) {
+				vn_finished_write(mp);
+				return (error);
+			}
+#endif
 			/* check to see if we need to start softdep */
 			if ((fs->fs_flags & FS_DOSOFTDEP) &&
 			    (error = softdep_mount(devvp, mp, fs, td->td_ucred))){
@@ -751,6 +760,14 @@
 	}
 
 	if (ronly == 0) {
+#ifdef UFS_JOURNAL
+		/* check and start the journal */
+		if ((fs->fs_flags & FS_JOURNAL) &&
+		    (error = ufsj_start(devvp, mp, fs, td))) {
+			vn_finished_write(mp);
+			return (error);
+		}
+#endif
 		if ((fs->fs_flags & FS_DOSOFTDEP) &&
 		    (error = softdep_mount(devvp, mp, fs, cred)) != 0) {
 			free(fs->fs_csp, M_UFSMNT);
@@ -930,6 +947,12 @@
 		if ((error = ffs_flushfiles(mp, flags, td)) != 0)
 			return (error);
 	}
+#ifdef UFS_JOURNAL
+	if (mp->mnt_flag & MNT_JOURNAL) {
+		if ((error = ufsj_stop(mp, flags, td)) != 0)
+			return (error);
+	}
+#endif
 	fs = ump->um_fs;
 	UFS_LOCK(ump);
 	if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) {

==== //depot/projects/soc2005/ufsj/src/sys/ufs/ffs/fs.h#2 (text+ko) ====

@@ -33,6 +33,10 @@
 #ifndef _UFS_FFS_FS_H_
 #define _UFS_FFS_FS_H_
 
+#ifdef _KERNEL
+#include "opt_ufs.h"
+#endif
+
 /*
  * Each disk drive contains some number of filesystems.
  * A filesystem consists of a number of cylinder groups.
@@ -212,6 +216,7 @@
 #define	FFS_ADJ_NFFREE		10 	/* adjust number of free frags */
 #define	FFS_ADJ_NUMCLUSTERS	11	/* adjust number of free clusters */
 #define	FFS_MAXID		12	/* number of valid ffs ids */
+#define FFS_SET_JINODE		13	/* set the journally inode number */
 
 /*
  * Command structure passed in to the filesystem to adjust filesystem values.
@@ -347,8 +352,13 @@
 	int32_t	 fs_state;		/* validate fs_clean field */
 	int32_t	 fs_old_postblformat;	/* format of positional layout tables */
 	int32_t	 fs_old_nrpos;		/* number of rotational positions */
+#ifdef UFS_JOURNAL
+	ino_t    fs_journal_inode;	/* Inode of the journal file */
+	int32_t  fs_spare5;		/* old fs_rotbloff */
+#else
 	int32_t	 fs_spare5[2];		/* old fs_postbloff */
 					/* old fs_rotbloff */
+#endif
 	int32_t	 fs_magic;		/* magic number */
 };
 
@@ -406,6 +416,7 @@
 #define FS_INDEXDIRS  0x08	/* kernel supports indexed directories */
 #define FS_ACLS       0x10	/* file system has ACLs enabled */
 #define FS_MULTILABEL 0x20	/* file system is MAC multi-label */
+#define FS_JOURNAL    0x40	/* file system has a journal */
 #define FS_FLAGS_UPDATED 0x80	/* flags have been moved to new location */
 
 /*

==== //depot/projects/soc2005/ufsj/src/sys/ufs/ufs/ufsmount.h#2 (text+ko) ====

@@ -77,6 +77,7 @@
 	time_t	um_itime[MAXQUOTAS];		/* inode quota time limit */
 	char	um_qflags[MAXQUOTAS];		/* quota specific flags */
 	int64_t	um_savedmaxfilesize;		/* XXX - limit maxfilesize */
+	struct ufs_journal *um_journal;		/* Journal data */
 	int	(*um_balloc)(struct vnode *, off_t, int, struct ucred *, int, struct buf **);
 	int	(*um_blkatoff)(struct vnode *, off_t, char **, struct buf **);
 	int	(*um_truncate)(struct vnode *, off_t, int, struct ucred *, struct thread *);



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