diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 214c8815dc64..8c1ee2516f87 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -94,7 +94,6 @@ struct cdev { int __sid_bsize_phys; /* min physical block size */ int __sid_bsize_best; /* optimal block size */ struct snapdata *__sid_snapdata; - int (*__sid_copyonwrite)(struct vnode *, struct buf *); } __si_disk; } __si_u; char __si_namebuf[SPECNAMELEN + 1]; @@ -105,7 +104,6 @@ struct cdev { #define si_bsize_phys __si_u.__si_disk.__sid_bsize_phys #define si_bsize_best __si_u.__si_disk.__sid_bsize_best #define si_snapdata __si_u.__si_disk.__sid_snapdata -#define si_copyonwrite __si_u.__si_disk.__sid_copyonwrite #ifdef _KERNEL diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 336a264ff594..5c916e9187c8 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -47,7 +47,6 @@ struct ucred; struct vnode; struct vop_fsync_args; struct vop_reallocblks_args; -struct vop_copyonwrite_args; int ffs_alloc(struct inode *, ufs2_daddr_t, ufs2_daddr_t, int, struct ucred *, ufs2_daddr_t *); @@ -62,6 +61,7 @@ ufs2_daddr_t ffs_blkpref_ufs2(struct inode *, ufs_lbn_t, int, ufs2_daddr_t *); int ffs_checkfreefile(struct fs *, struct vnode *, ino_t); void ffs_clrblock(struct fs *, u_char *, ufs1_daddr_t); void ffs_clusteracct (struct fs *, struct cg *, ufs1_daddr_t, int); +int ffs_copyonwrite(struct vnode *, struct buf *); vfs_fhtovp_t ffs_fhtovp; int ffs_flushfiles(struct mount *, int, struct thread *); void ffs_fragacct(struct fs *, int, int32_t [], int); diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index ac07e4b055db..7206eae570a0 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -100,7 +100,6 @@ static int snapacct_ufs2(struct vnode *, ufs2_daddr_t *, ufs2_daddr_t *, struct fs *, ufs_lbn_t, int); static int mapacct_ufs2(struct vnode *, ufs2_daddr_t *, ufs2_daddr_t *, struct fs *, ufs_lbn_t, int); -static int ffs_copyonwrite(struct vnode *, struct buf *); static int readblock(struct vnode *vp, struct buf *, ufs2_daddr_t); /* @@ -561,7 +560,6 @@ loop: if (ip->i_nextsnap.tqe_prev != 0) panic("ffs_snapshot: %d already on list", ip->i_number); TAILQ_INSERT_TAIL(&sn->sn_head, ip, i_nextsnap); - devvp->v_rdev->si_copyonwrite = ffs_copyonwrite; devvp->v_vflag |= VV_COPYONWRITE; VI_UNLOCK(devvp); ASSERT_VOP_LOCKED(vp, "ffs_snapshot vp"); @@ -1451,7 +1449,6 @@ ffs_snapremove(vp) if (TAILQ_FIRST(&sn->sn_head) != 0) { VI_UNLOCK(devvp); } else { - devvp->v_rdev->si_copyonwrite = 0; snapblklist = sn->sn_blklist; sn->sn_blklist = 0; sn->sn_listsize = 0; @@ -1893,7 +1890,6 @@ ffs_snapshot_mount(mp) VOP_UNLOCK(vp, 0, td); VI_LOCK(devvp); ASSERT_VOP_LOCKED(devvp, "ffs_snapshot_mount"); - devvp->v_rdev->si_copyonwrite = ffs_copyonwrite; sn->sn_listsize = snaplistsize; sn->sn_blklist = (daddr_t *)snapblklist; devvp->v_vflag |= VV_COPYONWRITE; @@ -1933,7 +1929,6 @@ ffs_snapshot_unmount(mp) lockdestroy(&sn->sn_lock); free(sn, M_UFSMNT); ASSERT_VOP_LOCKED(devvp, "ffs_snapshot_unmount"); - devvp->v_rdev->si_copyonwrite = 0; devvp->v_rdev->si_snapdata = NULL; devvp->v_vflag &= ~VV_COPYONWRITE; VI_UNLOCK(devvp); @@ -1943,7 +1938,7 @@ ffs_snapshot_unmount(mp) * Check for need to copy block that is about to be written, * copying the block if necessary. */ -static int +int ffs_copyonwrite(devvp, bp) struct vnode *devvp; struct buf *bp; diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 757de54ddc64..61fd28b3eac3 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -3433,8 +3433,8 @@ softdep_disk_prewrite(struct vnode *vp, struct buf *bp) buf_start(bp); mp_fixme("This should require the vnode lock."); if ((vp->v_vflag & VV_COPYONWRITE) && - vp->v_rdev->si_copyonwrite && - (error = (*vp->v_rdev->si_copyonwrite)(vp, bp)) != 0 && + vp->v_rdev->si_snapdata != NULL && + (error = (ffs_copyonwrite)(vp, bp)) != 0 && error != EOPNOTSUPP) { bp->b_error = error; bp->b_ioflags |= BIO_ERROR;