From 65417f5e27264225693d499eca26e695fb153318 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 24 May 2019 20:27:50 +0000 Subject: [PATCH] Remove "struct ucred*" argument from vtruncbuf vtruncbuf takes a "struct ucred*" argument. AFAICT, it's been unused ever since that function was first added in r34611. Remove it. Also, remove some "struct ucred" arguments from fuse and nfs functions that were only used by vtruncbuf. Reviewed by: cem MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20377 --- sys/fs/ext2fs/ext2_inode.c | 4 ++-- sys/fs/fuse/fuse_io.c | 6 +++--- sys/fs/fuse/fuse_node.c | 4 ++-- sys/fs/fuse/fuse_node.h | 2 +- sys/fs/fuse/fuse_vnops.c | 6 +++--- sys/fs/msdosfs/msdosfs_denode.c | 2 +- sys/fs/nfsclient/nfs.h | 3 +-- sys/fs/nfsclient/nfs_clbio.c | 4 ++-- sys/fs/nfsclient/nfs_clvnops.c | 3 +-- sys/kern/vfs_subr.c | 6 +++--- sys/sys/vnode.h | 3 +-- sys/ufs/ffs/ffs_inode.c | 2 +- 12 files changed, 21 insertions(+), 24 deletions(-) diff --git a/sys/fs/ext2fs/ext2_inode.c b/sys/fs/ext2fs/ext2_inode.c index c2487dad401f..4f0de4b6f5c9 100644 --- a/sys/fs/ext2fs/ext2_inode.c +++ b/sys/fs/ext2fs/ext2_inode.c @@ -356,7 +356,7 @@ ext2_ind_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred, oip->i_ib[i] = oldblks[EXT2_NDADDR + i]; } oip->i_size = osize; - error = vtruncbuf(ovp, cred, length, (int)fs->e2fs_bsize); + error = vtruncbuf(ovp, length, (int)fs->e2fs_bsize); if (error && (allerror == 0)) allerror = error; vnode_pager_setsize(ovp, length); @@ -530,7 +530,7 @@ ext2_ext_truncate(struct vnode *vp, off_t length, int flags, } oip->i_size = osize; - error = vtruncbuf(ovp, cred, length, (int)fs->e2fs_bsize); + error = vtruncbuf(ovp, length, (int)fs->e2fs_bsize); if (error) return (error); diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c index e498b63b44d1..d90abeb39e94 100644 --- a/sys/fs/fuse/fuse_io.c +++ b/sys/fs/fuse/fuse_io.c @@ -389,7 +389,7 @@ fuse_write_directbackend(struct vnode *vp, struct uio *uio, if (uio->uio_offset > fvdat->filesize && fuse_data_cache_mode != FUSE_CACHE_UC) { - fuse_vnode_setsize(vp, cred, uio->uio_offset); + fuse_vnode_setsize(vp, uio->uio_offset); fvdat->flag &= ~FN_SIZECHANGE; } } @@ -462,7 +462,7 @@ fuse_write_biobackend(struct vnode *vp, struct uio *uio, if (bp != NULL) { long save; - err = fuse_vnode_setsize(vp, cred, + err = fuse_vnode_setsize(vp, uio->uio_offset + n); if (err) { brelse(bp); @@ -490,7 +490,7 @@ fuse_write_biobackend(struct vnode *vp, struct uio *uio, lbn, on, n, uio, bcount, false); bp = getblk(vp, lbn, bcount, PCATCH, 0, 0); if (bp && uio->uio_offset + n > fvdat->filesize) { - err = fuse_vnode_setsize(vp, cred, + err = fuse_vnode_setsize(vp, uio->uio_offset + n); if (err) { brelse(bp); diff --git a/sys/fs/fuse/fuse_node.c b/sys/fs/fuse/fuse_node.c index fd208606be44..17fcce6bb625 100644 --- a/sys/fs/fuse/fuse_node.c +++ b/sys/fs/fuse/fuse_node.c @@ -408,7 +408,7 @@ fuse_vnode_refreshsize(struct vnode *vp, struct ucred *cred) } int -fuse_vnode_setsize(struct vnode *vp, struct ucred *cred, off_t newsize) +fuse_vnode_setsize(struct vnode *vp, off_t newsize) { struct fuse_vnode_data *fvdat = VTOFUD(vp); off_t oldsize; @@ -421,7 +421,7 @@ fuse_vnode_setsize(struct vnode *vp, struct ucred *cred, off_t newsize) fvdat->flag |= FN_SIZECHANGE; if (newsize < oldsize) { - err = vtruncbuf(vp, cred, newsize, fuse_iosize(vp)); + err = vtruncbuf(vp, newsize, fuse_iosize(vp)); } vnode_pager_setsize(vp, newsize); return err; diff --git a/sys/fs/fuse/fuse_node.h b/sys/fs/fuse/fuse_node.h index 3264a677e1a6..544643dd7cea 100644 --- a/sys/fs/fuse/fuse_node.h +++ b/sys/fs/fuse/fuse_node.h @@ -127,6 +127,6 @@ void fuse_vnode_refreshsize(struct vnode *vp, struct ucred *cred); int fuse_vnode_savesize(struct vnode *vp, struct ucred *cred); -int fuse_vnode_setsize(struct vnode *vp, struct ucred *cred, off_t newsize); +int fuse_vnode_setsize(struct vnode *vp, off_t newsize); #endif /* _FUSE_NODE_H_ */ diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 1b795af6e5d5..3276d87d3850 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -530,7 +530,7 @@ fuse_vnop_getattr(struct vop_getattr_args *ap) fdi.answ)->attr.size; if (fvdat->filesize != new_filesize) { - fuse_vnode_setsize(vp, cred, new_filesize); + fuse_vnode_setsize(vp, new_filesize); fvdat->flag &= ~FN_SIZECHANGE; } } @@ -971,7 +971,7 @@ fuse_vnop_lookup(struct vop_lookup_args *ap) "%s!\n", __func__, vnode_mount(vp)->mnt_stat.f_mntonname); - (void)fuse_vnode_setsize(vp, cred, fattr->size); + (void)fuse_vnode_setsize(vp, fattr->size); fvdat->flag &= ~FN_SIZECHANGE; } *vpp = vp; @@ -1654,7 +1654,7 @@ fuse_vnop_setattr(struct vop_setattr_args *ap) out: fdisp_destroy(&fdi); if (!err && sizechanged) { - fuse_vnode_setsize(vp, cred, newsize); + fuse_vnode_setsize(vp, newsize); VTOFUD(vp)->flag &= ~FN_SIZECHANGE; } return err; diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 990cd1ff7ee3..19ba40fed97f 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -429,7 +429,7 @@ detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred) dep->de_FileSize = length; if (!isadir) dep->de_flag |= DE_UPDATE | DE_MODIFIED; - allerror = vtruncbuf(DETOV(dep), cred, length, pmp->pm_bpcluster); + allerror = vtruncbuf(DETOV(dep), length, pmp->pm_bpcluster); #ifdef MSDOSFS_DEBUG if (allerror) printf("detrunc(): vtruncbuf error %d\n", allerror); diff --git a/sys/fs/nfsclient/nfs.h b/sys/fs/nfsclient/nfs.h index 60b7f3e5ee3a..ce1747a2ab6b 100644 --- a/sys/fs/nfsclient/nfs.h +++ b/sys/fs/nfsclient/nfs.h @@ -91,8 +91,7 @@ enum nfsiod_state { /* * Function prototypes. */ -int ncl_meta_setsize(struct vnode *, struct ucred *, struct thread *, - u_quad_t); +int ncl_meta_setsize(struct vnode *, struct thread *, u_quad_t); void ncl_doio_directwrite(struct buf *); int ncl_bioread(struct vnode *, struct uio *, int, struct ucred *); int ncl_biowrite(struct vnode *, struct uio *, int, struct ucred *); diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index a3e764d9e5c8..cbd4725d844d 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -1832,7 +1832,7 @@ ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td, */ int -ncl_meta_setsize(struct vnode *vp, struct ucred *cred, struct thread *td, u_quad_t nsize) +ncl_meta_setsize(struct vnode *vp, struct thread *td, u_quad_t nsize) { struct nfsnode *np = VTONFS(vp); u_quad_t tsize; @@ -1854,7 +1854,7 @@ ncl_meta_setsize(struct vnode *vp, struct ucred *cred, struct thread *td, u_quad * truncation point. We may have a B_DELWRI and/or B_CACHE * buffer that now needs to be truncated. */ - error = vtruncbuf(vp, cred, nsize, biosize); + error = vtruncbuf(vp, nsize, biosize); lbn = nsize / biosize; bufsize = nsize - (lbn * biosize); bp = nfs_getcacheblk(vp, lbn, bufsize, td); diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index cc6294494401..a30b2b282cf8 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -979,8 +979,7 @@ nfs_setattr(struct vop_setattr_args *ap) mtx_lock(&np->n_mtx); tsize = np->n_size; mtx_unlock(&np->n_mtx); - error = ncl_meta_setsize(vp, ap->a_cred, td, - vap->va_size); + error = ncl_meta_setsize(vp, td, vap->va_size); mtx_lock(&np->n_mtx); if (np->n_flag & NMODIFIED) { tsize = np->n_size; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index bfbb45d7a232..7887fe95c863 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1863,15 +1863,15 @@ bnoreuselist(struct bufv *bufv, struct bufobj *bo, daddr_t startn, daddr_t endn) * sync activity. */ int -vtruncbuf(struct vnode *vp, struct ucred *cred, off_t length, int blksize) +vtruncbuf(struct vnode *vp, off_t length, int blksize) { struct buf *bp, *nbp; int anyfreed; daddr_t trunclbn; struct bufobj *bo; - CTR5(KTR_VFS, "%s: vp %p with cred %p and block %d:%ju", __func__, - vp, cred, blksize, (uintmax_t)length); + CTR4(KTR_VFS, "%s: vp %p with block %d:%ju", __func__, + vp, blksize, (uintmax_t)length); /* * Round up to the *next* lbn. diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 8278a2cdca30..0ed2ffc96fb7 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -658,8 +658,7 @@ void vgone(struct vnode *vp); void _vhold(struct vnode *, bool); void vinactive(struct vnode *, struct thread *); int vinvalbuf(struct vnode *vp, int save, int slpflag, int slptimeo); -int vtruncbuf(struct vnode *vp, struct ucred *cred, off_t length, - int blksize); +int vtruncbuf(struct vnode *vp, off_t length, int blksize); void vunref(struct vnode *); void vn_printf(struct vnode *vp, const char *fmt, ...) __printflike(2,3); int vrecycle(struct vnode *vp); diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index ef2b2956933c..7b87a11500c3 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -509,7 +509,7 @@ ffs_truncate(vp, length, flags, cred) ip->i_size = osize; DIP_SET(ip, i_size, osize); - error = vtruncbuf(vp, cred, length, fs->fs_bsize); + error = vtruncbuf(vp, length, fs->fs_bsize); if (error && (allerror == 0)) allerror = error;