summaryrefslogtreecommitdiffstats
path: root/sbin/fsck
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2000-12-27 22:28:40 +0000
committerphk <phk@FreeBSD.org>2000-12-27 22:28:40 +0000
commit4d5209b3fed76945d343c8faa260d4a332526991 (patch)
tree53a07446b94ed7a4f96497a347259eca3c8a3210 /sbin/fsck
parent552eacf1e75b9bd910d2ee0ae1bbccb4b8c32d51 (diff)
downloadFreeBSD-src-4d5209b3fed76945d343c8faa260d4a332526991.zip
FreeBSD-src-4d5209b3fed76945d343c8faa260d4a332526991.tar.gz
When trying to deduce the diskname from the name so we can run
parallel fsck's one per drive, use the shortest prefix ending in a digit rather than the longest prefix ending in a digit. This makes "/dev/ad0s1a" and "/dev/ad0s2a" appear to both reside on the disk "/dev/ad0" and consequently they will be fsck'ed sequentially rather than in parallel as now. In general this heuristic is rather soft and errorprone. For instance ccd may often reside on two or more physical disks. A good solution would be to look for passes larger than 1 until no disks are found in a particular pass, that way people could put ccd stripes in pass 3... and have them fsck'ed sequentially. Reviewed by: mjacob
Diffstat (limited to 'sbin/fsck')
-rw-r--r--sbin/fsck/fsck.84
-rw-r--r--sbin/fsck/preen.c17
2 files changed, 13 insertions, 8 deletions
diff --git a/sbin/fsck/fsck.8 b/sbin/fsck/fsck.8
index a358007..edef23e 100644
--- a/sbin/fsck/fsck.8
+++ b/sbin/fsck/fsck.8
@@ -65,9 +65,9 @@ Filesystems with pass number 1 (normally just the root filesystem)
are checked one at a time.
When pass 1 completes, all remaining filesystems are checked,
running one process per disk drive.
-The disk drive containing each filesystem is inferred from the longest prefix
+The disk drive containing each filesystem is inferred from the shortest prefix
of the device name that ends in a digit; the remaining characters are assumed
-to be the partition designator.
+to be the partition and slice designator.
.Pp
The options are as follows:
.Bl -tag -width indent
diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c
index bd72d6b..e00e84e 100644
--- a/sbin/fsck/preen.c
+++ b/sbin/fsck/preen.c
@@ -259,12 +259,17 @@ finddisk(name)
size_t len = 0;
struct diskentry *d;
- for (len = strlen(name), p = name + len - 1; p >= name; --p)
- if (isdigit(*p)) {
- len = p - name + 1;
- break;
- }
- if (p < name)
+ 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)
OpenPOWER on IntegriCloud