aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs/ufs/ufs_inode.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2019-12-10 14:07:05 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2019-12-10 14:07:05 +0000
commit332f313c4533aa61c908de0d0f036eeec2502008 (patch)
tree65f731427f4ee21d9fc9a689d91520b51fd05304 /sys/ufs/ufs/ufs_inode.c
parent061346b27134672d8f7d25cc32efb97c8bde0715 (diff)
downloadsrc-332f313c4533aa61c908de0d0f036eeec2502008.tar.gz
src-332f313c4533aa61c908de0d0f036eeec2502008.zip
UFS: implement VOP_INACTIVE()
The checks literally repeat conditions that make ufs_inactive() to take some actions. Reviewed by: jeff Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D22616
Notes
Notes: svn path=/head/; revision=355584
Diffstat (limited to 'sys/ufs/ufs/ufs_inode.c')
-rw-r--r--sys/ufs/ufs/ufs_inode.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c
index 53c259f07f40..d6242986993c 100644
--- a/sys/ufs/ufs/ufs_inode.c
+++ b/sys/ufs/ufs/ufs_inode.c
@@ -63,6 +63,40 @@ __FBSDID("$FreeBSD$");
#include <ufs/ufs/gjournal.h>
#endif
+int
+ufs_need_inactive(ap)
+ struct vop_need_inactive_args *ap;
+{
+ struct vnode *vp;
+ struct inode *ip;
+#ifdef QUOTA
+ int i;
+#endif
+
+ vp = ap->a_vp;
+ ip = VTOI(vp);
+ if (UFS_RDONLY(ip))
+ return (0);
+ if (ip->i_mode == 0 || ip->i_nlink <= 0 ||
+ (ip->i_effnlink == 0 && DOINGSOFTDEP(vp)) ||
+ (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED |
+ IN_UPDATE)) != 0 ||
+ (ip->i_effnlink <= 0 && (ip->i_size != 0 || (I_IS_UFS2(ip) &&
+ ip->i_din2->di_extsize != 0))))
+ return (1);
+#ifdef QUOTA
+ for (i = 0; i < MAXQUOTAS; i++) {
+ if (ip->i_dquot[i] != NULL)
+ return (1);
+ }
+#endif
+ /*
+ * No need to check ufs_gjournal_close() condition since we
+ * return 1 if only i_nlink <= 0.
+ */
+ return (0);
+}
+
/*
* Last reference to an inode. If necessary, write or delete it.
*/