summaryrefslogtreecommitdiffstats
path: root/sbin/fsck
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/fsck')
-rw-r--r--sbin/fsck/fsck.h2
-rw-r--r--sbin/fsck/inode.c4
-rw-r--r--sbin/fsck/setup.c1
3 files changed, 4 insertions, 3 deletions
diff --git a/sbin/fsck/fsck.h b/sbin/fsck/fsck.h
index f7ac12c..9d59c8f 100644
--- a/sbin/fsck/fsck.h
+++ b/sbin/fsck/fsck.h
@@ -182,7 +182,7 @@ struct inoinfo {
u_int i_numblks; /* size of block array in bytes */
ufs_daddr_t i_blks[1]; /* actually longer */
} **inphead, **inpsort;
-long numdirs, listmax, inplast;
+long numdirs, dirhash, listmax, inplast;
long countdirs; /* number of directories we actually found */
char *cdevname; /* name of device being checked */
diff --git a/sbin/fsck/inode.c b/sbin/fsck/inode.c
index 98295be..dbf86f7 100644
--- a/sbin/fsck/inode.c
+++ b/sbin/fsck/inode.c
@@ -396,7 +396,7 @@ cacheino(dp, inumber)
malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs_daddr_t));
if (inp == NULL)
errx(EEXIT, "cannot increase directory list");
- inpp = &inphead[inumber % numdirs];
+ inpp = &inphead[inumber % dirhash];
inp->i_nexthash = *inpp;
*inpp = inp;
inp->i_parent = inumber == ROOTINO ? ROOTINO : (ino_t)0;
@@ -424,7 +424,7 @@ getinoinfo(inumber)
{
register struct inoinfo *inp;
- for (inp = inphead[inumber % numdirs]; inp; inp = inp->i_nexthash) {
+ for (inp = inphead[inumber % dirhash]; inp; inp = inp->i_nexthash) {
if (inp->i_number != inumber)
continue;
return (inp);
diff --git a/sbin/fsck/setup.c b/sbin/fsck/setup.c
index 0df8e98..49bbc8d 100644
--- a/sbin/fsck/setup.c
+++ b/sbin/fsck/setup.c
@@ -286,6 +286,7 @@ setup(dev)
goto badsb;
}
numdirs = sblock.fs_cstotal.cs_ndir;
+ dirhash = numdirs;
if (numdirs == 0) {
printf("numdirs is zero, try using an alternate superblock\n");
goto badsb;
OpenPOWER on IntegriCloud