ufs_inode.c (96506) | ufs_inode.c (98542) |
---|---|
1/* 2 * Copyright (c) 1991, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)ufs_inode.c 8.9 (Berkeley) 5/14/95 | 1/* 2 * Copyright (c) 1991, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)ufs_inode.c 8.9 (Berkeley) 5/14/95 |
39 * $FreeBSD: head/sys/ufs/ufs/ufs_inode.c 96506 2002-05-13 09:22:31Z phk $ | 39 * $FreeBSD: head/sys/ufs/ufs/ufs_inode.c 98542 2002-06-21 06:18:05Z mckusick $ |
40 */ 41 42#include "opt_quota.h" 43#include "opt_ufs.h" 44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/vnode.h> --- 20 unchanged lines hidden (view full) --- 68 struct vop_inactive_args /* { 69 struct vnode *a_vp; 70 struct thread *a_td; 71 } */ *ap; 72{ 73 struct vnode *vp = ap->a_vp; 74 struct inode *ip = VTOI(vp); 75 struct thread *td = ap->a_td; | 40 */ 41 42#include "opt_quota.h" 43#include "opt_ufs.h" 44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/vnode.h> --- 20 unchanged lines hidden (view full) --- 68 struct vop_inactive_args /* { 69 struct vnode *a_vp; 70 struct thread *a_td; 71 } */ *ap; 72{ 73 struct vnode *vp = ap->a_vp; 74 struct inode *ip = VTOI(vp); 75 struct thread *td = ap->a_td; |
76 int mode, error = 0; | 76 mode_t mode; 77 int error = 0; |
77 78 if (prtactive && vp->v_usecount != 0) 79 vprint("ufs_inactive: pushing active", vp); 80 81 /* 82 * Ignore inodes related to stale file handles. 83 */ 84 if (ip->i_mode == 0) --- 11 unchanged lines hidden (view full) --- 96#endif 97 error = UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED, td); 98 /* 99 * Setting the mode to zero needs to wait for the inode 100 * to be written just as does a change to the link count. 101 * So, rather than creating a new entry point to do the 102 * same thing, we just use softdep_change_linkcnt(). 103 */ | 78 79 if (prtactive && vp->v_usecount != 0) 80 vprint("ufs_inactive: pushing active", vp); 81 82 /* 83 * Ignore inodes related to stale file handles. 84 */ 85 if (ip->i_mode == 0) --- 11 unchanged lines hidden (view full) --- 97#endif 98 error = UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED, td); 99 /* 100 * Setting the mode to zero needs to wait for the inode 101 * to be written just as does a change to the link count. 102 * So, rather than creating a new entry point to do the 103 * same thing, we just use softdep_change_linkcnt(). 104 */ |
104 ip->i_rdev = 0; | 105 DIP(ip, i_rdev) = 0; |
105 mode = ip->i_mode; 106 ip->i_mode = 0; | 106 mode = ip->i_mode; 107 ip->i_mode = 0; |
108 DIP(ip, i_mode) = 0; |
|
107 ip->i_flag |= IN_CHANGE | IN_UPDATE; 108 if (DOINGSOFTDEP(vp)) 109 softdep_change_linkcnt(ip); 110 UFS_VFREE(vp, ip->i_number, mode); 111 } 112 if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) { 113 if ((ip->i_flag & (IN_CHANGE | IN_UPDATE | IN_MODIFIED)) == 0 && 114 vn_write_suspend_wait(vp, NULL, V_NOWAIT)) { --- 19 unchanged lines hidden (view full) --- 134 */ 135int 136ufs_reclaim(ap) 137 struct vop_reclaim_args /* { 138 struct vnode *a_vp; 139 struct thread *a_td; 140 } */ *ap; 141{ | 109 ip->i_flag |= IN_CHANGE | IN_UPDATE; 110 if (DOINGSOFTDEP(vp)) 111 softdep_change_linkcnt(ip); 112 UFS_VFREE(vp, ip->i_number, mode); 113 } 114 if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) { 115 if ((ip->i_flag & (IN_CHANGE | IN_UPDATE | IN_MODIFIED)) == 0 && 116 vn_write_suspend_wait(vp, NULL, V_NOWAIT)) { --- 19 unchanged lines hidden (view full) --- 136 */ 137int 138ufs_reclaim(ap) 139 struct vop_reclaim_args /* { 140 struct vnode *a_vp; 141 struct thread *a_td; 142 } */ *ap; 143{ |
142 struct inode *ip; | |
143 struct vnode *vp = ap->a_vp; | 144 struct vnode *vp = ap->a_vp; |
145 struct inode *ip = VTOI(vp); 146 struct ufsmount *ump = ip->i_ump; |
|
144#ifdef QUOTA 145 int i; 146#endif 147 148 if (prtactive && vp->v_usecount != 0) 149 vprint("ufs_reclaim: pushing active", vp); | 147#ifdef QUOTA 148 int i; 149#endif 150 151 if (prtactive && vp->v_usecount != 0) 152 vprint("ufs_reclaim: pushing active", vp); |
150 ip = VTOI(vp); | |
151 if (ip->i_flag & IN_LAZYMOD) { 152 ip->i_flag |= IN_MODIFIED; 153 UFS_UPDATE(vp, 0); 154 } 155 /* 156 * Remove the inode from its hash chain. 157 */ 158 ufs_ihashrem(ip); --- 13 unchanged lines hidden (view full) --- 172 } 173 } 174#endif 175 lockdestroy(&vp->v_lock); 176#ifdef UFS_DIRHASH 177 if (ip->i_dirhash != NULL) 178 ufsdirhash_free(ip); 179#endif | 153 if (ip->i_flag & IN_LAZYMOD) { 154 ip->i_flag |= IN_MODIFIED; 155 UFS_UPDATE(vp, 0); 156 } 157 /* 158 * Remove the inode from its hash chain. 159 */ 160 ufs_ihashrem(ip); --- 13 unchanged lines hidden (view full) --- 174 } 175 } 176#endif 177 lockdestroy(&vp->v_lock); 178#ifdef UFS_DIRHASH 179 if (ip->i_dirhash != NULL) 180 ufsdirhash_free(ip); 181#endif |
180 FREE(vp->v_data, VFSTOUFS(vp->v_mount)->um_malloctype); | 182 if (ump->um_fstype == UFS1) 183 FREE(ip->i_din1, ump->um_malloctype); 184 else 185 FREE(ip->i_din2, ump->um_malloctype); 186 FREE(vp->v_data, ump->um_malloctype); |
181 vp->v_data = 0; 182 return (0); 183} | 187 vp->v_data = 0; 188 return (0); 189} |