Module Name: src Committed By: hannken Date: Sat Apr 16 07:59:46 UTC 2022
Modified Files: src/sys/ufs/ffs: ffs_snapshot.c Log Message: Take the link count from the inode. To generate a diff of this commit: cvs rdiff -u -r1.153 -r1.154 src/sys/ufs/ffs/ffs_snapshot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ufs/ffs/ffs_snapshot.c diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.153 src/sys/ufs/ffs/ffs_snapshot.c:1.154 --- src/sys/ufs/ffs/ffs_snapshot.c:1.153 Sun Dec 5 07:51:26 2021 +++ src/sys/ufs/ffs/ffs_snapshot.c Sat Apr 16 07:59:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_snapshot.c,v 1.153 2021/12/05 07:51:26 msaitoh Exp $ */ +/* $NetBSD: ffs_snapshot.c,v 1.154 2022/04/16 07:59:46 hannken Exp $ */ /* * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.153 2021/12/05 07:51:26 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.154 2022/04/16 07:59:46 hannken Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -613,7 +613,6 @@ snapshot_copyfs(struct mount *mp, struct struct snapshot_expunge_ctx { struct vnode *logvp; - struct lwp *l; struct vnode *vp; struct fs *copy_fs; }; @@ -621,7 +620,6 @@ struct snapshot_expunge_ctx { static bool snapshot_expunge_selector(void *cl, struct vnode *xvp) { - struct vattr vat; struct snapshot_expunge_ctx *c = cl; struct inode *xp; @@ -639,8 +637,7 @@ snapshot_expunge_selector(void *cl, stru if (xvp == c->logvp) return true; - if (VOP_GETATTR(xvp, &vat, c->l->l_cred) == 0 && - vat.va_nlink > 0) + if (xp->i_nlink > 0) return false; if (ffs_checkfreefile(c->copy_fs, c->vp, xp->i_number)) @@ -664,7 +661,6 @@ snapshot_expunge(struct mount *mp, struc daddr_t blkno, *blkp; struct fs *fs = VFSTOUFS(mp)->um_fs; struct inode *xp; - struct lwp *l = curlwp; struct vnode *logvp = NULL, *xvp; struct vnode_iterator *marker; struct snapshot_expunge_ctx ctx; @@ -688,7 +684,6 @@ snapshot_expunge(struct mount *mp, struc vfs_vnode_iterator_init(mp, &marker); ctx.logvp = logvp; - ctx.l = l; ctx.vp = vp; ctx.copy_fs = copy_fs; while ((xvp = vfs_vnode_iterator_next(marker, snapshot_expunge_selector,