Make VOP_BMAP return a struct bufobj for the underlying storage device
instead of a vnode for it. The vnode_pager does not and should not have any interest in what the filesystem uses for backend. (vfs_cluster doesn't use the backing store argument.)
This commit is contained in:
parent
5c6e573ffb
commit
9c83534dd8
@ -1679,7 +1679,7 @@ coda_bmap(v)
|
||||
struct vop_bmap_args *ap = v;
|
||||
struct vnode *vp __attribute__((unused)) = ap->a_vp; /* file's vnode */
|
||||
daddr_t bn __attribute__((unused)) = ap->a_bn; /* fs block number */
|
||||
struct vnode **vpp = ap->a_vpp; /* RETURN vp of device */
|
||||
struct bufobj **bop = ap->a_bop; /* RETURN bufobj of device */
|
||||
daddr_t *bnp __attribute__((unused)) = ap->a_bnp; /* RETURN device block number */
|
||||
struct thread *td __attribute__((unused)) = curthread;
|
||||
/* upcall decl */
|
||||
@ -1691,10 +1691,10 @@ coda_bmap(v)
|
||||
cp = VTOC(vp);
|
||||
if (cp->c_ovp) {
|
||||
return EINVAL;
|
||||
ret = VOP_BMAP(cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb);
|
||||
ret = VOP_BMAP(cp->c_ovp, bn, bop, bnp, ap->a_runp, ap->a_runb);
|
||||
#if 0
|
||||
printf("VOP_BMAP(cp->c_ovp %p, bn %p, vpp %p, bnp %lld, ap->a_runp %p, ap->a_runb %p) = %d\n",
|
||||
cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb, ret);
|
||||
printf("VOP_BMAP(cp->c_ovp %p, bn %p, bop %p, bnp %lld, ap->a_runp %p, ap->a_runb %p) = %d\n",
|
||||
cp->c_ovp, bn, bop, bnp, ap->a_runp, ap->a_runb, ret);
|
||||
#endif
|
||||
return ret;
|
||||
} else {
|
||||
|
@ -55,7 +55,7 @@ cd9660_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
struct bufobj **a_bop;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
int *a_runb;
|
||||
@ -69,8 +69,8 @@ cd9660_bmap(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_mnt->im_devvp;
|
||||
if (ap->a_bop != NULL)
|
||||
*ap->a_bop = &ip->i_mnt->im_devvp->v_bufobj;
|
||||
if (ap->a_bnp == NULL)
|
||||
return (0);
|
||||
|
||||
|
@ -1679,7 +1679,7 @@ coda_bmap(v)
|
||||
struct vop_bmap_args *ap = v;
|
||||
struct vnode *vp __attribute__((unused)) = ap->a_vp; /* file's vnode */
|
||||
daddr_t bn __attribute__((unused)) = ap->a_bn; /* fs block number */
|
||||
struct vnode **vpp = ap->a_vpp; /* RETURN vp of device */
|
||||
struct bufobj **bop = ap->a_bop; /* RETURN bufobj of device */
|
||||
daddr_t *bnp __attribute__((unused)) = ap->a_bnp; /* RETURN device block number */
|
||||
struct thread *td __attribute__((unused)) = curthread;
|
||||
/* upcall decl */
|
||||
@ -1691,10 +1691,10 @@ coda_bmap(v)
|
||||
cp = VTOC(vp);
|
||||
if (cp->c_ovp) {
|
||||
return EINVAL;
|
||||
ret = VOP_BMAP(cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb);
|
||||
ret = VOP_BMAP(cp->c_ovp, bn, bop, bnp, ap->a_runp, ap->a_runb);
|
||||
#if 0
|
||||
printf("VOP_BMAP(cp->c_ovp %p, bn %p, vpp %p, bnp %lld, ap->a_runp %p, ap->a_runb %p) = %d\n",
|
||||
cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb, ret);
|
||||
printf("VOP_BMAP(cp->c_ovp %p, bn %p, bop %p, bnp %lld, ap->a_runp %p, ap->a_runb %p) = %d\n",
|
||||
cp->c_ovp, bn, bop, bnp, ap->a_runp, ap->a_runb, ret);
|
||||
#endif
|
||||
return ret;
|
||||
} else {
|
||||
|
@ -220,7 +220,7 @@ dead_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
struct bufobj **a_bop;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
int *a_runb;
|
||||
@ -229,7 +229,7 @@ dead_bmap(ap)
|
||||
|
||||
if (!chkvnlock(ap->a_vp))
|
||||
return (EIO);
|
||||
return (VOP_BMAP(ap->a_vp, ap->a_bn, ap->a_vpp, ap->a_bnp, ap->a_runp, ap->a_runb));
|
||||
return (VOP_BMAP(ap->a_vp, ap->a_bn, ap->a_bop, ap->a_bnp, ap->a_runp, ap->a_runb));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -240,7 +240,7 @@ hpfs_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
struct bufobj **a_bop;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
int *a_runb;
|
||||
@ -250,8 +250,8 @@ hpfs_bmap(ap)
|
||||
daddr_t blkno;
|
||||
int error;
|
||||
|
||||
if (ap->a_vpp != NULL)
|
||||
*ap->a_vpp = hp->h_devvp;
|
||||
if (ap->a_bop != NULL)
|
||||
*ap->a_bop = &hp->h_devvp->v_bufobj;
|
||||
if (ap->a_runb != NULL)
|
||||
*ap->a_runb = 0;
|
||||
if (ap->a_bnp == NULL)
|
||||
|
@ -1736,7 +1736,7 @@ msdosfs_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
struct bufobj **a_bop;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
int *a_runb;
|
||||
@ -1746,8 +1746,8 @@ msdosfs_bmap(ap)
|
||||
daddr_t blkno;
|
||||
int error;
|
||||
|
||||
if (ap->a_vpp != NULL)
|
||||
*ap->a_vpp = dep->de_devvp;
|
||||
if (ap->a_bop != NULL)
|
||||
*ap->a_bop = &dep->de_devvp->v_bufobj;
|
||||
if (ap->a_bnp == NULL)
|
||||
return (0);
|
||||
if (ap->a_runp) {
|
||||
|
@ -91,15 +91,15 @@ ntfs_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
struct bufobj **a_bop;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
int *a_runb;
|
||||
} */ *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_bop != NULL)
|
||||
*ap->a_bop = &ap->a_vp->v_bufobj;
|
||||
if (ap->a_bnp != NULL)
|
||||
*ap->a_bnp = ap->a_bn;
|
||||
if (ap->a_runp != NULL)
|
||||
|
@ -867,8 +867,8 @@ 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_bop != NULL)
|
||||
*a->a_bop = &node->i_devvp->v_bufobj;
|
||||
if (a->a_bnp == NULL)
|
||||
return (0);
|
||||
if (a->a_runb)
|
||||
|
@ -61,7 +61,7 @@ ext2_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
struct bufobj **a_bop;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
int *a_runb;
|
||||
@ -74,8 +74,8 @@ ext2_bmap(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_bop != NULL)
|
||||
*ap->a_bop = &VTOI(ap->a_vp)->i_devvp->v_bufobj;
|
||||
if (ap->a_bnp == NULL)
|
||||
return (0);
|
||||
|
||||
|
@ -61,7 +61,7 @@ ext2_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
struct bufobj **a_bop;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
int *a_runb;
|
||||
@ -74,8 +74,8 @@ ext2_bmap(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_bop != NULL)
|
||||
*ap->a_bop = &VTOI(ap->a_vp)->i_devvp->v_bufobj;
|
||||
if (ap->a_bnp == NULL)
|
||||
return (0);
|
||||
|
||||
|
@ -55,7 +55,7 @@ cd9660_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
struct bufobj **a_bop;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
int *a_runb;
|
||||
@ -69,8 +69,8 @@ cd9660_bmap(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_mnt->im_devvp;
|
||||
if (ap->a_bop != NULL)
|
||||
*ap->a_bop = &ip->i_mnt->im_devvp->v_bufobj;
|
||||
if (ap->a_bnp == NULL)
|
||||
return (0);
|
||||
|
||||
|
@ -508,15 +508,15 @@ vop_stdbmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
struct bufobj **a_bop;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
int *a_runb;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
if (ap->a_vpp != NULL)
|
||||
*ap->a_vpp = ap->a_vp;
|
||||
if (ap->a_bop != NULL)
|
||||
*ap->a_bop = &ap->a_vp->v_bufobj;
|
||||
if (ap->a_bnp != NULL)
|
||||
*ap->a_bnp = ap->a_bn * btodb(ap->a_vp->v_mount->mnt_stat.f_iosize);
|
||||
if (ap->a_runp != NULL)
|
||||
|
@ -382,12 +382,11 @@ vop_unlock {
|
||||
|
||||
#
|
||||
#% bmap vp L L L
|
||||
#% bmap vpp - U -
|
||||
#
|
||||
vop_bmap {
|
||||
IN struct vnode *vp;
|
||||
IN daddr_t bn;
|
||||
OUT struct vnode **vpp;
|
||||
OUT struct bufobj **bop;
|
||||
IN daddr_t *bnp;
|
||||
OUT int *runp;
|
||||
OUT int *runb;
|
||||
|
@ -63,7 +63,7 @@ ufs_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
struct bufobj **a_bop;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
int *a_runb;
|
||||
@ -76,8 +76,8 @@ ufs_bmap(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_bop != NULL)
|
||||
*ap->a_bop = &VTOI(ap->a_vp)->i_devvp->v_bufobj;
|
||||
if (ap->a_bnp == NULL)
|
||||
return (0);
|
||||
|
||||
|
@ -433,7 +433,8 @@ vnode_pager_input_smlfs(object, m)
|
||||
vm_page_t m;
|
||||
{
|
||||
int i;
|
||||
struct vnode *dp, *vp;
|
||||
struct vnode *vp;
|
||||
struct bufobj *bo;
|
||||
struct buf *bp;
|
||||
struct sf_buf *sf;
|
||||
int fileaddr;
|
||||
@ -448,7 +449,7 @@ vnode_pager_input_smlfs(object, m)
|
||||
|
||||
bsize = vp->v_mount->mnt_stat.f_iosize;
|
||||
|
||||
VOP_BMAP(vp, 0, &dp, 0, NULL, NULL);
|
||||
VOP_BMAP(vp, 0, &bo, 0, NULL, NULL);
|
||||
|
||||
sf = sf_buf_alloc(m, 0);
|
||||
|
||||
@ -476,7 +477,7 @@ vnode_pager_input_smlfs(object, m)
|
||||
bp->b_wcred = crhold(curthread->td_ucred);
|
||||
bp->b_data = (caddr_t)sf_buf_kva(sf) + i * bsize;
|
||||
bp->b_blkno = fileaddr;
|
||||
pbgetvp(dp, bp);
|
||||
pbgetbo(bo, bp);
|
||||
bp->b_bcount = bsize;
|
||||
bp->b_bufsize = bsize;
|
||||
bp->b_runningbufspace = bp->b_bufsize;
|
||||
@ -496,7 +497,7 @@ vnode_pager_input_smlfs(object, m)
|
||||
/*
|
||||
* free the buffer header back to the swap buffer pool
|
||||
*/
|
||||
pbrelvp(bp);
|
||||
pbrelbo(bp);
|
||||
relpbuf(bp, &vnode_pbuf_freecnt);
|
||||
if (error)
|
||||
break;
|
||||
@ -645,7 +646,7 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage)
|
||||
vm_offset_t kva;
|
||||
off_t foff, tfoff, nextoff;
|
||||
int i, j, size, bsize, first, firstaddr;
|
||||
struct vnode *dp;
|
||||
struct bufobj *bo;
|
||||
int runpg;
|
||||
int runend;
|
||||
struct buf *bp;
|
||||
@ -656,6 +657,8 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage)
|
||||
object = vp->v_object;
|
||||
count = bytecount / PAGE_SIZE;
|
||||
|
||||
KASSERT(vp->v_type != VCHR && vp->v_type != VBLK,
|
||||
("vnode_pager_generic_getpages does not support devices"));
|
||||
if (vp->v_mount == NULL)
|
||||
return VM_PAGER_BAD;
|
||||
|
||||
@ -672,7 +675,7 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage)
|
||||
/*
|
||||
* if we can't bmap, use old VOP code
|
||||
*/
|
||||
if (VOP_BMAP(vp, 0, &dp, 0, NULL, NULL)) {
|
||||
if (VOP_BMAP(vp, 0, &bo, 0, NULL, NULL)) {
|
||||
VM_OBJECT_LOCK(object);
|
||||
vm_page_lock_queues();
|
||||
for (i = 0; i < count; i++)
|
||||
@ -803,8 +806,8 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage)
|
||||
/*
|
||||
* round up physical size for real devices.
|
||||
*/
|
||||
if (dp->v_type == VBLK || dp->v_type == VCHR) {
|
||||
int secmask = dp->v_bufobj.bo_bsize - 1;
|
||||
if (1) {
|
||||
int secmask = bo->bo_bsize - 1;
|
||||
KASSERT(secmask < PAGE_SIZE && secmask > 0,
|
||||
("vnode_pager_generic_getpages: sector size %d too large",
|
||||
secmask + 1));
|
||||
@ -827,7 +830,7 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage)
|
||||
bp->b_rcred = crhold(curthread->td_ucred);
|
||||
bp->b_wcred = crhold(curthread->td_ucred);
|
||||
bp->b_blkno = firstaddr;
|
||||
pbgetvp(dp, bp);
|
||||
pbgetbo(bo, bp);
|
||||
bp->b_bcount = size;
|
||||
bp->b_bufsize = size;
|
||||
bp->b_runningbufspace = bp->b_bufsize;
|
||||
@ -854,7 +857,7 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage)
|
||||
/*
|
||||
* free the buffer header back to the swap buffer pool
|
||||
*/
|
||||
pbrelvp(bp);
|
||||
pbrelbo(bp);
|
||||
relpbuf(bp, &vnode_pbuf_freecnt);
|
||||
|
||||
VM_OBJECT_LOCK(object);
|
||||
|
Loading…
Reference in New Issue
Block a user