diff options
author | phk <phk@FreeBSD.org> | 2004-10-26 06:25:56 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-10-26 06:25:56 +0000 |
commit | e0db6b548cea3c122e6fa6e8cca515d23a53a8f4 (patch) | |
tree | 09ee029b23ac3dd18563494bf3036d8c14bc1b2e /sys/ufs | |
parent | ce49e5f19ef81ee535237e20c66b4a96dfd536d4 (diff) | |
download | FreeBSD-src-e0db6b548cea3c122e6fa6e8cca515d23a53a8f4.zip FreeBSD-src-e0db6b548cea3c122e6fa6e8cca515d23a53a8f4.tar.gz |
Degeneralize the per cdev copyonwrite callback. The only possible value
is ffs_copyonwrite() and the only place it can be called from is FFS which
would never want to call another filesystems copyonwrite method, should one
exist, so there is no reason why anything generic should know about this.
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_extern.h | 2 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_snapshot.c | 7 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 4 |
3 files changed, 4 insertions, 9 deletions
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 336a264..5c916e9 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 ac07e4b..7206eae 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 757de54..61fd28b 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; |