Date: Tue, 10 Dec 2019 14:07:05 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355584 - head/sys/ufs/ufs Message-ID: <201912101407.xBAE75Sa086337@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Dec 10 14:07:05 2019 New Revision: 355584 URL: https://svnweb.freebsd.org/changeset/base/355584 Log: 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 Modified: head/sys/ufs/ufs/ufs_extern.h head/sys/ufs/ufs/ufs_inode.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_extern.h ============================================================================== --- head/sys/ufs/ufs/ufs_extern.h Tue Dec 10 13:52:08 2019 (r355583) +++ head/sys/ufs/ufs/ufs_extern.h Tue Dec 10 14:07:05 2019 (r355584) @@ -79,6 +79,7 @@ int ufs_inactive(struct vop_inactive_args *); int ufs_init(struct vfsconf *); void ufs_itimes(struct vnode *vp); int ufs_lookup(struct vop_cachedlookup_args *); +int ufs_need_inactive(struct vop_need_inactive_args *); int ufs_readdir(struct vop_readdir_args *); int ufs_reclaim(struct vop_reclaim_args *); void ffs_snapgone(struct inode *); Modified: head/sys/ufs/ufs/ufs_inode.c ============================================================================== --- head/sys/ufs/ufs/ufs_inode.c Tue Dec 10 13:52:08 2019 (r355583) +++ head/sys/ufs/ufs/ufs_inode.c Tue Dec 10 14:07:05 2019 (r355584) @@ -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. */ Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Tue Dec 10 13:52:08 2019 (r355583) +++ head/sys/ufs/ufs/ufs_vnops.c Tue Dec 10 14:07:05 2019 (r355584) @@ -2742,6 +2742,7 @@ struct vop_vector ufs_vnodeops = { .vop_markatime = ufs_markatime, .vop_mkdir = ufs_mkdir, .vop_mknod = ufs_mknod, + .vop_need_inactive = ufs_need_inactive, .vop_open = ufs_open, .vop_pathconf = ufs_pathconf, .vop_poll = vop_stdpoll,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912101407.xBAE75Sa086337>