* Copyright (c) 1991 Regents of the University of California.
* %sccs.include.redist.c%
* @(#)ufs_inode.c 7.46 (Berkeley) %G%
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
#include <ufs/ufs/ufsmount.h>
#include <ufs/ufs/ufs_extern.h>
u_long nextgennumber
; /* Next generation number to assign. */
int prtactive
= 0; /* 1 => print out reclaim of active vnodes */
if ((sizeof(struct inode
) - 1) & sizeof(struct inode
))
printf("ufs_init: bad size %d\n", sizeof(struct inode
));
* Unlock and decrement the reference count of an inode structure.
register struct inode
*ip
;
if ((ip
->i_flag
& ILOCKED
) == 0)
* Reclaim an inode so that it can be used for other purposes.
struct vop_reclaim_args
*ap
;
register struct inode
*ip
;
if (prtactive
&& ap
->a_vp
->v_usecount
!= 0)
vprint("ufs_reclaim: pushing active", ap
->a_vp
);
* Remove the inode from its hash chain.
* Purge old data structures associated with the inode.
for (i
= 0; i
< MAXQUOTAS
; i
++) {
if (ip
->i_dquot
[i
] != NODQUOT
) {
dqrele(ap
->a_vp
, ip
->i_dquot
[i
]);
ip
->i_dquot
[i
] = NODQUOT
;
switch (ap
->a_vp
->v_mount
->mnt_stat
.f_type
) {
panic("ufs_reclaim: not ufs file");
FREE(ap
->a_vp
->v_data
, type
);
* Lock an inode. If its already locked, set the WANT bit and sleep.
register struct inode
*ip
;
struct proc
*p
= curproc
; /* XXX */
while (ip
->i_flag
& ILOCKED
) {
if (p
->p_pid
== ip
->i_lockholder
)
panic("locking against myself");
ip
->i_lockwaiter
= p
->p_pid
;
(void) sleep((caddr_t
)ip
, PINOD
);
ip
->i_lockholder
= p
->p_pid
;
* Unlock an inode. If WANT bit is on, wakeup.
register struct inode
*ip
;
if ((ip
->i_flag
& ILOCKED
) == 0)
vprint("ufs_iunlock: unlocked inode", ITOV(ip
));