Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/ext2fs/ext2_bmap.c
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | ext2_bmap(struct vop_bmap_args *ap) | ||||
daddr_t blkno; | daddr_t blkno; | ||||
int error; | int error; | ||||
/* | /* | ||||
* Check for underlying vnode requests and ensure that logical | * Check for underlying vnode requests and ensure that logical | ||||
* to physical mapping is requested. | * to physical mapping is requested. | ||||
*/ | */ | ||||
if (ap->a_bop != NULL) | if (ap->a_bop != NULL) | ||||
*ap->a_bop = &VTOI(ap->a_vp)->i_devvp->v_bufobj; | *ap->a_bop = vp2bo(VTOI(ap->a_vp)->i_devvp); | ||||
if (ap->a_bnp == NULL) | if (ap->a_bnp == NULL) | ||||
return (0); | return (0); | ||||
if (VTOI(ap->a_vp)->i_flag & IN_E4EXTENTS) | if (VTOI(ap->a_vp)->i_flag & IN_E4EXTENTS) | ||||
error = ext4_bmapext(ap->a_vp, ap->a_bn, &blkno, | error = ext4_bmapext(ap->a_vp, ap->a_bn, &blkno, | ||||
ap->a_runp, ap->a_runb); | ap->a_runp, ap->a_runb); | ||||
else | else | ||||
error = ext2_bmaparray(ap->a_vp, ap->a_bn, &blkno, | error = ext2_bmaparray(ap->a_vp, ap->a_bn, &blkno, | ||||
▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | ext2_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, int *runp, int *runb) | ||||
for (bp = NULL, ++ap; --num; ++ap) { | for (bp = NULL, ++ap; --num; ++ap) { | ||||
/* | /* | ||||
* Exit the loop if there is no disk address assigned yet and | * Exit the loop if there is no disk address assigned yet and | ||||
* the indirect block isn't in the cache, or if we were | * the indirect block isn't in the cache, or if we were | ||||
* looking for an indirect block and we've found it. | * looking for an indirect block and we've found it. | ||||
*/ | */ | ||||
metalbn = ap->in_lbn; | metalbn = ap->in_lbn; | ||||
if ((daddr == 0 && !incore(&vp->v_bufobj, metalbn)) || metalbn == bn) | if ((daddr == 0 && !incore(vp2bo(vp), metalbn)) || | ||||
metalbn == bn) | |||||
break; | break; | ||||
/* | /* | ||||
* If we get here, we've either got the block in the cache | * If we get here, we've either got the block in the cache | ||||
* or we have a disk address for it, go fetch it. | * or we have a disk address for it, go fetch it. | ||||
*/ | */ | ||||
if (bp) | if (bp) | ||||
bqrelse(bp); | bqrelse(bp); | ||||
error = readindir(vp, metalbn, daddr, &bp); | error = readindir(vp, metalbn, daddr, &bp); | ||||
▲ Show 20 Lines • Show All 228 Lines • Show Last 20 Lines |