39c39
< * $FreeBSD: head/sys/ufs/ffs/ffs_softdep.c 76354 2001-05-08 07:13:00Z mckusick $
---
> * $FreeBSD: head/sys/ufs/ffs/ffs_softdep.c 76357 2001-05-08 07:42:20Z mckusick $
59a60
> #include <sys/stat.h>
1728c1729
< panic("softde_setup_freeblocks: non-zero length");
---
> panic("softdep_setup_freeblocks: non-zero length");
1749a1751,1757
> * If the file was removed, then the space being freed was
> * accounted for then (see softdep_filereleased()). If the
> * file is merely being truncated, then we account for it now.
> */
> if ((ip->i_flag & IN_SPACECOUNTED) == 0)
> fs->fs_pendingblocks += freeblks->fb_chkcnt;
> /*
1988a1997,1998
> if ((ip->i_flag & IN_SPACECOUNTED) == 0)
> ip->i_fs->fs_pendinginodes += 1;
2120a2131
> fs->fs_pendingblocks -= nblocks;
2130a2142
> fs->fs_pendingblocks -= btodb(bsize);
2231a2244
> fs->fs_pendingblocks -= nblocks;
2782a2796,2836
> * Called when the effective link count and the reference count
> * on an inode drops to zero. At this point there are no names
> * referencing the file in the filesystem and no active file
> * references. The space associated with the file will be freed
> * as soon as the necessary soft dependencies are cleared.
> */
> void
> softdep_releasefile(ip)
> struct inode *ip; /* inode with the zero effective link count */
> {
> struct inodedep *inodedep;
>
> if (ip->i_effnlink > 0)
> panic("softdep_filerelease: file still referenced");
> /*
> * We may be called several times as the real reference count
> * drops to zero. We only want to account for the space once.
> */
> if (ip->i_flag & IN_SPACECOUNTED)
> return;
> /*
> * We have to deactivate a snapshot otherwise copyonwrites may
> * add blocks and the cleanup may remove blocks after we have
> * tried to account for them.
> */
> if ((ip->i_flags & SF_SNAPSHOT) != 0)
> ffs_snapremove(ITOV(ip));
> /*
> * If we are tracking an nlinkdelta, we have to also remember
> * whether we accounted for the freed space yet.
> */
> ACQUIRE_LOCK(&lk);
> if ((inodedep_lookup(ip->i_fs, ip->i_number, 0, &inodedep)))
> inodedep->id_state |= SPACECOUNTED;
> FREE_LOCK(&lk);
> ip->i_fs->fs_pendingblocks += ip->i_blocks;
> ip->i_fs->fs_pendinginodes += 1;
> ip->i_flag |= IN_SPACECOUNTED;
> }
>
> /*
2907a2962
> fs->fs_pendinginodes -= 1;
3781a3837,3838
> if (inodedep->id_state & SPACECOUNTED)
> ip->i_flag |= IN_SPACECOUNTED;
< * $FreeBSD: head/sys/ufs/ffs/ffs_softdep.c 76354 2001-05-08 07:13:00Z mckusick $
---
> * $FreeBSD: head/sys/ufs/ffs/ffs_softdep.c 76357 2001-05-08 07:42:20Z mckusick $
59a60
> #include <sys/stat.h>
1728c1729
< panic("softde_setup_freeblocks: non-zero length");
---
> panic("softdep_setup_freeblocks: non-zero length");
1749a1751,1757
> * If the file was removed, then the space being freed was
> * accounted for then (see softdep_filereleased()). If the
> * file is merely being truncated, then we account for it now.
> */
> if ((ip->i_flag & IN_SPACECOUNTED) == 0)
> fs->fs_pendingblocks += freeblks->fb_chkcnt;
> /*
1988a1997,1998
> if ((ip->i_flag & IN_SPACECOUNTED) == 0)
> ip->i_fs->fs_pendinginodes += 1;
2120a2131
> fs->fs_pendingblocks -= nblocks;
2130a2142
> fs->fs_pendingblocks -= btodb(bsize);
2231a2244
> fs->fs_pendingblocks -= nblocks;
2782a2796,2836
> * Called when the effective link count and the reference count
> * on an inode drops to zero. At this point there are no names
> * referencing the file in the filesystem and no active file
> * references. The space associated with the file will be freed
> * as soon as the necessary soft dependencies are cleared.
> */
> void
> softdep_releasefile(ip)
> struct inode *ip; /* inode with the zero effective link count */
> {
> struct inodedep *inodedep;
>
> if (ip->i_effnlink > 0)
> panic("softdep_filerelease: file still referenced");
> /*
> * We may be called several times as the real reference count
> * drops to zero. We only want to account for the space once.
> */
> if (ip->i_flag & IN_SPACECOUNTED)
> return;
> /*
> * We have to deactivate a snapshot otherwise copyonwrites may
> * add blocks and the cleanup may remove blocks after we have
> * tried to account for them.
> */
> if ((ip->i_flags & SF_SNAPSHOT) != 0)
> ffs_snapremove(ITOV(ip));
> /*
> * If we are tracking an nlinkdelta, we have to also remember
> * whether we accounted for the freed space yet.
> */
> ACQUIRE_LOCK(&lk);
> if ((inodedep_lookup(ip->i_fs, ip->i_number, 0, &inodedep)))
> inodedep->id_state |= SPACECOUNTED;
> FREE_LOCK(&lk);
> ip->i_fs->fs_pendingblocks += ip->i_blocks;
> ip->i_fs->fs_pendinginodes += 1;
> ip->i_flag |= IN_SPACECOUNTED;
> }
>
> /*
2907a2962
> fs->fs_pendinginodes -= 1;
3781a3837,3838
> if (inodedep->id_state & SPACECOUNTED)
> ip->i_flag |= IN_SPACECOUNTED;