corresponding change in lfs_segment.c on inode allocation
SCCS-vsn: sys/ufs/lfs/lfs_alloc.c 7.41
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)lfs_alloc.c 7.40 (Berkeley) %G%
+ * @(#)lfs_alloc.c 7.41 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
ino_t notused1;
int notused2;
{
ino_t notused1;
int notused2;
{
struct buf *bp;
struct ifile *ifp;
struct inode *ip;
struct lfs *fs;
struct buf *bp;
struct ifile *ifp;
struct inode *ip;
struct lfs *fs;
ino_t ino;
ip = VTOI(vp);
ino_t ino;
ip = VTOI(vp);
* and link it into the free chain.
*/
LFS_IENTRY(ifp, fs, ino, bp);
* and link it into the free chain.
*/
LFS_IENTRY(ifp, fs, ino, bp);
+ old_iaddr = ifp->if_daddr;
ifp->if_daddr = LFS_UNUSED_DADDR;
++ifp->if_version;
ifp->if_nextfree = fs->lfs_free;
fs->lfs_free = ino;
LFS_UBWRITE(bp);
ifp->if_daddr = LFS_UNUSED_DADDR;
++ifp->if_version;
ifp->if_nextfree = fs->lfs_free;
fs->lfs_free = ino;
LFS_UBWRITE(bp);
+ if (old_iaddr != LFS_UNUSED_DADDR) {
+ LFS_SEGENTRY(sup, fs, datosn(fs, old_iaddr), bp);
+#ifdef DIAGNOSTIC
+ if (sup->su_nbytes < sizeof(struct dinode))
+ panic("lfs_vfree: negative byte count (segment %d)\n",
+ datosn(fs, old_iaddr));
+#endif
+ sup->su_nbytes -= sizeof(struct dinode);
+ LFS_UBWRITE(bp);
+ }
+
/* Set superblock modified bit and decrement file count. */
fs->lfs_fmod = 1;
--fs->lfs_nfiles;
/* Set superblock modified bit and decrement file count. */
fs->lfs_fmod = 1;
--fs->lfs_nfiles;