try to flush all inodes when unmounting;
[unix-history] / usr / src / sys / ufs / lfs / lfs_alloc.c
index 5d2399b..4b3fa18 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)lfs_alloc.c 7.9 (Berkeley) %G%
+ *     @(#)lfs_alloc.c 7.11 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -160,7 +160,7 @@ realloccg(ip, bprev, bpref, osize, nsize, bpp)
                            fs->fs_dbsize);
 #else SECSIZE
                        error = bread(ip->i_devvp, fsbtodb(fs, bno),
                            fs->fs_dbsize);
 #else SECSIZE
                        error = bread(ip->i_devvp, fsbtodb(fs, bno),
-                               osize, &bp);
+                               osize, NOCRED, &bp);
                        if (error) {
                                brelse(bp);
                                return (error);
                        if (error) {
                                brelse(bp);
                                return (error);
@@ -225,7 +225,8 @@ realloccg(ip, bprev, bpref, osize, nsize, bpp)
                obp = bread(ip->i_dev, fsbtodb(fs, bprev), osize,
                    fs->fs_dbsize);
 #else SECSIZE
                obp = bread(ip->i_dev, fsbtodb(fs, bprev), osize,
                    fs->fs_dbsize);
 #else SECSIZE
-               error = bread(ip->i_devvp, fsbtodb(fs, bprev), osize, &obp);
+               error = bread(ip->i_devvp, fsbtodb(fs, bprev), 
+                       osize, NOCRED, &obp);
                if (error) {
                        brelse(obp);
                        return (error);
                if (error) {
                        brelse(obp);
                        return (error);
@@ -309,11 +310,11 @@ ialloc(pip, ipref, mode, ipp)
        if (ino == 0)
                goto noinodes;
        error = iget(pip, ino, ipp);
        if (ino == 0)
                goto noinodes;
        error = iget(pip, ino, ipp);
-       ip = *ipp;
        if (error) {
                ifree(pip, ino, 0);
                return (error);
        }
        if (error) {
                ifree(pip, ino, 0);
                return (error);
        }
+       ip = *ipp;
        if (ip->i_mode) {
                printf("mode = 0%o, inum = %d, fs = %s\n",
                    ip->i_mode, ip->i_number, fs->fs_fsmnt);
        if (ip->i_mode) {
                printf("mode = 0%o, inum = %d, fs = %s\n",
                    ip->i_mode, ip->i_number, fs->fs_fsmnt);
@@ -324,6 +325,12 @@ ialloc(pip, ipref, mode, ipp)
                    fs->fs_fsmnt, ino, ip->i_blocks);
                ip->i_blocks = 0;
        }
                    fs->fs_fsmnt, ino, ip->i_blocks);
                ip->i_blocks = 0;
        }
+       /*
+        * Set up a new generation number for this inode.
+        */
+       if (++nextgennumber < (u_long)time.tv_sec)
+               nextgennumber = time.tv_sec;
+       ip->i_gen = nextgennumber;
        return (0);
 noinodes:
        fserr(fs, "out of inodes");
        return (0);
 noinodes:
        fserr(fs, "out of inodes");
@@ -535,7 +542,7 @@ fragextend(ip, cg, bprev, osize, nsize)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (NULL);
        if (error) {
                brelse(bp);
                return (NULL);
@@ -603,7 +610,7 @@ alloccg(ip, cg, bpref, size)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (NULL);
        if (error) {
                brelse(bp);
                return (NULL);
@@ -809,7 +816,7 @@ ialloccg(ip, cg, ipref, mode)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (NULL);
        if (error) {
                brelse(bp);
                return (NULL);
@@ -901,7 +908,7 @@ blkfree(ip, bno, size)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return;
        if (error) {
                brelse(bp);
                return;
@@ -1001,7 +1008,7 @@ ifree(ip, ino, mode)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return;
        if (error) {
                brelse(bp);
                return;