From bad3de43650a3c5992945d0be967871a7026730a Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 23 Apr 2019 22:25:50 +0000 Subject: [PATCH] fusefs: use vfs_bio_clrbuf in fuse_vnode_setsize Reuse fuse_vnode_setsize instead of reinventing the wheel. This is what ext2_ind_truncate does. PR: 233783 Sponsored by: The FreeBSD Foundation --- sys/fs/fuse/fuse_node.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/fs/fuse/fuse_node.c b/sys/fs/fuse/fuse_node.c index 3e96bec8b03e..2569949650e7 100644 --- a/sys/fs/fuse/fuse_node.c +++ b/sys/fs/fuse/fuse_node.c @@ -434,7 +434,6 @@ fuse_vnode_setsize(struct vnode *vp, struct ucred *cred, off_t newsize) if (newsize < oldsize) { daddr_t lbn; - size_t zsize; err = vtruncbuf(vp, cred, newsize, fuse_iosize(vp)); if (err) @@ -454,8 +453,8 @@ fuse_vnode_setsize(struct vnode *vp, struct ucred *cred, off_t newsize) } if (!(bp->b_flags & B_CACHE)) goto out; /* Nothing to do */ - zsize = (lbn + 1) * iosize - newsize; - bzero(bp->b_data + newsize - lbn * iosize, zsize); + MPASS(bp->b_flags & B_VMIO); + vfs_bio_clrbuf(bp); } out: if (bp)