From 08daea96d5363623d97d234947462e820b910270 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 13 Aug 2007 17:31:57 +0000 Subject: [PATCH] Remove the vpp (returned underlying device vnode) argument from VOP_BMAP(). VOP_BMAP() may now only be used to determine linearity and clusterability of the blocks underlying a filesystem object. The meaning of the returned block number (other then being contiguous as a means of indicating linearity or clusterability) is now up to the VFS. This removes visibility into the device(s) underlying a filesystem from the rest of the kernel. --- .../linux/i386/linprocfs/linprocfs_vnops.c | 4 +- sys/kern/vfs_bio.c | 4 +- sys/kern/vfs_cluster.c | 14 +- sys/kern/vfs_vopops.c | 5 +- sys/sys/vfsops.h | 9 +- sys/vfs/deadfs/dead_vnops.c | 4 +- sys/vfs/fifofs/fifo_vnops.c | 6 +- sys/vfs/gnu/ext2fs/ext2_bmap.c | 6 +- sys/vfs/gnu/ext2fs/ext2_vnops.c | 4 +- sys/vfs/hpfs/hpfs_vnops.c | 8 +- sys/vfs/isofs/cd9660/cd9660_bmap.c | 6 +- sys/vfs/isofs/cd9660/cd9660_lookup.c | 6 +- sys/vfs/isofs/cd9660/cd9660_vnops.c | 4 +- sys/vfs/mfs/mfs_vnops.c | 6 +- sys/vfs/msdosfs/msdosfs_vnops.c | 6 +- sys/vfs/nfs/nfs_serv.c | 178 +++++++++--------- sys/vfs/nfs/nfs_vnops.c | 6 +- sys/vfs/ntfs/ntfs_vnops.c | 6 +- sys/vfs/nwfs/nwfs_vnops.c | 8 +- sys/vfs/procfs/procfs_vnops.c | 10 +- sys/vfs/smbfs/smbfs_vnops.c | 8 +- sys/vfs/specfs/spec_vnops.c | 14 +- sys/vfs/udf/udf_vnops.c | 4 +- sys/vfs/ufs/ffs_rawread.c | 8 +- sys/vfs/ufs/ffs_softdep.c | 5 +- sys/vfs/ufs/ufs_bmap.c | 6 +- sys/vfs/ufs/ufs_readwrite.c | 7 +- sys/vfs/ufs/ufs_vnops.c | 4 +- sys/vfs/union/union_vnops.c | 4 +- sys/vm/vnode_pager.c | 4 +- 30 files changed, 168 insertions(+), 196 deletions(-) diff --git a/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c b/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c index 585cfc1bf0..0c7bc0edfd 100644 --- a/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c +++ b/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c @@ -39,7 +39,7 @@ * @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/i386/linux/linprocfs/linprocfs_vnops.c,v 1.3.2.5 2001/08/12 14:29:19 rwatson Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c,v 1.40 2007/05/06 19:23:29 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c,v 1.41 2007/08/13 17:31:55 dillon Exp $ */ /* @@ -324,8 +324,6 @@ linprocfs_ioctl(struct vop_ioctl_args *ap) static int linprocfs_bmap(struct vop_bmap_args *ap) { - if (ap->a_vpp != NULL) - *ap->a_vpp = ap->a_vp; if (ap->a_doffsetp != NULL) *ap->a_doffsetp = ap->a_loffset; if (ap->a_runp != NULL) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 4784deb28b..884d267d48 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -12,7 +12,7 @@ * John S. Dyson. * * $FreeBSD: src/sys/kern/vfs_bio.c,v 1.242.2.20 2003/05/28 18:38:10 alc Exp $ - * $DragonFly: src/sys/kern/vfs_bio.c,v 1.91 2007/05/13 18:33:58 swildner Exp $ + * $DragonFly: src/sys/kern/vfs_bio.c,v 1.92 2007/08/13 17:31:51 dillon Exp $ */ /* @@ -791,7 +791,7 @@ bdwrite(struct buf *bp) * the bmap then... So, this is important to do. */ if (bp->b_bio2.bio_offset == NOOFFSET) { - VOP_BMAP(bp->b_vp, bp->b_loffset, NULL, &bp->b_bio2.bio_offset, + VOP_BMAP(bp->b_vp, bp->b_loffset, &bp->b_bio2.bio_offset, NULL, NULL); } diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index ba425ab0b4..35ae5d3d17 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -34,7 +34,7 @@ * * @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94 * $FreeBSD: src/sys/kern/vfs_cluster.c,v 1.92.2.9 2001/11/18 07:10:59 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_cluster.c,v 1.29 2006/12/23 00:35:04 swildner Exp $ + * $DragonFly: src/sys/kern/vfs_cluster.c,v 1.30 2007/08/13 17:31:51 dillon Exp $ */ #include "opt_debug_cluster.h" @@ -174,7 +174,7 @@ cluster_read(struct vnode *vp, off_t filesize, off_t loffset, if (nblks > racluster) nblks = racluster; - error = VOP_BMAP(vp, loffset, NULL, + error = VOP_BMAP(vp, loffset, &doffset, &burstbytes, NULL); if (error) goto single_block_read; @@ -240,7 +240,7 @@ single_block_read: goto no_read_ahead; } - error = VOP_BMAP(vp, loffset, NULL, + error = VOP_BMAP(vp, loffset, &doffset, &burstbytes, NULL); if (error || doffset == NOOFFSET) { rbp->b_flags |= B_INVAL; @@ -683,7 +683,7 @@ cluster_write(struct buf *bp, off_t filesize, int seqcount) if ((vp->v_type == VREG) && bp->b_loffset + lblocksize != filesize && (bp->b_bio2.bio_offset == NOOFFSET) && - (VOP_BMAP(vp, loffset, NULL, &bp->b_bio2.bio_offset, &maxclen, NULL) || + (VOP_BMAP(vp, loffset, &bp->b_bio2.bio_offset, &maxclen, NULL) || bp->b_bio2.bio_offset == NOOFFSET)) { bawrite(bp); vp->v_clen = 0; @@ -963,13 +963,13 @@ cluster_collectbufs(struct vnode *vp, struct buf *last_bp, int lblocksize) (void) bread(vp, loffset, last_bp->b_bcount, &bp); buflist->bs_children[i] = bp; if (bp->b_bio2.bio_offset == NOOFFSET) { - VOP_BMAP(bp->b_vp, bp->b_loffset, NULL, - &bp->b_bio2.bio_offset, NULL, NULL); + VOP_BMAP(bp->b_vp, bp->b_loffset, + &bp->b_bio2.bio_offset, NULL, NULL); } } buflist->bs_children[i] = bp = last_bp; if (bp->b_bio2.bio_offset == NOOFFSET) { - VOP_BMAP(bp->b_vp, bp->b_loffset, NULL, + VOP_BMAP(bp->b_vp, bp->b_loffset, &bp->b_bio2.bio_offset, NULL, NULL); } buflist->bs_nchildren = i + 1; diff --git a/sys/kern/vfs_vopops.c b/sys/kern/vfs_vopops.c index 3b33cb32e8..8301f9e8b4 100644 --- a/sys/kern/vfs_vopops.c +++ b/sys/kern/vfs_vopops.c @@ -32,7 +32,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/vfs_vopops.c,v 1.33 2006/10/27 04:56:31 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_vopops.c,v 1.34 2007/08/13 17:31:51 dillon Exp $ */ #include @@ -627,7 +627,7 @@ vop_reclaim(struct vop_ops *ops, struct vnode *vp) int vop_bmap(struct vop_ops *ops, struct vnode *vp, off_t loffset, - struct vnode **vpp, off_t *doffsetp, int *runp, int *runb) + off_t *doffsetp, int *runp, int *runb) { struct vop_bmap_args ap; int error; @@ -636,7 +636,6 @@ vop_bmap(struct vop_ops *ops, struct vnode *vp, off_t loffset, ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_loffset = loffset; - ap.a_vpp = vpp; ap.a_doffsetp = doffsetp; ap.a_runp = runp; ap.a_runb = runb; diff --git a/sys/sys/vfsops.h b/sys/sys/vfsops.h index 72f17fcabd..fe6e0969a3 100644 --- a/sys/sys/vfsops.h +++ b/sys/sys/vfsops.h @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/sys/vfsops.h,v 1.27 2006/10/27 04:56:33 dillon Exp $ + * $DragonFly: src/sys/sys/vfsops.h,v 1.28 2007/08/13 17:31:52 dillon Exp $ */ /* @@ -288,7 +288,6 @@ struct vop_bmap_args { struct vop_generic_args a_head; struct vnode *a_vp; off_t a_loffset; - struct vnode **a_vpp; off_t *a_doffsetp; int *a_runp; int *a_runb; @@ -716,7 +715,7 @@ int vop_readlink(struct vop_ops *ops, struct vnode *vp, struct uio *uio, int vop_inactive(struct vop_ops *ops, struct vnode *vp); int vop_reclaim(struct vop_ops *ops, struct vnode *vp); int vop_bmap(struct vop_ops *ops, struct vnode *vp, off_t loffset, - struct vnode **vpp, off_t *doffsetp, int *runp, int *runb); + off_t *doffsetp, int *runp, int *runb); int vop_strategy(struct vop_ops *ops, struct vnode *vp, struct bio *bio); int vop_print(struct vop_ops *ops, struct vnode *vp); int vop_pathconf(struct vop_ops *ops, struct vnode *vp, int name, @@ -940,8 +939,8 @@ extern struct syslink_desc vop_nrename_desc; vop_inactive(*(vp)->v_ops, vp) #define VOP_RECLAIM(vp) \ vop_reclaim(*(vp)->v_ops, vp) -#define VOP_BMAP(vp, loff, vpp, doffp, runp, runb) \ - vop_bmap(*(vp)->v_ops, vp, loff, vpp, doffp, runp, runb) +#define VOP_BMAP(vp, loff, doffp, runp, runb) \ + vop_bmap(*(vp)->v_ops, vp, loff, doffp, runp, runb) #define VOP_PRINT(vp) \ vop_print(*(vp)->v_ops, vp) #define VOP_PATHCONF(vp, name, retval) \ diff --git a/sys/vfs/deadfs/dead_vnops.c b/sys/vfs/deadfs/dead_vnops.c index 2f4bbdb454..008f7239b5 100644 --- a/sys/vfs/deadfs/dead_vnops.c +++ b/sys/vfs/deadfs/dead_vnops.c @@ -32,7 +32,7 @@ * * @(#)dead_vnops.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/miscfs/deadfs/dead_vnops.c,v 1.26 1999/08/28 00:46:42 peter Exp $ - * $DragonFly: src/sys/vfs/deadfs/dead_vnops.c,v 1.19 2006/12/23 00:41:28 swildner Exp $ + * $DragonFly: src/sys/vfs/deadfs/dead_vnops.c,v 1.20 2007/08/13 17:31:56 dillon Exp $ */ #include @@ -185,7 +185,7 @@ dead_ioctl(struct vop_ioctl_args *ap) /* * Wait until the vnode has finished changing state. * - * dead_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * dead_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ static int diff --git a/sys/vfs/fifofs/fifo_vnops.c b/sys/vfs/fifofs/fifo_vnops.c index 7917729a4c..ef8392c3f2 100644 --- a/sys/vfs/fifofs/fifo_vnops.c +++ b/sys/vfs/fifofs/fifo_vnops.c @@ -32,7 +32,7 @@ * * @(#)fifo_vnops.c 8.10 (Berkeley) 5/27/95 * $FreeBSD: src/sys/miscfs/fifofs/fifo_vnops.c,v 1.45.2.4 2003/04/22 10:11:24 bde Exp $ - * $DragonFly: src/sys/vfs/fifofs/fifo_vnops.c,v 1.39 2007/08/08 00:12:51 swildner Exp $ + * $DragonFly: src/sys/vfs/fifofs/fifo_vnops.c,v 1.40 2007/08/13 17:31:56 dillon Exp $ */ #include @@ -487,14 +487,12 @@ fifo_inactive(struct vop_inactive_args *ap) /* * This is a noop, simply returning what one has been given. * - * fifo_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * fifo_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ static int fifo_bmap(struct vop_bmap_args *ap) { - if (ap->a_vpp != NULL) - *ap->a_vpp = ap->a_vp; if (ap->a_doffsetp != NULL) *ap->a_doffsetp = ap->a_loffset; if (ap->a_runp != NULL) diff --git a/sys/vfs/gnu/ext2fs/ext2_bmap.c b/sys/vfs/gnu/ext2fs/ext2_bmap.c index 91d86ea733..5ac1ab30b1 100644 --- a/sys/vfs/gnu/ext2fs/ext2_bmap.c +++ b/sys/vfs/gnu/ext2fs/ext2_bmap.c @@ -37,7 +37,7 @@ * * @(#)ufs_bmap.c 8.7 (Berkeley) 3/21/95 * $FreeBSD: src/sys/ufs/ufs/ufs_bmap.c,v 1.34.2.1 2000/03/17 10:12:14 ps Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_bmap.c,v 1.3 2006/04/30 17:22:18 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_bmap.c,v 1.4 2007/08/13 17:31:56 dillon Exp $ */ #include @@ -69,7 +69,7 @@ static int ext2_bmaparray(struct vnode *vp, ext2_daddr_t bn, * BMAP must return the contiguous before and after run in bytes, inclusive * of the returned block. * - * ext2_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * ext2_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ int @@ -84,8 +84,6 @@ ext2_bmap(struct vop_bmap_args *ap) * Check for underlying vnode requests and ensure that logical * to physical mapping is requested. */ - if (ap->a_vpp != NULL) - *ap->a_vpp = VTOI(ap->a_vp)->i_devvp; if (ap->a_doffsetp == NULL) return (0); diff --git a/sys/vfs/gnu/ext2fs/ext2_vnops.c b/sys/vfs/gnu/ext2fs/ext2_vnops.c index 4111c49a66..1cc3637ad7 100644 --- a/sys/vfs/gnu/ext2fs/ext2_vnops.c +++ b/sys/vfs/gnu/ext2fs/ext2_vnops.c @@ -44,7 +44,7 @@ * @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95 * @(#)ext2_vnops.c 8.7 (Berkeley) 2/3/94 * $FreeBSD: src/sys/gnu/ext2fs/ext2_vnops.c,v 1.51.2.2 2003/01/02 17:26:18 bde Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_vnops.c,v 1.40 2007/08/08 00:12:51 swildner Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_vnops.c,v 1.41 2007/08/13 17:31:56 dillon Exp $ */ #include "opt_quota.h" @@ -1787,7 +1787,7 @@ ext2_strategy(struct vop_strategy_args *ap) panic("ext2_strategy: spec"); nbio = push_bio(bio); if (nbio->bio_offset == NOOFFSET) { - error = VOP_BMAP(vp, bio->bio_offset, NULL, &nbio->bio_offset, + error = VOP_BMAP(vp, bio->bio_offset, &nbio->bio_offset, NULL, NULL); if (error) { bp->b_error = error; diff --git a/sys/vfs/hpfs/hpfs_vnops.c b/sys/vfs/hpfs/hpfs_vnops.c index 9fcbfc6a16..1efab42166 100644 --- a/sys/vfs/hpfs/hpfs_vnops.c +++ b/sys/vfs/hpfs/hpfs_vnops.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/hpfs/hpfs_vnops.c,v 1.2.2.2 2002/01/15 18:35:09 semenu Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs_vnops.c,v 1.42 2007/08/08 00:12:51 swildner Exp $ + * $DragonFly: src/sys/vfs/hpfs/hpfs_vnops.c,v 1.43 2007/08/13 17:31:56 dillon Exp $ */ #include @@ -272,7 +272,7 @@ hpfs_ioctl(struct vop_ioctl_args *ap) /* * Map file offset to disk offset. * - * hpfs_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * hpfs_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ int @@ -283,8 +283,6 @@ hpfs_bmap(struct vop_bmap_args *ap) daddr_t lbn; daddr_t dbn; - if (ap->a_vpp != NULL) - *ap->a_vpp = hp->h_devvp; if (ap->a_runb != NULL) *ap->a_runb = 0; if (ap->a_doffsetp == NULL) @@ -693,7 +691,7 @@ hpfs_strategy(struct vop_strategy_args *ap) nbio = push_bio(bio); if (nbio->bio_offset == NOOFFSET) { - error = VOP_BMAP(vp, bio->bio_offset, NULL, &nbio->bio_offset, + error = VOP_BMAP(vp, bio->bio_offset, &nbio->bio_offset, NULL, NULL); if (error) { kprintf("hpfs_strategy: VOP_BMAP FAILED %d\n", error); diff --git a/sys/vfs/isofs/cd9660/cd9660_bmap.c b/sys/vfs/isofs/cd9660/cd9660_bmap.c index d7f074389e..004074b9aa 100644 --- a/sys/vfs/isofs/cd9660/cd9660_bmap.c +++ b/sys/vfs/isofs/cd9660/cd9660_bmap.c @@ -37,7 +37,7 @@ * * @(#)cd9660_bmap.c 8.3 (Berkeley) 1/23/94 * $FreeBSD: src/sys/isofs/cd9660/cd9660_bmap.c,v 1.8 1999/08/28 00:46:06 peter Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_bmap.c,v 1.5 2006/03/24 18:35:33 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_bmap.c,v 1.6 2007/08/13 17:31:56 dillon Exp $ */ #include @@ -53,7 +53,7 @@ * number on the disk. The conversion is done by using the logical block * number to index into the data block (extent) for the file. * - * cd9660_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * cd9660_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ int @@ -68,8 +68,6 @@ cd9660_bmap(struct vop_bmap_args *ap) * Check for underlying vnode requests and ensure that logical * to physical mapping is requested. */ - if (ap->a_vpp != NULL) - *ap->a_vpp = ip->i_devvp; if (ap->a_doffsetp == NULL) return (0); diff --git a/sys/vfs/isofs/cd9660/cd9660_lookup.c b/sys/vfs/isofs/cd9660/cd9660_lookup.c index 06511a7d26..9995328f5d 100644 --- a/sys/vfs/isofs/cd9660/cd9660_lookup.c +++ b/sys/vfs/isofs/cd9660/cd9660_lookup.c @@ -39,7 +39,7 @@ * * @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94 * $FreeBSD: src/sys/isofs/cd9660/cd9660_lookup.c,v 1.23.2.2 2001/11/04 06:19:47 dillon Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_lookup.c,v 1.23 2006/08/12 00:26:20 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_lookup.c,v 1.24 2007/08/13 17:31:56 dillon Exp $ */ #include @@ -418,7 +418,7 @@ cd9660_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp) * knowledge of bio_offset. */ if (bp->b_bio2.bio_offset == NOOFFSET) { - error = VOP_BMAP(vp, bp->b_bio1.bio_offset, NULL, + error = VOP_BMAP(vp, bp->b_bio1.bio_offset, &bp->b_bio2.bio_offset, NULL, NULL); if (error) { bp->b_error = error; @@ -464,7 +464,7 @@ cd9660_devblkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp) lbn = lblkno(imp, offset); bsize = blksize(imp, ip, lbn); - error = VOP_BMAP(vp, lblktooff(imp, lbn), NULL, &doffset, NULL, NULL); + error = VOP_BMAP(vp, lblktooff(imp, lbn), &doffset, NULL, NULL); if (error) return (error); diff --git a/sys/vfs/isofs/cd9660/cd9660_vnops.c b/sys/vfs/isofs/cd9660/cd9660_vnops.c index ad39699c1c..7df3c2955f 100644 --- a/sys/vfs/isofs/cd9660/cd9660_vnops.c +++ b/sys/vfs/isofs/cd9660/cd9660_vnops.c @@ -37,7 +37,7 @@ * * @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95 * $FreeBSD: src/sys/isofs/cd9660/cd9660_vnops.c,v 1.62 1999/12/15 23:01:51 eivind Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vnops.c,v 1.35 2007/08/08 00:12:51 swildner Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vnops.c,v 1.36 2007/08/13 17:31:56 dillon Exp $ */ #include @@ -763,7 +763,7 @@ cd9660_strategy(struct vop_strategy_args *ap) panic("cd9660_strategy: spec"); nbio = push_bio(bio); if (nbio->bio_offset == NOOFFSET) { - error = VOP_BMAP(vp, bio->bio_offset, NULL, + error = VOP_BMAP(vp, bio->bio_offset, &nbio->bio_offset, NULL, NULL); if (error) { bp->b_error = error; diff --git a/sys/vfs/mfs/mfs_vnops.c b/sys/vfs/mfs/mfs_vnops.c index 6e73030943..87cfd536d1 100644 --- a/sys/vfs/mfs/mfs_vnops.c +++ b/sys/vfs/mfs/mfs_vnops.c @@ -32,7 +32,7 @@ * * @(#)mfs_vnops.c 8.11 (Berkeley) 5/22/95 * $FreeBSD: src/sys/ufs/mfs/mfs_vnops.c,v 1.47.2.1 2001/05/22 02:06:43 bp Exp $ - * $DragonFly: src/sys/vfs/mfs/mfs_vnops.c,v 1.36 2007/08/08 00:12:51 swildner Exp $ + * $DragonFly: src/sys/vfs/mfs/mfs_vnops.c,v 1.37 2007/08/13 17:31:56 dillon Exp $ */ #include @@ -292,14 +292,12 @@ mfs_doio(struct bio *bio, struct mfsnode *mfsp) /* * This is a noop, simply returning what one has been given. * - * mfs_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * mfs_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ static int mfs_bmap(struct vop_bmap_args *ap) { - if (ap->a_vpp != NULL) - *ap->a_vpp = ap->a_vp; if (ap->a_doffsetp != NULL) *ap->a_doffsetp = ap->a_loffset; if (ap->a_runp != NULL) diff --git a/sys/vfs/msdosfs/msdosfs_vnops.c b/sys/vfs/msdosfs/msdosfs_vnops.c index 6d460e66b3..8ad3ff5aee 100644 --- a/sys/vfs/msdosfs/msdosfs_vnops.c +++ b/sys/vfs/msdosfs/msdosfs_vnops.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/msdosfs/msdosfs_vnops.c,v 1.95.2.4 2003/06/13 15:05:47 trhodes Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vnops.c,v 1.49 2007/08/08 00:23:40 swildner Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vnops.c,v 1.50 2007/08/13 17:31:56 dillon Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.68 1998/02/10 14:10:04 mrg Exp $ */ /*- @@ -1816,7 +1816,7 @@ done: * containing the file of interest * bnp - address of where to return the filesystem relative block number * - * msdosfs_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * msdosfs_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ static int @@ -1828,8 +1828,6 @@ msdosfs_bmap(struct vop_bmap_args *ap) daddr_t dbn; int error; - if (ap->a_vpp != NULL) - *ap->a_vpp = dep->de_devvp; if (ap->a_doffsetp == NULL) return (0); if (ap->a_runp) { diff --git a/sys/vfs/nfs/nfs_serv.c b/sys/vfs/nfs/nfs_serv.c index ccc07c3fe1..b27e68fa8b 100644 --- a/sys/vfs/nfs/nfs_serv.c +++ b/sys/vfs/nfs/nfs_serv.c @@ -35,7 +35,7 @@ * * @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95 * $FreeBSD: src/sys/nfs/nfs_serv.c,v 1.93.2.6 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.44 2007/05/13 01:32:28 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.45 2007/08/13 17:31:56 dillon Exp $ */ /* @@ -1659,9 +1659,11 @@ nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, if (vap->va_mode == (mode_t)VNOVAL) vap->va_mode = 0; if (vap->va_type == VREG || vap->va_type == VSOCK) { - vput(dvp); + vn_unlock(dvp); + error = VOP_NCREATE(&nd.nl_nch, dvp, &vp, + nd.nl_cred, vap); + vrele(dvp); dvp = NULL; - error = VOP_NCREATE(&nd.nl_nch, &vp, nd.nl_cred, vap); if (error == 0) { if (exclusive_flag) { exclusive_flag = 0; @@ -1689,9 +1691,10 @@ nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, vap->va_rmajor = umajor(rdev); vap->va_rminor = uminor(rdev); - vput(dvp); + vn_unlock(dvp); + error = VOP_NMKNOD(&nd.nl_nch, dvp, &vp, nd.nl_cred, vap); + vrele(dvp); dvp = NULL; - error = VOP_NMKNOD(&nd.nl_nch, &vp, nd.nl_cred, vap); if (error) goto nfsmreply0; #if 0 @@ -1877,42 +1880,20 @@ nfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, if (vap->va_mode == (mode_t)VNOVAL) vap->va_mode = 0; if (vtyp == VSOCK) { - error = VOP_NCREATE(&nd.nl_nch, &vp, nd.nl_cred, vap); + vn_unlock(dvp); + error = VOP_NCREATE(&nd.nl_nch, dvp, &vp, nd.nl_cred, vap); + vrele(dvp); + dvp = NULL; } else { if (vtyp != VFIFO && (error = suser_cred(cred, 0))) goto out; - error = VOP_NMKNOD(&nd.nl_nch, &vp, nd.nl_cred, vap); - if (error) - goto out; - -#if 0 - vput(vp); - vp = NULL; - - /* - * Release dvp prior to lookup - */ - vput(dvp); + vn_unlock(dvp); + error = VOP_NMKNOD(&nd.nl_nch, dvp, &vp, nd.nl_cred, vap); + vrele(dvp); dvp = NULL; - - /* - * XXX what is this stuff for? - */ - KKASSERT(td->td_proc); - nd.ni_cnd.cn_nameiop = NAMEI_LOOKUP; - nd.ni_cnd.cn_flags &= ~(CNP_LOCKPARENT); - nd.ni_cnd.cn_td = td; - nd.ni_cnd.cn_cred = td->td_proc->p_ucred; - - error = lookup(&nd); - nd.ni_dvp = NULL; - if (error) goto out; - if (nd.ni_cnd.cn_flags & CNP_ISSYMLINK) - error = EINVAL; -#endif } /* @@ -2022,18 +2003,15 @@ nfsrv_remove(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, } out: if (!error) { - if (dvp) { - if (dvp == vp) - vrele(dvp); - else - vput(dvp); - dvp = NULL; - } + if (dvp != vp) + vn_unlock(dvp); if (vp) { vput(vp); vp = NULL; } - error = VOP_NREMOVE(&nd.nl_nch, nd.nl_cred); + error = VOP_NREMOVE(&nd.nl_nch, dvp, nd.nl_cred); + vrele(dvp); + dvp = NULL; } } if (dirp && v3) @@ -2078,8 +2056,8 @@ nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, char *cp2; struct mbuf *mb, *mreq; struct nlookupdata fromnd, tond; - struct vnode *fvp, *fdirp; - struct vnode *tvp, *tdirp; + struct vnode *fvp, *fdirp, *fdvp; + struct vnode *tvp, *tdirp, *tdvp; struct namecache *ncp; struct vattr fdirfor, fdiraft, tdirfor, tdiraft; nfsfh_t fnfh, tnfh; @@ -2162,8 +2140,26 @@ nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, } fromnd.nl_flags |= NLC_NCPISLOCKED; - tvp = tond.nl_nch.ncp->nc_vp; fvp = fromnd.nl_nch.ncp->nc_vp; + tvp = tond.nl_nch.ncp->nc_vp; + + /* + * Set fdvp and tdvp. We haven't done all the topology checks + * so these can wind up NULL (e.g. if either fvp or tvp is a mount + * point). If we get through the checks these will be guarenteed + * to be non-NULL. + * + * Holding the children ncp's should be sufficient to prevent + * fdvp and tdvp ripouts. + */ + if (fromnd.nl_nch.ncp->nc_parent) + fdvp = fromnd.nl_nch.ncp->nc_parent->nc_vp; + else + fdvp = NULL; + if (tond.nl_nch.ncp->nc_parent) + tdvp = tond.nl_nch.ncp->nc_parent->nc_vp; + else + tdvp = NULL; if (tvp != NULL) { if (fvp->v_type == VDIR && tvp->v_type != VDIR) { @@ -2236,7 +2232,8 @@ out: * locks prior to returning so we need to clear the pointers * to bypass cleanup code later on. */ - error = VOP_NRENAME(&fromnd.nl_nch, &tond.nl_nch, tond.nl_cred); + error = VOP_NRENAME(&fromnd.nl_nch, &tond.nl_nch, + fdvp, tdvp, tond.nl_cred); } else { if (error == -1) error = 0; @@ -2336,7 +2333,10 @@ nfsrv_link(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, error = EXDEV; out: if (!error) { - error = VOP_NLINK(&nd.nl_nch, xp, nd.nl_cred); + vn_unlock(dvp); + error = VOP_NLINK(&nd.nl_nch, dvp, xp, nd.nl_cred); + vrele(dvp); + dvp = NULL; } /* fall through */ @@ -2395,18 +2395,21 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct mbuf *mb, *mreq, *mb2; struct vnode *dirp; struct vnode *vp; + struct vnode *dvp; nfsfh_t nfh; fhandle_t *fhp; nfsdbprintf(("%s %d\n", __FILE__, __LINE__)); nlookup_zero(&nd); - dirp = vp = NULL; + dirp = NULL; + dvp = NULL; + vp = NULL; fhp = &nfh.fh_generic; nfsm_srvmtofh(fhp); nfsm_srvnamesiz(len); - error = nfs_namei(&nd, cred, NAMEI_CREATE, NULL, &vp, + error = nfs_namei(&nd, cred, NAMEI_CREATE, &dvp, &vp, fhp, len, slp, nam, &md, &dpos, &dirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (dirp) { @@ -2443,7 +2446,11 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, if (vap->va_mode == (mode_t)VNOVAL) vap->va_mode = 0; - error = VOP_NSYMLINK(&nd.nl_nch, &vp, nd.nl_cred, vap, pathcp); + if (dvp != vp) + vn_unlock(dvp); + error = VOP_NSYMLINK(&nd.nl_nch, dvp, &vp, nd.nl_cred, vap, pathcp); + vrele(dvp); + dvp = NULL; if (error == 0) { bzero((caddr_t)fhp, sizeof(nfh)); fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid; @@ -2452,41 +2459,13 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, error = VOP_GETATTR(vp, vap); } -#if 0 - /* - * We have a vp in hand from the new API call, we do not have to - * look it up again. - */ - if (error == 0) { - if (v3) { - /* - * Issue lookup. Leave SAVESTART set so we can easily free - * the name buffer later on. - * - * since LOCKPARENT is not set, ni_dvp will be garbage on - * return whether an error occurs or not. - */ - nd.ni_cnd.cn_nameiop = NAMEI_LOOKUP; - nd.ni_cnd.cn_flags &= ~(CNP_LOCKPARENT | CNP_FOLLOW); - nd.ni_cnd.cn_td = td; - nd.ni_cnd.cn_cred = cred; - - error = lookup(&nd); - nd.ni_dvp = NULL; - - if (error == 0) { - bzero((caddr_t)fhp, sizeof(nfh)); - fhp->fh_fsid = nd.ni_vp->v_mount->mnt_stat.f_fsid; - error = VFS_VPTOFH(nd.ni_vp, &fhp->fh_fid); - if (!error) - error = VOP_GETATTR(nd.ni_vp, vap); - vput(nd.ni_vp); - nd.ni_vp = NULL; - } - } - } -#endif out: + if (dvp) { + if (dvp == vp) + vrele(dvp); + else + vput(dvp); + } if (vp) { vput(vp); vp = NULL; @@ -2546,6 +2525,7 @@ nfsrv_mkdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, char *cp2; struct mbuf *mb, *mb2, *mreq; struct vnode *dirp; + struct vnode *dvp; struct vnode *vp; nfsfh_t nfh; fhandle_t *fhp; @@ -2553,13 +2533,14 @@ nfsrv_mkdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, nfsdbprintf(("%s %d\n", __FILE__, __LINE__)); nlookup_zero(&nd); dirp = NULL; + dvp = NULL; vp = NULL; fhp = &nfh.fh_generic; nfsm_srvmtofh(fhp); nfsm_srvnamesiz(len); - error = nfs_namei(&nd, cred, NAMEI_CREATE, NULL, &vp, + error = nfs_namei(&nd, cred, NAMEI_CREATE, &dvp, &vp, fhp, len, slp, nam, &md, &dpos, &dirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (dirp) { @@ -2598,7 +2579,10 @@ nfsrv_mkdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, */ if (vap->va_mode == (mode_t)VNOVAL) vap->va_mode = 0; - error = VOP_NMKDIR(&nd.nl_nch, &vp, nd.nl_cred, vap); + vn_unlock(dvp); + error = VOP_NMKDIR(&nd.nl_nch, dvp, &vp, nd.nl_cred, vap); + vrele(dvp); + dvp = NULL; if (error == 0) { bzero((caddr_t)fhp, sizeof(nfh)); @@ -2629,6 +2613,12 @@ nfsmout: nlookup_done(&nd); if (dirp) vrele(dirp); + if (dvp) { + if (dvp == vp) + vrele(dvp); + else + vput(dvp); + } if (vp) vput(vp); return (error); @@ -2653,6 +2643,7 @@ nfsrv_rmdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, char *cp2; struct mbuf *mb, *mreq; struct vnode *dirp; + struct vnode *dvp; struct vnode *vp; struct vattr dirfor, diraft; nfsfh_t nfh; @@ -2662,13 +2653,14 @@ nfsrv_rmdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, nfsdbprintf(("%s %d\n", __FILE__, __LINE__)); nlookup_zero(&nd); dirp = NULL; + dvp = NULL; vp = NULL; fhp = &nfh.fh_generic; nfsm_srvmtofh(fhp); nfsm_srvnamesiz(len); - error = nfs_namei(&nd, cred, NAMEI_DELETE, NULL, &vp, + error = nfs_namei(&nd, cred, NAMEI_DELETE, &dvp, &vp, fhp, len, slp, nam, &md, &dpos, &dirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (dirp) { @@ -2697,9 +2689,13 @@ out: * component is freed by the VOP after either. */ if (!error) { + if (dvp != vp) + vn_unlock(dvp); vput(vp); vp = NULL; - error = VOP_NRMDIR(&nd.nl_nch, nd.nl_cred); + error = VOP_NRMDIR(&nd.nl_nch, dvp, nd.nl_cred); + vrele(dvp); + dvp = NULL; } nlookup_done(&nd); @@ -2713,6 +2709,12 @@ out: /* fall through */ nfsmout: + if (dvp) { + if (dvp == vp) + vrele(dvp); + else + vput(dvp); + } nlookup_done(&nd); if (dirp) vrele(dirp); diff --git a/sys/vfs/nfs/nfs_vnops.c b/sys/vfs/nfs/nfs_vnops.c index bd319fce99..13ae511574 100644 --- a/sys/vfs/nfs/nfs_vnops.c +++ b/sys/vfs/nfs/nfs_vnops.c @@ -35,7 +35,7 @@ * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 * $FreeBSD: src/sys/nfs/nfs_vnops.c,v 1.150.2.5 2001/12/20 19:56:28 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.73 2007/08/08 00:12:51 swildner Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.74 2007/08/13 17:31:56 dillon Exp $ */ @@ -2798,7 +2798,7 @@ nfsmout: * a lot more work than bcopy() and also it currently happens in the * context of the swapper process (2). * - * nfs_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * nfs_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ static int @@ -2806,8 +2806,6 @@ nfs_bmap(struct vop_bmap_args *ap) { struct vnode *vp = ap->a_vp; - if (ap->a_vpp != NULL) - *ap->a_vpp = vp; if (ap->a_doffsetp != NULL) *ap->a_doffsetp = ap->a_loffset; if (ap->a_runp != NULL) diff --git a/sys/vfs/ntfs/ntfs_vnops.c b/sys/vfs/ntfs/ntfs_vnops.c index 10f63f708c..f0e4ce1299 100644 --- a/sys/vfs/ntfs/ntfs_vnops.c +++ b/sys/vfs/ntfs/ntfs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ntfs/ntfs_vnops.c,v 1.9.2.4 2002/08/06 19:35:18 semenu Exp $ - * $DragonFly: src/sys/vfs/ntfs/ntfs_vnops.c,v 1.41 2007/08/08 00:12:52 swildner Exp $ + * $DragonFly: src/sys/vfs/ntfs/ntfs_vnops.c,v 1.42 2007/08/13 17:31:56 dillon Exp $ * */ @@ -124,15 +124,13 @@ ntfs_putpages(struct vop_putpages_args *ap) /* * This is a noop, simply returning what one has been given. * - * ntfs_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * ntfs_bmap(struct vnode *a_vp, off_t a_loffset, * daddr_t *a_doffsetp, int *a_runp, int *a_runb) */ int ntfs_bmap(struct vop_bmap_args *ap) { dprintf(("ntfs_bmap: vn: %p, blk: %d\n", ap->a_vp,(u_int32_t)ap->a_bn)); - if (ap->a_vpp != NULL) - *ap->a_vpp = ap->a_vp; if (ap->a_doffsetp != NULL) *ap->a_doffsetp = ap->a_loffset; if (ap->a_runp != NULL) diff --git a/sys/vfs/nwfs/nwfs_vnops.c b/sys/vfs/nwfs/nwfs_vnops.c index 747a3438b9..35a419191e 100644 --- a/sys/vfs/nwfs/nwfs_vnops.c +++ b/sys/vfs/nwfs/nwfs_vnops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_vnops.c,v 1.6.2.3 2001/03/14 11:26:59 bp Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_vnops.c,v 1.36 2007/08/08 00:12:52 swildner Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_vnops.c,v 1.37 2007/08/13 17:31:56 dillon Exp $ */ #include #include @@ -758,16 +758,12 @@ nwfs_strategy(struct vop_strategy_args *ap) } /* - * nwfs_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * nwfs_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ static int nwfs_bmap(struct vop_bmap_args *ap) { - struct vnode *vp = ap->a_vp; - - if (ap->a_vpp != NULL) - *ap->a_vpp = vp; if (ap->a_doffsetp != NULL) *ap->a_doffsetp = ap->a_loffset; if (ap->a_runp != NULL) diff --git a/sys/vfs/procfs/procfs_vnops.c b/sys/vfs/procfs/procfs_vnops.c index cd47611b35..90a70cefc9 100644 --- a/sys/vfs/procfs/procfs_vnops.c +++ b/sys/vfs/procfs/procfs_vnops.c @@ -37,7 +37,7 @@ * @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/miscfs/procfs/procfs_vnops.c,v 1.76.2.7 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_vnops.c,v 1.44 2007/08/08 00:12:52 swildner Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_vnops.c,v 1.45 2007/08/13 17:31:56 dillon Exp $ */ /* @@ -349,14 +349,14 @@ procfs_ioctl(struct vop_ioctl_args *ap) * usual no-op bmap, although returning * (EIO) would be a reasonable alternative. * - * procfs_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, - * off_t *a_doffsetp, int *a_runp) + * XXX mmap assumes buffer cache operation + * + * procfs_bmap(struct vnode *a_vp, off_t a_loffset, + * off_t *a_doffsetp, int *a_runp, int *a_runb) */ static int procfs_bmap(struct vop_bmap_args *ap) { - if (ap->a_vpp != NULL) - *ap->a_vpp = ap->a_vp; if (ap->a_doffsetp != NULL) *ap->a_doffsetp = ap->a_loffset; if (ap->a_runp != NULL) diff --git a/sys/vfs/smbfs/smbfs_vnops.c b/sys/vfs/smbfs/smbfs_vnops.c index caeea82185..8ba1b34f26 100644 --- a/sys/vfs/smbfs/smbfs_vnops.c +++ b/sys/vfs/smbfs/smbfs_vnops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_vnops.c,v 1.2.2.8 2003/04/04 08:57:23 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_vnops.c,v 1.39 2007/08/08 00:12:52 swildner Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_vnops.c,v 1.40 2007/08/13 17:31:56 dillon Exp $ */ #include #include @@ -811,16 +811,12 @@ smbfs_strategy(struct vop_strategy_args *ap) } /* - * smbfs_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * smbfs_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ static int smbfs_bmap(struct vop_bmap_args *ap) { - struct vnode *vp = ap->a_vp; - - if (ap->a_vpp != NULL) - *ap->a_vpp = vp; if (ap->a_doffsetp != NULL) *ap->a_doffsetp = ap->a_loffset; if (ap->a_runp != NULL) diff --git a/sys/vfs/specfs/spec_vnops.c b/sys/vfs/specfs/spec_vnops.c index ff16de5992..10c56ed0c4 100644 --- a/sys/vfs/specfs/spec_vnops.c +++ b/sys/vfs/specfs/spec_vnops.c @@ -32,7 +32,7 @@ * * @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95 * $FreeBSD: src/sys/miscfs/specfs/spec_vnops.c,v 1.131.2.4 2001/02/26 04:23:20 jlemon Exp $ - * $DragonFly: src/sys/vfs/specfs/spec_vnops.c,v 1.54 2007/08/08 00:12:52 swildner Exp $ + * $DragonFly: src/sys/vfs/specfs/spec_vnops.c,v 1.55 2007/08/13 17:31:56 dillon Exp $ */ #include @@ -664,16 +664,12 @@ spec_freeblks(struct vop_freeblks_args *ap) * returned, and assume that the entire device is contiguous in regards * to the contiguous block range (runp and runb). * - * spec_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * spec_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ static int spec_bmap(struct vop_bmap_args *ap) { - struct vnode *vp = ap->a_vp; - - if (ap->a_vpp != NULL) - *ap->a_vpp = vp; if (ap->a_doffsetp != NULL) *ap->a_doffsetp = ap->a_loffset; if (ap->a_runp != NULL) @@ -800,6 +796,12 @@ spec_getpages_iodone(struct bio *bio) wakeup(bio->bio_buf); } +/* + * spec_getpages() - get pages associated with device vnode. + * + * Note that spec_read and spec_write do not use the buffer cache, so we + * must fully implement getpages here. + */ static int spec_getpages(struct vop_getpages_args *ap) { diff --git a/sys/vfs/udf/udf_vnops.c b/sys/vfs/udf/udf_vnops.c index 4c8532addc..186b392e2d 100644 --- a/sys/vfs/udf/udf_vnops.c +++ b/sys/vfs/udf/udf_vnops.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/udf/udf_vnops.c,v 1.33 2003/12/07 05:04:49 scottl Exp $ - * $DragonFly: src/sys/vfs/udf/udf_vnops.c,v 1.30 2007/05/09 00:53:36 dillon Exp $ + * $DragonFly: src/sys/vfs/udf/udf_vnops.c,v 1.31 2007/08/13 17:31:56 dillon Exp $ */ /* udf_vnops.c */ @@ -893,8 +893,6 @@ udf_bmap(struct vop_bmap_args *a) node = VTON(a->a_vp); - if (a->a_vpp != NULL) - *a->a_vpp = node->i_devvp; if (a->a_doffsetp == NULL) return(0); diff --git a/sys/vfs/ufs/ffs_rawread.c b/sys/vfs/ufs/ffs_rawread.c index 94bc6510e8..7756b288c7 100644 --- a/sys/vfs/ufs/ffs_rawread.c +++ b/sys/vfs/ufs/ffs_rawread.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ufs/ffs/ffs_rawread.c,v 1.3.2.2 2003/05/29 06:15:35 alc Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_rawread.c,v 1.26 2006/08/12 00:26:21 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_rawread.c,v 1.27 2007/08/13 17:31:56 dillon Exp $ */ #include @@ -178,11 +178,11 @@ ffs_rawread_readahead(struct vnode *vp, caddr_t udata, off_t loffset, blockoff = (loffset % bsize) / DEV_BSIZE; - error = VOP_BMAP(vp, bp->b_loffset, &dp, &bp->b_bio2.bio_offset, + error = VOP_BMAP(vp, bp->b_loffset, &bp->b_bio2.bio_offset, &bforwards, NULL); - if (error != 0) { + if (error != 0) return error; - } + dp = VTOI(vp)->i_devvp; if (bp->b_bio2.bio_offset == NOOFFSET) { /* * Fill holes with NULs to preserve semantics diff --git a/sys/vfs/ufs/ffs_softdep.c b/sys/vfs/ufs/ffs_softdep.c index 2434de95f0..ea0969b7f7 100644 --- a/sys/vfs/ufs/ffs_softdep.c +++ b/sys/vfs/ufs/ffs_softdep.c @@ -37,7 +37,7 @@ * * from: @(#)ffs_softdep.c 9.59 (McKusick) 6/21/00 * $FreeBSD: src/sys/ufs/ffs/ffs_softdep.c,v 1.57.2.11 2002/02/05 18:46:53 dillon Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_softdep.c,v 1.51 2007/04/12 19:50:20 swildner Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_softdep.c,v 1.52 2007/08/13 17:31:56 dillon Exp $ */ /* @@ -1737,8 +1737,7 @@ setup_allocindir_phase2(struct buf *bp, struct inode *ip, LIST_INIT(&newindirdep->ir_donehd); if (bp->b_bio2.bio_offset == NOOFFSET) { VOP_BMAP(bp->b_vp, bp->b_bio1.bio_offset, - NULL, &bp->b_bio2.bio_offset, - NULL, NULL); + &bp->b_bio2.bio_offset, NULL, NULL); } KKASSERT(bp->b_bio2.bio_offset != NOOFFSET); newindirdep->ir_savebp = getblk(ip->i_devvp, diff --git a/sys/vfs/ufs/ufs_bmap.c b/sys/vfs/ufs/ufs_bmap.c index 176a91f60f..7ed38da343 100644 --- a/sys/vfs/ufs/ufs_bmap.c +++ b/sys/vfs/ufs/ufs_bmap.c @@ -37,7 +37,7 @@ * * @(#)ufs_bmap.c 8.7 (Berkeley) 3/21/95 * $FreeBSD: src/sys/ufs/ufs/ufs_bmap.c,v 1.34.2.1 2000/03/17 10:12:14 ps Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_bmap.c,v 1.12 2006/04/30 17:22:18 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_bmap.c,v 1.13 2007/08/13 17:31:57 dillon Exp $ */ #include @@ -63,7 +63,7 @@ * BMAP must return the contiguous before and after run in bytes, inclusive * of the returned block. * - * ufs_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * ufs_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ int @@ -78,8 +78,6 @@ ufs_bmap(struct vop_bmap_args *ap) * Check for underlying vnode requests and ensure that logical * to physical mapping is requested. */ - if (ap->a_vpp != NULL) - *ap->a_vpp = VTOI(ap->a_vp)->i_devvp; if (ap->a_doffsetp == NULL) return (0); diff --git a/sys/vfs/ufs/ufs_readwrite.c b/sys/vfs/ufs/ufs_readwrite.c index a69dba12ef..c9f8d251f5 100644 --- a/sys/vfs/ufs/ufs_readwrite.c +++ b/sys/vfs/ufs/ufs_readwrite.c @@ -32,7 +32,7 @@ * * @(#)ufs_readwrite.c 8.11 (Berkeley) 5/8/95 * $FreeBSD: src/sys/ufs/ufs/ufs_readwrite.c,v 1.65.2.14 2003/04/04 22:21:29 tegge Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_readwrite.c,v 1.21 2007/02/22 15:50:50 corecode Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_readwrite.c,v 1.22 2007/08/13 17:31:57 dillon Exp $ */ #define BLKSIZE(a, b, c) blksize(a, b, c) @@ -478,8 +478,8 @@ ffs_getpages(struct vop_getpages_args *ap) poff = (int)(foff % bsize); reqoffset = foff - poff; - if (VOP_BMAP(vp, reqoffset, &dp, &doffset, - &bforwards, &bbackwards) || (doffset == NOOFFSET) + if (VOP_BMAP(vp, reqoffset, &doffset, &bforwards, &bbackwards) || + doffset == NOOFFSET ) { for (i = 0; i < pcount; i++) { if (i != ap->a_reqpage) @@ -553,6 +553,7 @@ ffs_getpages(struct vop_getpages_args *ap) } physoffset -= foff; + dp = VTOI(ap->a_vp)->i_devvp; rtval = VOP_GETPAGES(dp, &ap->a_m[firstpage], size, (ap->a_reqpage - firstpage), physoffset); diff --git a/sys/vfs/ufs/ufs_vnops.c b/sys/vfs/ufs/ufs_vnops.c index 4ba1801c95..9bf34d590a 100644 --- a/sys/vfs/ufs/ufs_vnops.c +++ b/sys/vfs/ufs/ufs_vnops.c @@ -37,7 +37,7 @@ * * @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95 * $FreeBSD: src/sys/ufs/ufs/ufs_vnops.c,v 1.131.2.8 2003/01/02 17:26:19 bde Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_vnops.c,v 1.61 2007/08/08 00:12:52 swildner Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_vnops.c,v 1.62 2007/08/13 17:31:57 dillon Exp $ */ #include "opt_quota.h" @@ -1835,7 +1835,7 @@ ufs_strategy(struct vop_strategy_args *ap) panic("ufs_strategy: spec"); nbio = push_bio(bio); if (nbio->bio_offset == NOOFFSET) { - error = VOP_BMAP(vp, bio->bio_offset, NULL, &nbio->bio_offset, + error = VOP_BMAP(vp, bio->bio_offset, &nbio->bio_offset, NULL, NULL); if (error) { bp->b_error = error; diff --git a/sys/vfs/union/union_vnops.c b/sys/vfs/union/union_vnops.c index 648f667bb8..1b32543ed8 100644 --- a/sys/vfs/union/union_vnops.c +++ b/sys/vfs/union/union_vnops.c @@ -36,7 +36,7 @@ * * @(#)union_vnops.c 8.32 (Berkeley) 6/23/95 * $FreeBSD: src/sys/miscfs/union/union_vnops.c,v 1.72 1999/12/15 23:02:14 eivind Exp $ - * $DragonFly: src/sys/vfs/union/union_vnops.c,v 1.37 2007/05/06 19:23:35 dillon Exp $ + * $DragonFly: src/sys/vfs/union/union_vnops.c,v 1.38 2007/08/13 17:31:57 dillon Exp $ */ #include @@ -1684,7 +1684,7 @@ union_reclaim(struct vop_reclaim_args *ap) * For some reason we cannot return the 'real' vnode either, it seems * to blow up memory maps. * - * union_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * union_bmap(struct vnode *a_vp, off_t a_loffset, * off_t *a_doffsetp, int *a_runp, int *a_runb) */ static int diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 9f37bf7f58..ba4f2d15e0 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -39,7 +39,7 @@ * * from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91 * $FreeBSD: src/sys/vm/vnode_pager.c,v 1.116.2.7 2002/12/31 09:34:51 dillon Exp $ - * $DragonFly: src/sys/vm/vnode_pager.c,v 1.36 2007/08/13 17:18:16 dillon Exp $ + * $DragonFly: src/sys/vm/vnode_pager.c,v 1.37 2007/08/13 17:31:53 dillon Exp $ */ /* @@ -215,7 +215,7 @@ vnode_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, bsize = vp->v_mount->mnt_stat.f_iosize; voff = loffset % bsize; - error = VOP_BMAP(vp, loffset - voff, NULL, &doffset, after, before); + error = VOP_BMAP(vp, loffset - voff, &doffset, after, before); if (error) return TRUE; if (doffset == NOOFFSET) -- 2.41.0