From owner-svn-src-all@freebsd.org Tue Dec 10 14:07:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 510011DA661; Tue, 10 Dec 2019 14:07:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47XMLy1VQMz4tSw; Tue, 10 Dec 2019 14:07:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EAC42BDAA; Tue, 10 Dec 2019 14:07:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBAE76Ki086340; Tue, 10 Dec 2019 14:07:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBAE75Sa086337; Tue, 10 Dec 2019 14:07:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912101407.xBAE75Sa086337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 10 Dec 2019 14:07:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355584 - head/sys/ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ufs X-SVN-Commit-Revision: 355584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2019 14:07:06 -0000 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 #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,