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
This commit is contained in:
parent
57557e714e
commit
65417f5e27
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=348251
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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_ */
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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 *);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user