insure that directories are always a multiple of DIRBLKSIZ in size
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 23 Feb 1985 07:12:31 +0000 (23:12 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 23 Feb 1985 07:12:31 +0000 (23:12 -0800)
SCCS-vsn: sys/kern/vfs_syscalls.c 6.16
SCCS-vsn: sys/ufs/ffs/ffs_vnops.c 6.16
SCCS-vsn: sys/ufs/ffs/ufs_vnops.c 6.16
SCCS-vsn: sys/ufs/lfs/lfs_vnops.c 6.16
SCCS-vsn: sys/ufs/ufs/ufs_vnops.c 6.16
SCCS-vsn: sys/kern/vfs_lookup.c 6.20
SCCS-vsn: sys/ufs/ffs/ufs_lookup.c 6.20
SCCS-vsn: sys/ufs/ufs/ufs_lookup.c 6.20

usr/src/sys/kern/vfs_lookup.c
usr/src/sys/kern/vfs_syscalls.c
usr/src/sys/ufs/ffs/ffs_vnops.c
usr/src/sys/ufs/ffs/ufs_lookup.c
usr/src/sys/ufs/ffs/ufs_vnops.c
usr/src/sys/ufs/lfs/lfs_vnops.c
usr/src/sys/ufs/ufs/ufs_lookup.c
usr/src/sys/ufs/ufs/ufs_vnops.c

index 6fee306..fc4389c 100644 (file)
@@ -1,4 +1,4 @@
-/*     vfs_lookup.c    6.19    85/02/20        */
+/*     vfs_lookup.c    6.20    85/02/22        */
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -909,6 +909,10 @@ direnter(ip, ndp)
                ndp->ni_dent.d_reclen = DIRBLKSIZ;
                error = rdwri(UIO_WRITE, dp, (caddr_t)&ndp->ni_dent,
                    newentrysize, ndp->ni_offset, 1, (int *)0);
                ndp->ni_dent.d_reclen = DIRBLKSIZ;
                error = rdwri(UIO_WRITE, dp, (caddr_t)&ndp->ni_dent,
                    newentrysize, ndp->ni_offset, 1, (int *)0);
+               if (DIRBLKSIZ > dp->i_fs->fs_fsize)
+                       panic("wdir: blksize"); /* XXX - should grow w/bmap() */
+               else
+                       dp->i_size = roundup(dp->i_size, DIRBLKSIZ);
                iput(dp);
                return (error);
        }
                iput(dp);
                return (error);
        }
@@ -926,6 +930,8 @@ direnter(ip, ndp)
         * Increase size of directory if entry eats into new space.
         * This should never push the size past a new multiple of
         * DIRBLKSIZE.
         * Increase size of directory if entry eats into new space.
         * This should never push the size past a new multiple of
         * DIRBLKSIZE.
+        *
+        * N.B. - THIS IS AN ARTIFACT OF 4.2 AND SHOULD NEVER HAPPEN.
         */
        if (ndp->ni_offset + ndp->ni_count > dp->i_size)
                dp->i_size = ndp->ni_offset + ndp->ni_count;
         */
        if (ndp->ni_offset + ndp->ni_count > dp->i_size)
                dp->i_size = ndp->ni_offset + ndp->ni_count;
index 18fa408..0a1df93 100644 (file)
@@ -1,4 +1,4 @@
-/*     vfs_syscalls.c  6.15    85/01/21        */
+/*     vfs_syscalls.c  6.16    85/02/22        */
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -1192,6 +1192,10 @@ mkdir()
                dp->i_flag |= ICHG;
                goto bad;
        }
                dp->i_flag |= ICHG;
                goto bad;
        }
+       if (DIRBLKSIZ > ip->i_fs->fs_fsize)
+               panic("mkdir: blksize");     /* XXX - should grow with bmap() */
+       else
+               ip->i_size = DIRBLKSIZ;
        /*
         * Directory all set up, now
         * install the entry for it in
        /*
         * Directory all set up, now
         * install the entry for it in
index 83f9482..62e8605 100644 (file)
@@ -1,4 +1,4 @@
-/*     ffs_vnops.c     6.15    85/01/21        */
+/*     ffs_vnops.c     6.16    85/02/22        */
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -1192,6 +1192,10 @@ mkdir()
                dp->i_flag |= ICHG;
                goto bad;
        }
                dp->i_flag |= ICHG;
                goto bad;
        }
+       if (DIRBLKSIZ > ip->i_fs->fs_fsize)
+               panic("mkdir: blksize");     /* XXX - should grow with bmap() */
+       else
+               ip->i_size = DIRBLKSIZ;
        /*
         * Directory all set up, now
         * install the entry for it in
        /*
         * Directory all set up, now
         * install the entry for it in
index f35525f..fff6c92 100644 (file)
@@ -1,4 +1,4 @@
-/*     ufs_lookup.c    6.19    85/02/20        */
+/*     ufs_lookup.c    6.20    85/02/22        */
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -909,6 +909,10 @@ direnter(ip, ndp)
                ndp->ni_dent.d_reclen = DIRBLKSIZ;
                error = rdwri(UIO_WRITE, dp, (caddr_t)&ndp->ni_dent,
                    newentrysize, ndp->ni_offset, 1, (int *)0);
                ndp->ni_dent.d_reclen = DIRBLKSIZ;
                error = rdwri(UIO_WRITE, dp, (caddr_t)&ndp->ni_dent,
                    newentrysize, ndp->ni_offset, 1, (int *)0);
