always round down directory offset to a DIRBLK boundry
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Mon, 5 May 1986 06:09:13 +0000 (22:09 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Mon, 5 May 1986 06:09:13 +0000 (22:09 -0800)
SCCS-vsn: sys/kern/vfs_lookup.c 6.30
SCCS-vsn: sys/ufs/ffs/ufs_lookup.c 6.30
SCCS-vsn: sys/ufs/ufs/ufs_lookup.c 6.30

usr/src/sys/kern/vfs_lookup.c
usr/src/sys/ufs/ffs/ufs_lookup.c
usr/src/sys/ufs/ufs/ufs_lookup.c

index e45cd05..3376014 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)vfs_lookup.c        6.29 (Berkeley) %G%
+ *     @(#)vfs_lookup.c        6.30 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -305,7 +305,7 @@ dirloop2:
                                if (!isdotdot || dp != u.u_rdir)
                                        dp = ncp->nc_ip;
                                if (dp == NULL)
                                if (!isdotdot || dp != u.u_rdir)
                                        dp = ncp->nc_ip;
                                if (dp == NULL)
-                                       panic("nami: null cache ino");
+                                       panic("namei: null cache ino");
                                if (pdp == dp)
                                        dp->i_count++;
                                else if (isdotdot) {
                                if (pdp == dp)
                                        dp->i_count++;
                                else if (isdotdot) {
@@ -385,14 +385,8 @@ dirloop2:
                ndp->ni_offset = 0;
                numdirpasses = 1;
        } else {
                ndp->ni_offset = 0;
                numdirpasses = 1;
        } else {
-               if ((dp->i_flag & (ICHG|IMOD)) ||
-                   dp->i_ctime >= u.u_ncache.nc_time) {
-                       if (u.u_ncache.nc_prevoffset > dp->i_size)
-                               u.u_ncache.nc_prevoffset = 0;
-                       else
-                               u.u_ncache.nc_prevoffset &= ~(DIRBLKSIZ - 1);
-                       u.u_ncache.nc_time = time.tv_sec;
-               }
+               if (u.u_ncache.nc_prevoffset > dp->i_size)
+                       u.u_ncache.nc_prevoffset = 0;
                ndp->ni_offset = u.u_ncache.nc_prevoffset;
                entryoffsetinblock = blkoff(fs, ndp->ni_offset);
                if (entryoffsetinblock != 0) {
                ndp->ni_offset = u.u_ncache.nc_prevoffset;
                entryoffsetinblock = blkoff(fs, ndp->ni_offset);
                if (entryoffsetinblock != 0) {
@@ -570,10 +564,9 @@ found:
         * in the cache as to where the entry was found.
         */
        if (*cp == '\0' && flag == LOOKUP) {
         * in the cache as to where the entry was found.
         */
        if (*cp == '\0' && flag == LOOKUP) {
-               u.u_ncache.nc_prevoffset = ndp->ni_offset;
+               u.u_ncache.nc_prevoffset = ndp->ni_offset &~ (DIRBLKSIZ - 1);
                u.u_ncache.nc_inumber = dp->i_number;
                u.u_ncache.nc_dev = dp->i_dev;
                u.u_ncache.nc_inumber = dp->i_number;
                u.u_ncache.nc_dev = dp->i_dev;
-               u.u_ncache.nc_time = time.tv_sec;
        }
        /*
         * Save directory entry's inode number and reclen in ndp->ni_dent,
        }
        /*
         * Save directory entry's inode number and reclen in ndp->ni_dent,
@@ -731,7 +724,7 @@ found:
         */
        if (makeentry) {
                if (ncp != NULL)
         */
        if (makeentry) {
                if (ncp != NULL)
-                       panic("nami: duplicating cache");
+                       panic("namei: duplicating cache");
                /*
                 * Free the cache slot at head of lru chain.
                 */
                /*
                 * Free the cache slot at head of lru chain.
                 */
index 7bbc8b7..2d9e3eb 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ufs_lookup.c        6.29 (Berkeley) %G%
+ *     @(#)ufs_lookup.c        6.30 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -305,7 +305,7 @@ dirloop2:
                                if (!isdotdot || dp != u.u_rdir)
                                        dp = ncp->nc_ip;
                                if (dp == NULL)
                                if (!isdotdot || dp != u.u_rdir)
                                        dp = ncp->nc_ip;
                                if (dp == NULL)
-                                       panic("nami: null cache ino");
+                                       panic("namei: null cache ino");
                                if (pdp == dp)
                                        dp->i_count++;
                                else if (isdotdot) {
                                if (pdp == dp)
                                        dp->i_count++;
                                else if (isdotdot) {
@@ -385,14 +385,8 @@ dirloop2:
                ndp->ni_offset = 0;
                numdirpasses = 1;
        } else {
                ndp->ni_offset = 0;
                numdirpasses = 1;
        } else {
-               if ((dp->i_flag & (ICHG|IMOD)) ||
-                   dp->i_ctime >= u.u_ncache.nc_time) {
-                       if (u.u_ncache.nc_prevoffset > dp->i_size)
-                               u.u_ncache.nc_prevoffset = 0;
-                       else
-                               u.u_ncache.nc_prevoffset &= ~(DIRBLKSIZ - 1);
-                       u.u_ncache.nc_time = time.tv_sec;
-               }
+               if (u.u_ncache.nc_prevoffset > dp->i_size)
+                       u.u_ncache.nc_prevoffset = 0;
                ndp->ni_offset = u.u_ncache.nc_prevoffset;
                entryoffsetinblock = blkoff(fs, ndp->ni_offset);
                if (entryoffsetinblock != 0) {
                ndp->ni_offset = u.u_ncache.nc_prevoffset;
                entryoffsetinblock = blkoff(fs, ndp->ni_offset);
                if (entryoffsetinblock != 0) {
@@ -570,10 +564,9 @@ found:
         * in the cache as to where the entry was found.
         */
        if (*cp == '\0' && flag == LOOKUP) {
         * in the cache as to where the entry was found.
         */
        if (*cp == '\0' && flag == LOOKUP) {
-               u.u_ncache.nc_prevoffset = ndp->ni_offset;
+               u.u_ncache.nc_prevoffset = ndp->ni_offset &~ (DIRBLKSIZ - 1);
                u.u_ncache.nc_inumber = dp->i_number;
                u.u_ncache.nc_dev = dp->i_dev;
                u.u_ncache.nc_inumber = dp->i_number;
                u.u_ncache.nc_dev = dp->i_dev;
-               u.u_ncache.nc_time = time.tv_sec;
        }
        /*
         * Save directory entry's inode number and reclen in ndp->ni_dent,
        }
        /*
         * Save directory entry's inode number and reclen in ndp->ni_dent,
@@ -731,7 +724,7 @@ found:
         */
        if (makeentry) {
                if (ncp != NULL)
         */
        if (makeentry) {
                if (ncp != NULL)
-                       panic("nami: duplicating cache");
+                       panic("namei: duplicating cache");
                /*
                 * Free the cache slot at head of lru chain.
                 */
                /*
                 * Free the cache slot at head of lru chain.
                 */
index 7bbc8b7..2d9e3eb 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ufs_lookup.c        6.29 (Berkeley) %G%
+ *     @(#)ufs_lookup.c        6.30 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -305,7 +305,7 @@ dirloop2:
                                if (!isdotdot || dp != u.u_rdir)
                                        dp = ncp->nc_ip;
                                if (dp == NULL)
                                if (!isdotdot || dp != u.u_rdir)
                                        dp = ncp->nc_ip;
                                if (dp == NULL)
-                                       panic("nami: null cache ino");
+                                       panic("namei: null cache ino");
                                if (pdp == dp)
                                        dp->i_count++;
                                else if (isdotdot) {
                                if (pdp == dp)
                                        dp->i_count++;
                                else if (isdotdot) {
@@ -385,14 +385,8 @@ dirloop2:
                ndp->ni_offset = 0;
                numdirpasses = 1;
        } else {
                ndp->ni_offset = 0;
                numdirpasses = 1;
        } else {
-               if ((dp->i_flag & (ICHG|IMOD)) ||
-                   dp->i_ctime >= u.u_ncache.nc_time) {
-                       if (u.u_ncache.nc_prevoffset > dp->i_size)
-                               u.u_ncache.nc_prevoffset = 0;
-                       else
-                               u.u_ncache.nc_prevoffset &= ~(DIRBLKSIZ - 1);
-                       u.u_ncache.nc_time = time.tv_sec;
-               }
+               if (u.u_ncache.nc_prevoffset > dp->i_size)
+                       u.u_ncache.nc_prevoffset = 0;
                ndp->ni_offset = u.u_ncache.nc_prevoffset;
                entryoffsetinblock = blkoff(fs, ndp->ni_offset);
                if (entryoffsetinblock != 0) {
                ndp->ni_offset = u.u_ncache.nc_prevoffset;
                entryoffsetinblock = blkoff(fs, ndp->ni_offset);
                if (entryoffsetinblock != 0) {
@@ -570,10 +564,9 @@ found:
         * in the cache as to where the entry was found.
         */
        if (*cp == '\0' && flag == LOOKUP) {
         * in the cache as to where the entry was found.
         */
        if (*cp == '\0' && flag == LOOKUP) {
-               u.u_ncache.nc_prevoffset = ndp->ni_offset;
+               u.u_ncache.nc_prevoffset = ndp->ni_offset &~ (DIRBLKSIZ - 1);
                u.u_ncache.nc_inumber = dp->i_number;
                u.u_ncache.nc_dev = dp->i_dev;
                u.u_ncache.nc_inumber = dp->i_number;
                u.u_ncache.nc_dev = dp->i_dev;
-               u.u_ncache.nc_time = time.tv_sec;
        }
        /*
         * Save directory entry's inode number and reclen in ndp->ni_dent,
        }
        /*
         * Save directory entry's inode number and reclen in ndp->ni_dent,
@@ -731,7 +724,7 @@ found:
         */
        if (makeentry) {
                if (ncp != NULL)
         */
        if (makeentry) {
                if (ncp != NULL)
-                       panic("nami: duplicating cache");
+                       panic("namei: duplicating cache");
                /*
                 * Free the cache slot at head of lru chain.
                 */
                /*
                 * Free the cache slot at head of lru chain.
                 */