Index: fsck.8 =================================================================== RCS file: /home/ncvs/src/sbin/fsck/fsck.8,v retrieving revision 1.37 diff -a -u -r1.37 fsck.8 --- fsck.8 10 Feb 2005 09:19:29 -0000 1.37 +++ fsck.8 24 Oct 2006 13:22:56 -0000 @@ -37,7 +37,7 @@ .Nd file system consistency check and interactive repair .Sh SYNOPSIS .Nm -.Op Fl dfnpvy +.Op Fl PQdfnpvy .Op Fl B | F .Op Fl T Ar fstype : Ns Ar fsoptions .Op Fl t Ar fstype @@ -91,19 +91,19 @@ File systems with pass number 1 (normally just the root file system) are always checked one at a time. .Pp -If not in preen mode, the remaining entries are checked in order of +If not in parallel mode, the remaining entries are checked in order of increasing pass number one at a time. This is needed when interaction with .Nm is required. .Pp -In preen mode, after pass 1 completes, all remaining file systems are checked, +In parallel mode, after pass 1 completes, all remaining file systems are checked, in pass number order running one process per disk drive in parallel for each pass number in increasing order. .Pp -In other words: In preen mode all pass 1 partitions are checked sequentially. +In other words: In parallel mode all pass 1 partitions are checked sequentially. Next all pass 2 partitions are checked in parallel, one process per disk drive. -Next all pass 3 partitions are checked in parallel, one process per disk drive. +Next all pass 3 partitions are checked in parallel, one process per disk drive, etc. .Pp The disk drive containing each file system is inferred from the shortest prefix @@ -112,6 +112,11 @@ .Pp The options are as follows: .Bl -tag -width indent +.It Fl P +Parallel mode (see above). +.It Fl Q +Full parallel mode. +The restriction of one process per disk drive is not obeyed. .It Fl d Debugging mode. Just print the commands without executing them. @@ -136,6 +141,8 @@ See the manual pages for the individual check programs for a list of the sorts of failures that they correct when running in preen mode. +.Pp +Preen mode implies parallel mode. .It Fl F Run in foreground mode. The check program for each file system is invoked with the Index: fsck.c =================================================================== RCS file: /home/ncvs/src/sbin/fsck/fsck.c,v retrieving revision 1.18 diff -a -u -r1.18 fsck.c --- fsck.c 10 Feb 2005 09:19:29 -0000 1.18 +++ fsck.c 24 Oct 2006 13:22:56 -0000 @@ -103,7 +103,7 @@ TAILQ_INIT(&selhead); TAILQ_INIT(&opthead); - while ((i = getopt(argc, argv, "BdvpfFnyl:t:T:")) != -1) + while ((i = getopt(argc, argv, "BdvPQpfFnyl:t:T:")) != -1) switch (i) { case 'B': if (flags & CHECK_BACKGRD) @@ -125,8 +125,18 @@ flags |= CHECK_BACKGRD; break; + case 'P': + flags |= CHECK_PARALLEL; + break; + + case 'Q': + flags |= CHECK_PARALLEL; + flags |= CHECK_FULLPARALLEL; + break; + case 'p': flags |= CHECK_PREEN; + flags |= CHECK_PARALLEL; /*FALLTHROUGH*/ case 'n': case 'y': @@ -566,7 +576,7 @@ usage(void) { static const char common[] = - "[-dfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]"; + "[-PQdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]"; (void)fprintf(stderr, "usage: %s %s [special | node] ...\n", getprogname(), common); Index: fsutil.h =================================================================== RCS file: /home/ncvs/src/sbin/fsck/fsutil.h,v retrieving revision 1.8 diff -a -u -r1.8 fsutil.h --- fsutil.h 27 Dec 2003 13:54:02 -0000 1.8 +++ fsutil.h 24 Oct 2006 13:22:56 -0000 @@ -48,6 +48,8 @@ #define CHECK_DEBUG 0x0004 #define CHECK_BACKGRD 0x0008 #define DO_BACKGRD 0x0010 +#define CHECK_PARALLEL 0x0020 +#define CHECK_FULLPARALLEL 0x0040 struct fstab; int checkfstab(int, int (*)(struct fstab *), Index: preen.c =================================================================== RCS file: /home/ncvs/src/sbin/fsck/preen.c,v retrieving revision 1.28 diff -a -u -r1.28 preen.c --- preen.c 9 Apr 2004 19:58:28 -0000 1.28 +++ preen.c 24 Oct 2006 13:22:56 -0000 @@ -75,8 +75,8 @@ static int nrun = 0, ndisks = 0; -static struct diskentry *finddisk(const char *); -static void addpart(const char *, const char *, const char *); +static struct diskentry *finddisk(const char *, const int); +static void addpart(const char *, const char *, const char *, const int); static int startdisk(struct diskentry *, int (*)(const char *, const char *, const char *, char *, pid_t *)); static void printpart(void); @@ -120,7 +120,7 @@ if (flags & CHECK_DEBUG) printf("pass %d, name %s\n", passno, name); - if ((flags & CHECK_PREEN) == 0 || passno == 1 || + if ((flags & CHECK_PARALLEL) == 0 || passno == 1 || (flags & DO_BACKGRD) != 0) { if (name == NULL) { if (flags & CHECK_PREEN) @@ -141,10 +141,10 @@ sumstatus |= 8; continue; } - addpart(fs->fs_vfstype, name, fs->fs_file); + addpart(fs->fs_vfstype, name, fs->fs_file, flags); } - if ((flags & CHECK_PREEN) == 0 || passno == 1 || + if ((flags & CHECK_PARALLEL) == 0 || passno == 1 || (flags & DO_BACKGRD) != 0) continue; @@ -243,24 +243,29 @@ static struct diskentry * -finddisk(const char *name) +finddisk(const char *name, const int flags) { const char *p; size_t len = 0; struct diskentry *d; - p = strrchr(name, '/'); - if (p == NULL) + if (flags & CHECK_FULLPARALLEL) { p = name; - else - p++; - for (; *p && !isdigit(*p); p++) - continue; - for (; *p && isdigit(*p); p++) - continue; - len = p - name; - if (len == 0) len = strlen(name); + } else { + p = strrchr(name, '/'); + if (p == NULL) + p = name; + else + p++; + for (; *p && !isdigit(*p); p++) + continue; + for (; *p && isdigit(*p); p++) + continue; + len = p - name; + if (len == 0) + len = strlen(name); + } TAILQ_FOREACH(d, &diskh, d_entries) if (strncmp(d->d_name, name, len) == 0 && d->d_name[len] == 0) @@ -295,9 +300,9 @@ static void -addpart(const char *type, const char *devname, const char *mntpt) +addpart(const char *type, const char *devname, const char *mntpt, const int flags) { - struct diskentry *d = finddisk(devname); + struct diskentry *d = finddisk(devname, flags); struct partentry *p; TAILQ_FOREACH(p, &d->d_part, p_entries)