use new `cacheinval' macro
[unix-history] / usr / src / sys / ufs / ffs / ufs_inode.c
index 5e9a9eb..0e2a292 100644 (file)
@@ -1,4 +1,4 @@
-/*     ufs_inode.c     6.5     84/06/27        */
+/*     ufs_inode.c     6.9     84/07/20        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -108,6 +108,7 @@ iget(dev, fs, ino)
        register struct dinode *dp;
        register struct inode *iq;
 
        register struct dinode *dp;
        register struct inode *iq;
 
+
 loop:
        ih = &ihead[INOHASH(dev, ino)];
        for (ip = ih->ih_chain[0]; ip != (struct inode *)ih; ip = ip->i_forw)
 loop:
        ih = &ihead[INOHASH(dev, ino)];
        for (ip = ih->ih_chain[0]; ip != (struct inode *)ih; ip = ip->i_forw)
@@ -153,6 +154,8 @@ loop:
                u.u_error = ENFILE;
                return(NULL);
        }
                u.u_error = ENFILE;
                return(NULL);
        }
+       if (ip->i_count)
+               panic("free inode isn't");
        if (iq = ip->i_freef)
                iq->i_freeb = &ifreeh;
        ifreeh = iq;
        if (iq = ip->i_freef)
                iq->i_freeb = &ifreeh;
        ifreeh = iq;
@@ -167,22 +170,16 @@ loop:
         */
        remque(ip);
        insque(ip, ih);
         */
        remque(ip);
        insque(ip, ih);
-#ifdef QUOTA
-       dqrele(ip->i_dquot);
-#endif
        ip->i_dev = dev;
        ip->i_fs = fs;
        ip->i_number = ino;
        ip->i_dev = dev;
        ip->i_fs = fs;
        ip->i_number = ino;
-       ip->i_id = ++nextinodeid;       /* also used in rename */
-       /*
-        * At an absurd rate of 100 calls/second,
-        * this should occur once every 16 months.
-        */
-       if (nextinodeid == 0)
-               panic("iget: wrap");
+       cacheinval(ip);
        ip->i_flag = ILOCKED;
        ip->i_count++;
        ip->i_lastr = 0;
        ip->i_flag = ILOCKED;
        ip->i_count++;
        ip->i_lastr = 0;
+#ifdef QUOTA
+       dqrele(ip->i_dquot);
+#endif
        bp = bread(dev, fsbtodb(fs, itod(fs, ino)), (int)fs->fs_bsize);
        /*
         * Check I/O errors
        bp = bread(dev, fsbtodb(fs, itod(fs, ino)), (int)fs->fs_bsize);
        /*
         * Check I/O errors
@@ -266,7 +263,7 @@ iput(ip)
 
        if ((ip->i_flag & ILOCKED) == 0)
                panic("iput");
 
        if ((ip->i_flag & ILOCKED) == 0)
                panic("iput");
-       iunlock(ip);
+       IUNLOCK(ip);
        irele(ip);
 }
 
        irele(ip);
 }
 
@@ -291,7 +288,7 @@ irele(ip)
 #endif
                }
                IUPDAT(ip, &time, &time, 0);
 #endif
                }
                IUPDAT(ip, &time, &time, 0);
-               iunlock(ip);
+               IUNLOCK(ip);
                ip->i_flag = 0;
                /*
                 * Put the inode on the end of the free list.
                ip->i_flag = 0;
                /*
                 * Put the inode on the end of the free list.