+               if (DIRBLKSIZ > dp->i_fs->fs_fsize)
+                       panic("wdir: blksize"); /* XXX - should grow w/bmap() */
+               else
+                       dp->i_size = roundup(dp->i_size, DIRBLKSIZ);
                iput(dp);
                return (error);
        }
                iput(dp);
                return (error);
        }
@@ -926,6 +930,8 @@ direnter(ip, ndp)
         * Increase size of directory if entry eats into new space.
         * This should never push the size past a new multiple of
         * DIRBLKSIZE.
         * Increase size of directory if entry eats into new space.
         * This should never push the size past a new multiple of
         * DIRBLKSIZE.
+        *
+        * N.B. - THIS IS AN ARTIFACT OF 4.2 AND SHOULD NEVER HAPPEN.
         */
        if (ndp->ni_offset + ndp->ni_count > dp->i_size)
                dp->i_size = ndp->ni_offset + ndp->ni_count;
         */
        if (ndp->ni_offset + ndp->ni_count > dp->i_size)
                dp->i_size = ndp->ni_offset + ndp->ni_count;
index a4f808a..94b9fab 100644 (file)
@@ -1,4 +1,4 @@
-/*     ufs_vnops.c     6.15    85/01/21        */
+/*     ufs_vnops.c     6.16    85/02/22        */
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -1192,6 +1192,10 @@ mkdir()
                dp->i_flag |= ICHG;
                goto bad;
        }
                dp->i_flag |= ICHG;
                goto bad;
        }
+       if (DIRBLKSIZ > ip->i_fs->fs_fsize)
+               panic("mkdir: blksize");     /* XXX - should grow with bmap() */
+       else
+               ip->i_size = DIRBLKSIZ;
        /*
         * Directory all set up, now
         * install the entry for it in
        /*
         * Directory all set up, now
         * install the entry for it in
index 9124c7f..eb5538c 100644 (file)
@@ -1,4 +1,4 @@
-/*     lfs_vnops.c     6.15    85/01/21        */
+/*     lfs_vnops.c     6.16    85/02/22        */
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -1192,6 +1192,10 @@ mkdir()
                dp->i_flag |= ICHG;
                goto bad;
        }
                dp->i_flag |= ICHG;
                goto bad;
        }
+       if (DIRBLKSIZ > ip->i_fs->fs_fsize)
+               panic("mkdir: blksize");     /* XXX - should grow with bmap() */
+       else
+               ip->i_size = DIRBLKSIZ;
        /*
         * Directory all set up, now
         * install the entry for it in
        /*
         * Directory all set up, now
         * install the entry for it in
index f35525f..fff6c92 100644 (file)
@@ -1,4 +1,4 @@
-/*     ufs_lookup.c    6.19    85/02/20        */
+/*     ufs_lookup.c    6.20    85/02/22        */
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -909,6 +909,10 @@ direnter(ip, ndp)
                ndp->ni_dent.d_reclen = DIRBLKSIZ;
                error = rdwri(UIO_WRITE, dp, (caddr_t)&ndp->ni_dent,
                    newentrysize, ndp->ni_offset, 1, (int *)0);
                ndp->ni_dent.d_reclen = DIRBLKSIZ;
                error = rdwri(UIO_WRITE, dp, (caddr_t)&ndp->ni_dent,
                    newentrysize, ndp->ni_offset, 1, (int *)0);
+               if (DIRBLKSIZ > dp->i_fs->fs_fsize)
+                       panic("wdir: blksize"); /* XXX - should grow w/bmap() */
+               else
+                       dp->i_size = roundup(dp->i_size, DIRBLKSIZ);
                iput(dp);
                return (error);
        }
                iput(dp);
                return (error);
        }
@@ -926,6 +930,8 @@ direnter(ip, ndp)
         * Increase size of directory if entry eats into new space.
         * This should never push the size past a new multiple of
         * DIRBLKSIZE.
         * Increase size of directory if entry eats into new space.
         * This should never push the size past a new multiple of
         * DIRBLKSIZE.
+        *
+        * N.B. - THIS IS AN ARTIFACT OF 4.2 AND SHOULD NEVER HAPPEN.
         */
        if (ndp->ni_offset + ndp->ni_count > dp->i_size)
                dp->i_size = ndp->ni_offset + ndp->ni_count;
         */
        if (ndp->ni_offset + ndp->ni_count > dp->i_size)
                dp->i_size = ndp->ni_offset + ndp->ni_count;
index a4f808a..94b9fab 100644 (file)
@@ -1,4 +1,4 @@
-/*     ufs_vnops.c     6.15    85/01/21        */
+/*     ufs_vnops.c     6.16    85/02/22        */
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -1192,6 +1192,10 @@ mkdir()
                dp->i_flag |= ICHG;
                goto bad;
        }
                dp->i_flag |= ICHG;
                goto bad;
        }
+       if (DIRBLKSIZ > ip->i_fs->fs_fsize)
+               panic("mkdir: blksize");     /* XXX - should grow with bmap() */
+       else
+               ip->i_size = DIRBLKSIZ;
        /*
         * Directory all set up, now
         * install the entry for it in
        /*
         * Directory all set up, now
         * install the entry for it in