From 1a2dbd1aa30df3a35b4f79ede68a0ad6ff46770e Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Mon, 20 Feb 2017 16:18:33 +0000 Subject: [PATCH] Simplify devfs_fsync() by removing it. This might also be a minor optimization, as vn_isdisk() needs to lock a global mutex. Reviewed by: imp Tested by: pho MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9628 --- sys/fs/devfs/devfs_vnops.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 51de7ae6eec1..49435608e2da 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -676,32 +676,6 @@ devfs_close_f(struct file *fp, struct thread *td) return (error); } -static int -devfs_fsync(struct vop_fsync_args *ap) -{ - int error; - struct bufobj *bo; - struct devfs_dirent *de; - - if (!vn_isdisk(ap->a_vp, &error)) { - bo = &ap->a_vp->v_bufobj; - de = ap->a_vp->v_data; - if (error == ENXIO && bo->bo_dirty.bv_cnt > 0) { - printf("Device %s went missing before all of the data " - "could be written to it; expect data loss.\n", - de->de_dirent->d_name); - - error = vop_stdfsync(ap); - if (bo->bo_dirty.bv_cnt != 0 || error != 0) - printf("devfs_fsync: vop_stdfsync failed."); - } - - return (0); - } - - return (vop_stdfsync(ap)); -} - static int devfs_getattr(struct vop_getattr_args *ap) { @@ -1912,7 +1886,7 @@ static struct vop_vector devfs_specops = { .vop_bmap = VOP_PANIC, .vop_close = devfs_close, .vop_create = VOP_PANIC, - .vop_fsync = devfs_fsync, + .vop_fsync = vop_stdfsync, .vop_getattr = devfs_getattr, .vop_ioctl = devfs_ioctl, .vop_link = VOP_PANIC,